@@ -60,6 +60,7 @@ public static function init() {
6060 add_action ( 'wp_ajax_wpephpcompat_start_test ' , array ( self ::instance (), 'start_test ' ) );
6161 add_action ( 'wp_ajax_wpephpcompat_check_status ' , array ( self ::instance (), 'check_status ' ) );
6262 add_action ( 'wpephpcompat_start_test_cron ' , array ( self ::instance (), 'start_test ' ) );
63+ add_action ( 'wp_ajax_wpephpcompat_clean_up ' , array ( self ::instance (), 'clean_up ' ) );
6364
6465 // Create custom post type.
6566 add_action ( 'init ' , array ( self ::instance (), 'create_job_queue ' ) );
@@ -147,6 +148,21 @@ function check_status() {
147148 }
148149 }
149150
151+ /**
152+ * Remove all database options from the database.
153+ *
154+ * @since 1.3.2
155+ * @action wp_ajax_wpephpcompat_clean_up
156+ */
157+ function clean_up () {
158+ if ( current_user_can ( 'manage_options ' ) || ( defined ( 'DOING_CRON ' ) && DOING_CRON ) ) {
159+ $ wpephpc = new \WPEPHPCompat ( __DIR__ );
160+ $ wpephpc ->clean_after_scan ();
161+ delete_option ( 'wpephpcompat.scan_results ' );
162+ wp_send_json ( 'success ' );
163+ }
164+ }
165+
150166 /**
151167 * Create custom post type to store the directories we need to process.
152168 *
@@ -301,7 +317,9 @@ function settings_page() {
301317 </p>
302318 <p>
303319 <input style="float: left;" name="run" id="runButton" type="button" value="<?php esc_attr_e ( 'Run ' , 'php-compatibility-checker ' ); ?> " class="button-primary" />
304- <div style="display:none; visibility: visible; float: none;" class="spinner"></div>
320+ <div class="wpe-tooltip"><input style="float: left; margin-left: 5px;" name="run" id="cleanupButton" type="button" value="<?php esc_attr_e ( 'Clean up ' , 'php-compatibility-checker ' ); ?> " class="button" />
321+ <span class="wpe-tooltiptext">This will remove all database options related to this plugin, but it will not stop a scan in progress. If you'd like to completly remove all data wait for the scan to finish before hitting this button.</span></div>
322+ <div style="display:none; visibility: visible; float: left;" class="spinner"></div>
305323 </p>
306324 </div>
307325
0 commit comments