Version Description
- Fixed a bug in the WP-CLI command
- Added a handful of PHP 7 compatible plugins to the whitelist
Download this release
Release Info
Developer | wpengine |
Plugin | PHP Compatibility Checker |
Version | 1.0.3 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.0.3
- readme.txt +24 -16
- src/wpcli.php +27 -19
- src/wpephpcompat.php +41 -1
- wpengine-phpcompat.php +1 -1
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: wpengine, octalmage, stevenkword, taylor4484
|
|
3 |
Tags: php 7, php 5.5, php, version, compatibility, checker, wp engine, wpe, wpengine
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 4.5
|
6 |
-
Stable tag: 1.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -17,7 +17,7 @@ This plugin will lint theme and plugin code inside your WordPress file system an
|
|
17 |
|
18 |
**This plugin does not execute your theme and plugin code, as such this plugin cannot detect runtime compatibility issues.**
|
19 |
|
20 |
-
**Please note that linting code is not perfect. We
|
21 |
|
22 |
= Update to PHP 7 =
|
23 |
* Use this plugin to check your site for compatibility for PHP 7!
|
@@ -69,23 +69,29 @@ Example: `wp phpcompat 5.5 --scan=active`
|
|
69 |
|
70 |
1. Will this work outside of the WP Engine hosting account?
|
71 |
|
72 |
-
Yes, this plugin can be used any ANY WordPress website on ANY host.
|
73 |
|
74 |
2. Are there WP-CLI commands available?
|
75 |
-
Yes, this plugin does extend WP-CLI and provide commands. See the [Other Notes](https://wordpress.org/plugins/php-compatibility-checker/other_notes/) tab for details.
|
76 |
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
-
Yes! While you cannot use this WordPress plugin to test your non-WordPress projects, you can use the [Open Source PHPCompatibility Library](https://github.com/wimg/PHPCompatibility) that this plugin is built on.
|
80 |
|
81 |
-
|
82 |
-
Some servers have timeouts to prevent long running queries, this is commonly 60 seconds. This can prevent the checker from being able to process large themes or plugins. You should check with your host to see if this timeout can be temporarily removed. The best way around this timeout issues is to run this plugin on a [local copy](https://make.wordpress.org/core/handbook/tutorials/installing-a-local-server/) of your site.
|
83 |
|
84 |
-
|
85 |
|
86 |
-
|
87 |
|
88 |
-
|
|
|
|
|
89 |
|
90 |
To disclose security issues for this plugin please email WordPress@wpengine.com
|
91 |
|
@@ -96,6 +102,10 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
|
|
96 |
|
97 |
== Changelog ==
|
98 |
|
|
|
|
|
|
|
|
|
99 |
= 1.0.2 =
|
100 |
- Added additional role protections
|
101 |
- Changed the UI colors to better understand output at a glance
|
@@ -118,8 +128,6 @@ To disclose security issues for this plugin please email WordPress@wpengine.com
|
|
118 |
|
119 |
== Upgrade Notice ==
|
120 |
|
121 |
-
= 1.0.
|
122 |
-
-
|
123 |
-
-
|
124 |
-
- Exclude checking node_modules and tmp directories
|
125 |
-
- Added support for child theme's parent theme
|
3 |
Tags: php 7, php 5.5, php, version, compatibility, checker, wp engine, wpe, wpengine
|
4 |
Requires at least: 3.0.1
|
5 |
Tested up to: 4.5
|
6 |
+
Stable tag: 1.0.3
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
17 |
|
18 |
**This plugin does not execute your theme and plugin code, as such this plugin cannot detect runtime compatibility issues.**
|
19 |
|
20 |
+
**Please note that linting code is not perfect. This plugin cannot detect unused codepaths that might be used for backwards compatibility, and thus might show false postiives. We maintain a [whitelist of plugins](https://github.com/wpengine/phpcompat/wiki/Results) that can cause false positives. We are continuously working to ensure the checker provides the most accurate results possible.**
|
21 |
|
22 |
= Update to PHP 7 =
|
23 |
* Use this plugin to check your site for compatibility for PHP 7!
|
69 |
|
70 |
1. Will this work outside of the WP Engine hosting account?
|
71 |
|
72 |
+
Yes, this plugin can be used any ANY WordPress website on ANY host.
|
73 |
|
74 |
2. Are there WP-CLI commands available?
|
|
|
75 |
|
76 |
+
Yes, this plugin does extend WP-CLI and provide commands. See the [Other Notes](https://wordpress.org/plugins/php-compatibility-checker/other_notes/) tab for details.
|
77 |
+
|
78 |
+
3. A plugin I created is listed as not compatible, what should I do?
|
79 |
+
|
80 |
+
We maintain a [whitelist of plugins](https://github.com/wpengine/phpcompat/wiki/Results) that cause false positives. If your plugin shows up as incompatible but you think that is wrong, please open a [GitHub issue](https://github.com/wpengine/phpcompat/issues/new) on the project, or email wordpress@wpengine.com with info about your plugin and why you know it is compatible (you have automated tests, the failure is on backwards compatibility codepaths, etc).
|
81 |
+
|
82 |
+
4. Can I use this to test non-WordPress PHP Projects?
|
83 |
|
84 |
+
Yes! While you cannot use this WordPress plugin to test your non-WordPress projects, you can use the [Open Source PHPCompatibility Library](https://github.com/wimg/PHPCompatibility) that this plugin is built on.
|
85 |
|
86 |
+
5. Why was my plugin/theme skipped?
|
|
|
87 |
|
88 |
+
Some servers have timeouts to prevent long running queries, this is commonly 60 seconds. This can prevent the checker from being able to process large themes or plugins. You should check with your host to see if this timeout can be temporarily removed. The best way around this timeout issues is to run this plugin on a [local copy](https://make.wordpress.org/core/handbook/tutorials/installing-a-local-server/) of your site.
|
89 |
|
90 |
+
6. I found a bug, or have a suggestion, can I contribute back?
|
91 |
|
92 |
+
Yes! WP Engine has a public GitHub repo where you can contribute back to this plugin. Please open an issue on the [Plugin GitHub](https://github.com/wpengine/phpcompat). We actively develop this plugin, and are always happy to receive pull requests.
|
93 |
+
|
94 |
+
The plugin was created by WP Engine to help the WordPress community increase adoption of modern PHP versions. We welcome contributors to this plugin, and are excited to see how developers and other WordPress hosts use this plugin.
|
95 |
|
96 |
To disclose security issues for this plugin please email WordPress@wpengine.com
|
97 |
|
102 |
|
103 |
== Changelog ==
|
104 |
|
105 |
+
= 1.0.3 =
|
106 |
+
- Fixed a bug in the WP-CLI command
|
107 |
+
- Added a handful of PHP 7 compatible plugins to the whitelist
|
108 |
+
|
109 |
= 1.0.2 =
|
110 |
- Added additional role protections
|
111 |
- Changed the UI colors to better understand output at a glance
|
128 |
|
129 |
== Upgrade Notice ==
|
130 |
|
131 |
+
= 1.0.3 =
|
132 |
+
- Fixed a bug in the WP-CLI command
|
133 |
+
- Added a handful of PHP 7 compatible plugins to the whitelist
|
|
|
|
src/wpcli.php
CHANGED
@@ -4,7 +4,7 @@ require_once( __DIR__ . '/../vendor/autoload.php' );
|
|
4 |
/**
|
5 |
* PHPCompat WP-CLI command.
|
6 |
*
|
7 |
-
*
|
8 |
*
|
9 |
* @since 1.0.0
|
10 |
*/
|
@@ -13,31 +13,18 @@ class PHPCompat_Command extends WP_CLI_Command {
|
|
13 |
/**
|
14 |
* Test compatibility with different PHP versions.
|
15 |
*
|
16 |
-
* ## OPTIONS
|
17 |
-
*
|
18 |
-
* <version>
|
19 |
-
* : PHP version to test.
|
20 |
-
*
|
21 |
-
* [--scan=<scan>]
|
22 |
-
* : Whether to scan only active plugins and themes or all of them.
|
23 |
-
* ---
|
24 |
-
* default: active
|
25 |
-
* options:
|
26 |
-
* - active
|
27 |
-
* - all
|
28 |
-
* ---
|
29 |
-
*
|
30 |
* ## EXAMPLES
|
31 |
*
|
32 |
* wp phpcompat 5.5 --scan=active
|
33 |
-
*
|
34 |
*/
|
35 |
function __invoke( $args, $assoc_args ) {
|
36 |
|
37 |
// Get the PHP test version.
|
38 |
$test_version = $args[0];
|
39 |
|
40 |
-
WP_CLI::
|
|
|
|
|
41 |
|
42 |
$root_dir = realpath( __DIR__ . '/../' );
|
43 |
|
@@ -54,7 +41,7 @@ class PHPCompat_Command extends WP_CLI_Command {
|
|
54 |
|
55 |
$results = $wpephpc->start_test();
|
56 |
|
57 |
-
|
58 |
|
59 |
$wpephpc->clean_after_scan();
|
60 |
|
@@ -67,4 +54,25 @@ class PHPCompat_Command extends WP_CLI_Command {
|
|
67 |
}
|
68 |
}
|
69 |
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
/**
|
5 |
* PHPCompat WP-CLI command.
|
6 |
*
|
7 |
+
* Test compatibility with different PHP versions.
|
8 |
*
|
9 |
* @since 1.0.0
|
10 |
*/
|
13 |
/**
|
14 |
* Test compatibility with different PHP versions.
|
15 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
* ## EXAMPLES
|
17 |
*
|
18 |
* wp phpcompat 5.5 --scan=active
|
|
|
19 |
*/
|
20 |
function __invoke( $args, $assoc_args ) {
|
21 |
|
22 |
// Get the PHP test version.
|
23 |
$test_version = $args[0];
|
24 |
|
25 |
+
WP_CLI::log( 'Testing compatibility with PHP ' . $test_version . '.' );
|
26 |
+
// Add empty line.
|
27 |
+
WP_CLI::log( '' );
|
28 |
|
29 |
$root_dir = realpath( __DIR__ . '/../' );
|
30 |
|
41 |
|
42 |
$results = $wpephpc->start_test();
|
43 |
|
44 |
+
WP_CLI::log( $results );
|
45 |
|
46 |
$wpephpc->clean_after_scan();
|
47 |
|
54 |
}
|
55 |
}
|
56 |
|
57 |
+
/**
|
58 |
+
* Using this for now since there are issues with the PHPDoc syntax.
|
59 |
+
* TODO: Use PHPDoc syntax.
|
60 |
+
*/
|
61 |
+
WP_CLI::add_command( 'phpcompat', 'PHPCompat_Command', array(
|
62 |
+
'shortdesc' => 'Test compatibility with different PHP versions.',
|
63 |
+
'synopsis' => array(
|
64 |
+
array(
|
65 |
+
'type' => 'positional',
|
66 |
+
'name' => 'version',
|
67 |
+
'optional' => false,
|
68 |
+
'multiple' => false,
|
69 |
+
),
|
70 |
+
array(
|
71 |
+
'type' => 'assoc',
|
72 |
+
'name' => 'scan',
|
73 |
+
'optional' => true,
|
74 |
+
'default' => 'active',
|
75 |
+
'options' => array( 'active', 'all' ),
|
76 |
+
),
|
77 |
+
)
|
78 |
+
));
|
src/wpephpcompat.php
CHANGED
@@ -57,6 +57,20 @@ class WPEPHPCompat {
|
|
57 |
*/
|
58 |
public $base = null;
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
/**
|
61 |
* @param string $dir Base plugin directory.
|
62 |
*/
|
@@ -209,7 +223,9 @@ class WPEPHPCompat {
|
|
209 |
$this->values['standard'] = 'PHPCompatibility';
|
210 |
$this->values['reportWidth'] = '9999';
|
211 |
$this->values['extensions'] = array( 'php' );
|
212 |
-
|
|
|
|
|
213 |
|
214 |
PHP_CodeSniffer::setConfigData( 'testVersion', $this->test_version, true );
|
215 |
|
@@ -221,6 +237,30 @@ class WPEPHPCompat {
|
|
221 |
|
222 |
return $this->clean_report( $report );
|
223 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
|
225 |
/**
|
226 |
* Generate a list of directories to scan and populate the queue.
|
57 |
*/
|
58 |
public $base = null;
|
59 |
|
60 |
+
/**
|
61 |
+
* Array of "directory name" => "latest PHP version it's compatible with".
|
62 |
+
*
|
63 |
+
* @todo Using the directory name is brittle, we shouldn't use it.
|
64 |
+
* @since 1.0.3
|
65 |
+
* @var array
|
66 |
+
*/
|
67 |
+
public $whitelist = array(
|
68 |
+
'*/jetpack/*' => '7.0', // https://github.com/wpengine/phpcompat/wiki/Results#jetpack
|
69 |
+
'*/wordfence/*' => '7.0', // https://github.com/wpengine/phpcompat/wiki/Results#wordfence-security
|
70 |
+
'*/woocommerce/*' => '7.0', // https://github.com/wpengine/phpcompat/wiki/Results#woocommerce
|
71 |
+
'*/wp-migrate-db/*' => '7.0', // https://github.com/wpengine/phpcompat/wiki/Results#wp-migrate-db
|
72 |
+
);
|
73 |
+
|
74 |
/**
|
75 |
* @param string $dir Base plugin directory.
|
76 |
*/
|
223 |
$this->values['standard'] = 'PHPCompatibility';
|
224 |
$this->values['reportWidth'] = '9999';
|
225 |
$this->values['extensions'] = array( 'php' );
|
226 |
+
|
227 |
+
// Whitelist.
|
228 |
+
$this->values['ignored'] = $this->generate_ignored_list();
|
229 |
|
230 |
PHP_CodeSniffer::setConfigData( 'testVersion', $this->test_version, true );
|
231 |
|
237 |
|
238 |
return $this->clean_report( $report );
|
239 |
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Generate a list of ignored files and directories.
|
243 |
+
*
|
244 |
+
* @since 1.0.3
|
245 |
+
* @return array An array containing files and directories that should be ignored.
|
246 |
+
*/
|
247 |
+
public function generate_ignored_list() {
|
248 |
+
// Default ignored list.
|
249 |
+
$ignored = array(
|
250 |
+
'*/tests/*', // No reason to scan tests.
|
251 |
+
'*/node_modules/*', // Commonly used for development but not in production.
|
252 |
+
'*/tmp/*', // Temporary files.
|
253 |
+
);
|
254 |
+
|
255 |
+
foreach ( $this->whitelist as $plugin => $version ) {
|
256 |
+
// Check to see if the plugin is compatible with the tested version.
|
257 |
+
if ( version_compare( $this->test_version, $version, '<=' ) ) {
|
258 |
+
array_push( $ignored, $plugin );
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
return $ignored;
|
263 |
+
}
|
264 |
|
265 |
/**
|
266 |
* Generate a list of directories to scan and populate the queue.
|
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.0.
|
8 |
Author URI: https://wpengine.com
|
9 |
*/
|
10 |
|
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.0.3
|
8 |
Author URI: https://wpengine.com
|
9 |
*/
|
10 |
|