@@ -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 ' ) );
@@ -191,6 +192,21 @@ function fork_scan( $test_version, $only_active ) {
191192 wp_remote_post ( esc_url_raw ( $ url ), $ args );
192193 }
193194
195+ /**
196+ * Remove all database options from the database.
197+ *
198+ * @since 1.3.2
199+ * @action wp_ajax_wpephpcompat_clean_up
200+ */
201+ function clean_up () {
202+ if ( current_user_can ( 'manage_options ' ) || ( defined ( 'DOING_CRON ' ) && DOING_CRON ) ) {
203+ $ wpephpc = new \WPEPHPCompat ( __DIR__ );
204+ $ wpephpc ->clean_after_scan ();
205+ delete_option ( 'wpephpcompat.scan_results ' );
206+ wp_send_json ( 'success ' );
207+ }
208+ }
209+
194210 /**
195211 * Create custom post type to store the directories we need to process.
196212 *
@@ -345,7 +361,9 @@ function settings_page() {
345361 </p>
346362 <p>
347363 <input style="float: left;" name="run" id="runButton" type="button" value="<?php esc_attr_e ( 'Run ' , 'php-compatibility-checker ' ); ?> " class="button-primary" />
348- <div style="display:none; visibility: visible; float: none;" class="spinner"></div>
364+ <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" />
365+ <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>
366+ <div style="display:none; visibility: visible; float: left;" class="spinner"></div>
349367 </p>
350368 </div>
351369
0 commit comments