Skip to content

Commit 989ff65

Browse files
committed
Merge branch 'master' into fork
2 parents a80c146 + 62fc9f1 commit 989ff65

File tree

5 files changed

+69
-3
lines changed

5 files changed

+69
-3
lines changed

src/css/style.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,29 @@
9797
{
9898
display: inline;
9999
}
100+
101+
/* Tooltip container */
102+
.wpe-tooltip {
103+
position: relative;
104+
display: inline-block;
105+
}
106+
107+
/* Tooltip text */
108+
.wpe-tooltip .wpe-tooltiptext {
109+
visibility: hidden;
110+
width: 340px;
111+
background-color: black;
112+
color: #fff;
113+
text-align: center;
114+
padding: 5px 0;
115+
border-radius: 6px;
116+
position: absolute;
117+
z-index: 1;
118+
top: -25px;
119+
left: 105%;
120+
}
121+
122+
/* Show the tooltip text when you mouse over the tooltip container */
123+
.wpe-tooltip:hover .wpe-tooltiptext {
124+
visibility: visible;
125+
}

src/js/run.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ jQuery( document ).ready(function($) {
3535
$( '.spinner' ).show();
3636
// Empty the results textarea.
3737
resetDisplay();
38-
$( '#footer' ).hide();
3938
test_version = $( 'input[name=phptest_version]:checked' ).val();
4039
only_active = $( 'input[name=active_plugins]:checked' ).val();
4140
var data = {
@@ -53,6 +52,15 @@ jQuery( document ).ready(function($) {
5352
checkStatus();
5453
});
5554
});
55+
56+
$( '#cleanupButton' ).on( 'click', function() {
57+
clearTimeout( timer );
58+
jQuery.get( ajaxurl, { 'action': 'wpephpcompat_clean_up' }, function() {
59+
resetDisplay();
60+
checkStatus();
61+
});
62+
});
63+
5664
});
5765
/**
5866
* Check the scan status and display results if scan is done.
@@ -111,7 +119,7 @@ function checkStatus() {
111119
// Server responded correctly, but the response wasn't valid.
112120
if ( 200 === xhr.status ) {
113121
alert( "Error: " + error + "\nResponse: " + xhr.responseText );
114-
}
122+
}
115123
else { // Server didn't respond correctly.
116124
alert( "Error: " + error + "\nStatus: " + xhr.status );
117125
}
@@ -128,6 +136,7 @@ function resetDisplay() {
128136
jQuery( '#standardMode' ).html('');
129137
jQuery( '#wpe-progress-count' ).text('');
130138
jQuery( '#wpe-progress-active' ).text('');
139+
jQuery( '#footer' ).hide();
131140
}
132141
/**
133142
* Loop through a string and count the total matches.

src/wpcli.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function __invoke( $args, $assoc_args ) {
4444
WP_CLI::log( $results );
4545

4646
$wpephpc->clean_after_scan();
47+
delete_option( 'wpephpcompat.scan_results' );
4748

4849
if ( preg_match( '/(\d*) ERRORS?/i', $results ) ) {
4950
WP_CLI::error( 'Your WordPress install is not compatible.' );

uninstall.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
// If uninstall.php is not called by WordPress, die.
4+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
5+
die;
6+
}
7+
8+
require_once( __DIR__ . '/src/wpephpcompat.php' );
9+
10+
$wpephpc = new \WPEPHPCompat( __DIR__ );
11+
$wpephpc->clean_after_scan();
12+
delete_option( 'wpephpcompat.scan_results' );

wpengine-phpcompat.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)