Version Description
- Added a "Clean up" button and uninstall.php.
- Added phpcompat_phpversions filter.
Download this release
Release Info
Developer | wpengine |
Plugin | PHP Compatibility Checker |
Version | 1.3.2 |
Comparing to | |
See all releases |
Code changes from version 1.3.1 to 1.3.2
- readme.txt +8 -3
- src/css/style.css +26 -0
- src/js/run.js +11 -2
- src/wpcli.php +1 -0
- uninstall.php +12 -0
- wpengine-phpcompat.php +41 -7
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: wpengine, octalmage, stevenkword, Taylor4484, pross
|
|
3 |
Tags: php 7, php 5.5, php, version, compatibility, checker, wp engine, wpe, wpengine
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.6
|
6 |
-
Stable tag: 1.3.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -114,6 +114,10 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
|
|
114 |
|
115 |
== Changelog ==
|
116 |
|
|
|
|
|
|
|
|
|
117 |
= 1.3.1 =
|
118 |
- Whitelisted a number of plugins.
|
119 |
|
@@ -179,5 +183,6 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
|
|
179 |
|
180 |
== Upgrade Notice ==
|
181 |
|
182 |
-
= 1.3.
|
183 |
-
-
|
|
3 |
Tags: php 7, php 5.5, php, version, compatibility, checker, wp engine, wpe, wpengine
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 4.6
|
6 |
+
Stable tag: 1.3.2
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
114 |
|
115 |
== Changelog ==
|
116 |
|
117 |
+
= 1.3.2 =
|
118 |
+
- Added a "Clean up" button and uninstall.php.
|
119 |
+
- Added phpcompat_phpversions filter.
|
120 |
+
|
121 |
= 1.3.1 =
|
122 |
- Whitelisted a number of plugins.
|
123 |
|
183 |
|
184 |
== Upgrade Notice ==
|
185 |
|
186 |
+
= 1.3.2 =
|
187 |
+
- Added a "Clean up" button and uninstall.php.
|
188 |
+
- Added phpcompat_phpversions filter.
|
src/css/style.css
CHANGED
@@ -97,3 +97,29 @@
|
|
97 |
{
|
98 |
display: inline;
|
99 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
{
|
98 |
display: inline;
|
99 |
}
|
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
CHANGED
@@ -35,7 +35,6 @@ jQuery( document ).ready(function($) {
|
|
35 |
$( '.spinner' ).show();
|
36 |
// Empty the results textarea.
|
37 |
resetDisplay();
|
38 |
-
$( '#footer' ).hide();
|
39 |
test_version = $( 'input[name=phptest_version]:checked' ).val();
|
40 |
only_active = $( 'input[name=active_plugins]:checked' ).val();
|
41 |
var data = {
|
@@ -53,6 +52,15 @@ jQuery( document ).ready(function($) {
|
|
53 |
checkStatus();
|
54 |
});
|
55 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
});
|
57 |
/**
|
58 |
* Check the scan status and display results if scan is done.
|
@@ -109,7 +117,7 @@ function checkStatus() {
|
|
109 |
// Server responded correctly, but the response wasn't valid.
|
110 |
if ( 200 === xhr.status ) {
|
111 |
alert( "Error: " + error + "\nResponse: " + xhr.responseText );
|
112 |
-
}
|
113 |
else { // Server didn't respond correctly.
|
114 |
alert( "Error: " + error + "\nStatus: " + xhr.status );
|
115 |
}
|
@@ -126,6 +134,7 @@ function resetDisplay() {
|
|
126 |
jQuery( '#standardMode' ).html('');
|
127 |
jQuery( '#wpe-progress-count' ).text('');
|
128 |
jQuery( '#wpe-progress-active' ).text('');
|
|
|
129 |
}
|
130 |
/**
|
131 |
* Loop through a string and count the total matches.
|
35 |
$( '.spinner' ).show();
|
36 |
// Empty the results textarea.
|
37 |
resetDisplay();
|
|
|
38 |
test_version = $( 'input[name=phptest_version]:checked' ).val();
|
39 |
only_active = $( 'input[name=active_plugins]:checked' ).val();
|
40 |
var data = {
|
52 |
checkStatus();
|
53 |
});
|
54 |
});
|
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 |
+
|
64 |
});
|
65 |
/**
|
66 |
* Check the scan status and display results if scan is done.
|
117 |
// Server responded correctly, but the response wasn't valid.
|
118 |
if ( 200 === xhr.status ) {
|
119 |
alert( "Error: " + error + "\nResponse: " + xhr.responseText );
|
120 |
+
}
|
121 |
else { // Server didn't respond correctly.
|
122 |
alert( "Error: " + error + "\nStatus: " + xhr.status );
|
123 |
}
|
134 |
jQuery( '#standardMode' ).html('');
|
135 |
jQuery( '#wpe-progress-count' ).text('');
|
136 |
jQuery( '#wpe-progress-active' ).text('');
|
137 |
+
jQuery( '#footer' ).hide();
|
138 |
}
|
139 |
/**
|
140 |
* Loop through a string and count the total matches.
|
src/wpcli.php
CHANGED
@@ -44,6 +44,7 @@ class PHPCompat_Command extends WP_CLI_Command {
|
|
44 |
WP_CLI::log( $results );
|
45 |
|
46 |
$wpephpc->clean_after_scan();
|
|
|
47 |
|
48 |
if ( preg_match( '/(\d*) ERRORS?/i', $results ) ) {
|
49 |
WP_CLI::error( 'Your WordPress install is not compatible.' );
|
44 |
WP_CLI::log( $results );
|
45 |
|
46 |
$wpephpc->clean_after_scan();
|
47 |
+
delete_option( 'wpephpcompat.scan_results' );
|
48 |
|
49 |
if ( preg_match( '/(\d*) ERRORS?/i', $results ) ) {
|
50 |
WP_CLI::error( 'Your WordPress install is not compatible.' );
|
uninstall.php
ADDED
@@ -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
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: PHP Compatibility Checker
|
|
4 |
Plugin URI: https://wpengine.com
|
5 |
Description: Make sure your plugins and themes are compatible with newer PHP versions.
|
6 |
Author: WP Engine
|
7 |
-
Version: 1.3.
|
8 |
Author URI: https://wpengine.com
|
9 |
Text Domain: php-compatibility-checker
|
10 |
*/
|
@@ -60,11 +60,26 @@ class WPEngine_PHPCompat {
|
|
60 |
add_action( 'wp_ajax_wpephpcompat_start_test', array( self::instance(), 'start_test' ) );
|
61 |
add_action( 'wp_ajax_wpephpcompat_check_status', array( self::instance(), 'check_status' ) );
|
62 |
add_action( 'wpephpcompat_start_test_cron', array( self::instance(), 'start_test' ) );
|
|
|
63 |
|
64 |
// Create custom post type.
|
65 |
add_action( 'init', array( self::instance(), 'create_job_queue' ) );
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
/**
|
69 |
* Start the test!
|
70 |
*
|
@@ -147,6 +162,21 @@ class WPEngine_PHPCompat {
|
|
147 |
}
|
148 |
}
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
/**
|
151 |
* Create custom post type to store the directories we need to process.
|
152 |
*
|
@@ -234,6 +264,8 @@ class WPEngine_PHPCompat {
|
|
234 |
$test_version = get_option( 'wpephpcompat.test_version' );
|
235 |
$only_active = get_option( 'wpephpcompat.only_active' );
|
236 |
|
|
|
|
|
237 |
// Assigns defaults for the scan if none are found in the database.
|
238 |
$test_version = ( false !== $test_version ) ? $test_version : '7.0';
|
239 |
$only_active = ( false !== $only_active ) ? $only_active : 'yes';
|
@@ -261,11 +293,11 @@ class WPEngine_PHPCompat {
|
|
261 |
<tr>
|
262 |
<th scope="row"><label for="phptest_version"><?php esc_attr_e( 'PHP Version', 'php-compatibility-checker' ); ?></label></th>
|
263 |
<td>
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
</td>
|
270 |
</tr>
|
271 |
<tr>
|
@@ -301,7 +333,9 @@ class WPEngine_PHPCompat {
|
|
301 |
</p>
|
302 |
<p>
|
303 |
<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="
|
|
|
|
|
305 |
</p>
|
306 |
</div>
|
307 |
|
4 |
Plugin URI: https://wpengine.com
|
5 |
Description: Make sure your plugins and themes are compatible with newer PHP versions.
|
6 |
Author: WP Engine
|
7 |
+
Version: 1.3.2
|
8 |
Author URI: https://wpengine.com
|
9 |
Text Domain: php-compatibility-checker
|
10 |
*/
|
60 |
add_action( 'wp_ajax_wpephpcompat_start_test', array( self::instance(), 'start_test' ) );
|
61 |
add_action( 'wp_ajax_wpephpcompat_check_status', array( self::instance(), 'check_status' ) );
|
62 |
add_action( 'wpephpcompat_start_test_cron', array( self::instance(), 'start_test' ) );
|
63 |
+
add_action( 'wp_ajax_wpephpcompat_clean_up', array( self::instance(), 'clean_up' ) );
|
64 |
|
65 |
// Create custom post type.
|
66 |
add_action( 'init', array( self::instance(), 'create_job_queue' ) );
|
67 |
}
|
68 |
|
69 |
+
/**
|
70 |
+
* Return an array of available PHP versions to test.
|
71 |
+
*/
|
72 |
+
function get_phpversions() {
|
73 |
+
|
74 |
+
return apply_filters( 'phpcompat_phpversions', array(
|
75 |
+
'PHP 7.0' => '7.0',
|
76 |
+
'PHP 5.6' => '5.6',
|
77 |
+
'PHP 5.5' => '5.5',
|
78 |
+
'PHP 5.4' => '5.4',
|
79 |
+
'PHP 5.3' => '5.3',
|
80 |
+
));
|
81 |
+
}
|
82 |
+
|
83 |
/**
|
84 |
* Start the test!
|
85 |
*
|
162 |
}
|
163 |
}
|
164 |
|
165 |
+
/**
|
166 |
+
* Remove all database options from the database.
|
167 |
+
*
|
168 |
+
* @since 1.3.2
|
169 |
+
* @action wp_ajax_wpephpcompat_clean_up
|
170 |
+
*/
|
171 |
+
function clean_up() {
|
172 |
+
if ( current_user_can( 'manage_options' ) || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
|
173 |
+
$wpephpc = new \WPEPHPCompat( __DIR__ );
|
174 |
+
$wpephpc->clean_after_scan();
|
175 |
+
delete_option( 'wpephpcompat.scan_results' );
|
176 |
+
wp_send_json( 'success' );
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
/**
|
181 |
* Create custom post type to store the directories we need to process.
|
182 |
*
|
264 |
$test_version = get_option( 'wpephpcompat.test_version' );
|
265 |
$only_active = get_option( 'wpephpcompat.only_active' );
|
266 |
|
267 |
+
$phpversions = $this->get_phpversions();
|
268 |
+
|
269 |
// Assigns defaults for the scan if none are found in the database.
|
270 |
$test_version = ( false !== $test_version ) ? $test_version : '7.0';
|
271 |
$only_active = ( false !== $only_active ) ? $only_active : 'yes';
|
293 |
<tr>
|
294 |
<th scope="row"><label for="phptest_version"><?php esc_attr_e( 'PHP Version', 'php-compatibility-checker' ); ?></label></th>
|
295 |
<td>
|
296 |
+
<?php
|
297 |
+
foreach ( $phpversions as $name => $version ) {
|
298 |
+
printf( '<label><input type="radio" name="phptest_version" value="%s" %s /> %s</label><br>', $version, checked( $test_version, $version, false ), $name );
|
299 |
+
}
|
300 |
+
?>
|
301 |
</td>
|
302 |
</tr>
|
303 |
<tr>
|
333 |
</p>
|
334 |
<p>
|
335 |
<input style="float: left;" name="run" id="runButton" type="button" value="<?php esc_attr_e( 'Run', 'php-compatibility-checker' ); ?>" class="button-primary" />
|
336 |
+
<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" />
|
337 |
+
<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>
|
338 |
+
<div style="display:none; visibility: visible; float: left;" class="spinner"></div>
|
339 |
</p>
|
340 |
</div>
|
341 |
|