Version Description
- Added additional role protections
- Changed the UI colors to better understand output at a glance
- Exclude checking node_modules and tmp directories
- Added support for child theme's parent theme
Download this release
Release Info
Developer | wpengine |
Plugin | PHP Compatibility Checker |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- readme.txt +32 -13
- src/css/style.css +1 -1
- src/wpephpcompat.php +11 -2
- wpengine-phpcompat.php +43 -40
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 |
|
@@ -13,15 +13,17 @@ Make sure your plugins and themes are compatible with newer PHP versions.
|
|
13 |
|
14 |
The WP Engine PHP Compatibility Checker can be used by any WordPress website on any web host to check PHP version compatibility.
|
15 |
|
16 |
-
This plugin will lint theme and plugin code inside your WordPress file system and give you back a report of compatibility issues for you to fix. Compatibility issues are categorized into errors and warnings and will list the file and line number of the offending code, as well as the info about why that line of code is incompatible with the chosen version of PHP. The plugin will also suggest updates to themes and plugins, as a new version may offer compatible code.
|
17 |
|
18 |
**This plugin does not execute your theme and plugin code, as such this plugin cannot detect runtime compatibility issues.**
|
19 |
|
|
|
|
|
20 |
= Update to PHP 7 =
|
21 |
* Use this plugin to check your site for compatibility for PHP 7!
|
22 |
-
* As of
|
23 |
* These versions of PHP have been deprecated and unsupported for over 9 months.
|
24 |
-
* Only 1.
|
25 |
|
26 |
|
27 |
= Disclaimer =
|
@@ -29,14 +31,19 @@ This plugin will lint theme and plugin code inside your WordPress file system an
|
|
29 |
|
30 |
The plugin was created by WP Engine to help the WordPress community increase adoption of modern PHP versions. We [welcome contributors](https://github.com/wpengine/phpcompat) to this plugin, and are excited to see how developers and other WordPress hosts use this plugin.
|
31 |
|
|
|
|
|
32 |
== Installation ==
|
33 |
|
34 |
-
*Note: If you have WordPress 2.7 or above you can simply go to 'Plugins' > 'Add New' in the WordPress admin and search for "
|
35 |
|
|
|
36 |
1. Upload `phpcompat` to the `/wpengine-wp-content/plugins/` directory
|
37 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
38 |
|
39 |
-
You will find the plugin options in the WP Admin
|
|
|
|
|
40 |
|
41 |
== Other Notes ==
|
42 |
|
@@ -60,24 +67,28 @@ Example: `wp phpcompat 5.5 --scan=active`
|
|
60 |
|
61 |
== Frequently Asked Questions ==
|
62 |
|
63 |
-
1
|
64 |
|
65 |
Yes, this plugin can be used any ANY WordPress website on ANY host.
|
66 |
|
|
|
|
|
67 |
|
68 |
-
|
69 |
|
70 |
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.
|
71 |
|
72 |
-
|
73 |
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.
|
74 |
|
75 |
-
|
76 |
|
77 |
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.
|
78 |
|
79 |
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.
|
80 |
|
|
|
|
|
81 |
== Screenshots ==
|
82 |
|
83 |
1. Main screen: compatibility checker options
|
@@ -85,6 +96,12 @@ The plugin was created by WP Engine to help the WordPress community increase ado
|
|
85 |
|
86 |
== Changelog ==
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
= 1.0.1 =
|
89 |
- Updated compatibility library with a few bugfixes
|
90 |
- Added skip logic to prevent checker from hanging
|
@@ -101,6 +118,8 @@ The plugin was created by WP Engine to help the WordPress community increase ado
|
|
101 |
|
102 |
== Upgrade Notice ==
|
103 |
|
104 |
-
= 1.0.
|
105 |
-
-
|
106 |
-
-
|
|
|
|
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.2
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
13 |
|
14 |
The WP Engine PHP Compatibility Checker can be used by any WordPress website on any web host to check PHP version compatibility.
|
15 |
|
16 |
+
This plugin will lint theme and plugin code inside your WordPress file system and give you back a report of compatibility issues for you to fix. Compatibility issues are categorized into errors and warnings and will list the file and line number of the offending code, as well as the info about why that line of code is incompatible with the chosen version of PHP. The plugin will also suggest updates to themes and plugins, as a new version may offer compatible code.
|
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 are aware of a few infrequent 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!
|
24 |
+
* As of July 2016, 59.3% of WordPress websites run a PHP version less PHP 5.5.
|
25 |
* These versions of PHP have been deprecated and unsupported for over 9 months.
|
26 |
+
* Only 1.8% of WordPress websites run PHP 7, the current main version of PHP.
|
27 |
|
28 |
|
29 |
= Disclaimer =
|
31 |
|
32 |
The plugin was created by WP Engine to help the WordPress community increase adoption of modern PHP versions. We [welcome contributors](https://github.com/wpengine/phpcompat) to this plugin, and are excited to see how developers and other WordPress hosts use this plugin.
|
33 |
|
34 |
+
To disclose security issues for this plugin please email WordPress@wpengine.com
|
35 |
+
|
36 |
== Installation ==
|
37 |
|
38 |
+
*Note: If you have WordPress 2.7 or above you can simply go to 'Plugins' > 'Add New' in the WordPress admin and search for "PHP Compatibility Checker" and install it from there.*
|
39 |
|
40 |
+
To manually install:
|
41 |
1. Upload `phpcompat` to the `/wpengine-wp-content/plugins/` directory
|
42 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
43 |
|
44 |
+
You will find the plugin options in the WP Admin `Tools => PHP Compatibility` menu. Once you click `run` it will take a few minutes to conduct the test. While the test is running, you cannot navigate away from the page.
|
45 |
+
|
46 |
+
There are WP-CLI commands available see the [Other Notes](https://wordpress.org/plugins/php-compatibility-checker/other_notes/) tab for details.
|
47 |
|
48 |
== Other Notes ==
|
49 |
|
67 |
|
68 |
== Frequently Asked Questions ==
|
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 |
+
3. Can I use this to test non-WordPress PHP Projects?
|
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 |
+
4. Why was my plugin/theme skipped?
|
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 |
+
5. I found a bug, or have a suggestion, can I contribute back?
|
85 |
|
86 |
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.
|
87 |
|
88 |
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.
|
89 |
|
90 |
+
To disclose security issues for this plugin please email WordPress@wpengine.com
|
91 |
+
|
92 |
== Screenshots ==
|
93 |
|
94 |
1. Main screen: compatibility checker options
|
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
|
102 |
+
- Exclude checking node_modules and tmp directories
|
103 |
+
- Added support for child theme's parent theme
|
104 |
+
|
105 |
= 1.0.1 =
|
106 |
- Updated compatibility library with a few bugfixes
|
107 |
- Added skip logic to prevent checker from hanging
|
118 |
|
119 |
== Upgrade Notice ==
|
120 |
|
121 |
+
= 1.0.2 =
|
122 |
+
- Added additional role protections
|
123 |
+
- Changed the UI colors to better understand output at a glance
|
124 |
+
- Exclude checking node_modules and tmp directories
|
125 |
+
- Added support for child theme's parent theme
|
src/css/style.css
CHANGED
@@ -68,7 +68,7 @@
|
|
68 |
|
69 |
.wpe-results-card .wpe-update
|
70 |
{
|
71 |
-
background-color: #
|
72 |
}
|
73 |
|
74 |
.wpe-results-card .warnings
|
68 |
|
69 |
.wpe-results-card .wpe-update
|
70 |
{
|
71 |
+
background-color: #0085ba;
|
72 |
}
|
73 |
|
74 |
.wpe-results-card .warnings
|
src/wpephpcompat.php
CHANGED
@@ -209,7 +209,7 @@ class WPEPHPCompat {
|
|
209 |
$this->values['standard'] = 'PHPCompatibility';
|
210 |
$this->values['reportWidth'] = '9999';
|
211 |
$this->values['extensions'] = array( 'php' );
|
212 |
-
$this->values['ignored'] = array( '*/tests/*', '*/jetpack/modules/*' );
|
213 |
|
214 |
PHP_CodeSniffer::setConfigData( 'testVersion', $this->test_version, true );
|
215 |
|
@@ -297,6 +297,15 @@ class WPEPHPCompat {
|
|
297 |
|
298 |
$this->add_directory( $all_themes[$k]->Name, $theme_path );
|
299 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
}
|
301 |
|
302 |
/**
|
@@ -401,7 +410,7 @@ class WPEPHPCompat {
|
|
401 |
*/
|
402 |
private function close_connection( $body ) {
|
403 |
ignore_user_abort( true );
|
404 |
-
ob_end_clean();
|
405 |
// Start buffering.
|
406 |
ob_start();
|
407 |
// Echo our response.
|
209 |
$this->values['standard'] = 'PHPCompatibility';
|
210 |
$this->values['reportWidth'] = '9999';
|
211 |
$this->values['extensions'] = array( 'php' );
|
212 |
+
$this->values['ignored'] = array( '*/tests/*', '*/jetpack/modules/*', '*/node_modules/*', '*/tmp/*' );
|
213 |
|
214 |
PHP_CodeSniffer::setConfigData( 'testVersion', $this->test_version, true );
|
215 |
|
297 |
|
298 |
$this->add_directory( $all_themes[$k]->Name, $theme_path );
|
299 |
}
|
300 |
+
|
301 |
+
// Add parent theme if the current theme is a child theme.
|
302 |
+
if ( 'yes' === $this->only_active && is_child_theme() ) {
|
303 |
+
$parent_theme_path = get_template_directory();
|
304 |
+
$theme_data = wp_get_theme();
|
305 |
+
$parent_theme_name = $theme_data->parent()->Name;
|
306 |
+
|
307 |
+
$this->add_directory( $parent_theme_name, $parent_theme_path );
|
308 |
+
}
|
309 |
}
|
310 |
|
311 |
/**
|
410 |
*/
|
411 |
private function close_connection( $body ) {
|
412 |
ignore_user_abort( true );
|
413 |
+
if (ob_get_length()) ob_end_clean();
|
414 |
// Start buffering.
|
415 |
ob_start();
|
416 |
// Echo our response.
|
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 |
|
@@ -73,21 +73,23 @@ class WPEngine_PHPCompat {
|
|
73 |
* @return null
|
74 |
*/
|
75 |
function start_test() {
|
76 |
-
|
|
|
77 |
|
78 |
-
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
|
89 |
-
|
90 |
-
|
|
|
91 |
}
|
92 |
|
93 |
/**
|
@@ -99,33 +101,34 @@ class WPEngine_PHPCompat {
|
|
99 |
* @return null
|
100 |
*/
|
101 |
function check_status() {
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
$
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
-
|
126 |
-
echo json_encode( $to_encode );
|
127 |
-
wp_die();
|
128 |
-
|
129 |
}
|
130 |
|
131 |
/**
|
@@ -184,7 +187,7 @@ class WPEngine_PHPCompat {
|
|
184 |
*/
|
185 |
function create_menu() {
|
186 |
// Create Tools sub-menu.
|
187 |
-
$this->page = add_submenu_page( 'tools.php', 'PHP Compatibility', 'PHP Compatibility', '
|
188 |
}
|
189 |
|
190 |
/**
|
@@ -264,7 +267,7 @@ class WPEngine_PHPCompat {
|
|
264 |
<textarea style="display: none; white-space: pre;">{{logs}}</textarea><a class="view-details">view details</a>
|
265 |
</div>
|
266 |
<?php $update_url = site_url( 'wp-admin/update-core.php' , 'admin' ); ?>
|
267 |
-
<div style="float:right;">{{#if updateAvailable}}<div class="badge wpe-update"><a href="<?php echo esc_url( $update_url ); ?>">Update Available</a></div>{{/if}}<div class="badge warnings">{{warnings}} Warnings</div
|
268 |
</div>
|
269 |
</script>
|
270 |
<?php
|
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.2
|
8 |
Author URI: https://wpengine.com
|
9 |
*/
|
10 |
|
73 |
* @return null
|
74 |
*/
|
75 |
function start_test() {
|
76 |
+
if ( current_user_can( 'manage_options' ) || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
|
77 |
+
global $wpdb;
|
78 |
|
79 |
+
$wpephpc = new \WPEPHPCompat( __DIR__ );
|
80 |
|
81 |
+
if ( isset( $_POST['startScan'] ) ) {
|
82 |
+
$test_version = sanitize_text_field( $_POST['test_version'] );
|
83 |
+
$only_active = sanitize_text_field( $_POST['only_active'] );
|
84 |
|
85 |
+
$wpephpc->test_version = $test_version;
|
86 |
+
$wpephpc->only_active = $only_active;
|
87 |
+
$wpephpc->clean_after_scan();
|
88 |
+
}
|
89 |
|
90 |
+
$wpephpc->start_test();
|
91 |
+
wp_die();
|
92 |
+
}
|
93 |
}
|
94 |
|
95 |
/**
|
101 |
* @return null
|
102 |
*/
|
103 |
function check_status() {
|
104 |
+
if ( current_user_can( 'manage_options' ) || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) {
|
105 |
+
$scan_status = get_option( 'wpephpcompat.status' );
|
106 |
+
$count_jobs = wp_count_posts( 'wpephpcompat_jobs' );
|
107 |
+
$total_jobs = get_option( 'wpephpcompat.numdirs' );
|
108 |
+
|
109 |
+
$to_encode = array(
|
110 |
+
'status' => $scan_status,
|
111 |
+
'count' => $count_jobs->publish,
|
112 |
+
'total' => $total_jobs,
|
113 |
+
'progress' => 100 - ( ( $count_jobs->publish / $total_jobs ) * 100 )
|
114 |
+
);
|
115 |
+
|
116 |
+
// If the scan is still running.
|
117 |
+
if ( $scan_status ) {
|
118 |
+
$to_encode['results'] = '0';
|
119 |
+
} else {
|
120 |
+
// Else return the results and clean up!
|
121 |
+
$scan_results = get_option( 'wpephpcompat.scan_results' );
|
122 |
+
// Not using esc_html since the results are shown in a textarea.
|
123 |
+
$to_encode['results'] = $scan_results;
|
124 |
+
|
125 |
+
$wpephpc = new \WPEPHPCompat( __DIR__ );
|
126 |
+
$wpephpc->clean_after_scan();
|
127 |
+
}
|
128 |
+
|
129 |
+
echo json_encode( $to_encode );
|
130 |
+
wp_die();
|
131 |
}
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
|
134 |
/**
|
187 |
*/
|
188 |
function create_menu() {
|
189 |
// Create Tools sub-menu.
|
190 |
+
$this->page = add_submenu_page( 'tools.php', 'PHP Compatibility', 'PHP Compatibility', 'manage_options', __FILE__, array( self::instance(), 'settings_page' ) );
|
191 |
}
|
192 |
|
193 |
/**
|
267 |
<textarea style="display: none; white-space: pre;">{{logs}}</textarea><a class="view-details">view details</a>
|
268 |
</div>
|
269 |
<?php $update_url = site_url( 'wp-admin/update-core.php' , 'admin' ); ?>
|
270 |
+
<div style="float:right;">{{#if updateAvailable}}<div class="badge wpe-update"><a href="<?php echo esc_url( $update_url ); ?>">Update Available</a></div>{{/if}}{{#if warnings}}<div class="badge warnings">{{warnings}} Warnings</div>{{/if}}{{#if errors}}<div class="badge errors">{{errors}} Errors</div>{{/if}}</div>
|
271 |
</div>
|
272 |
</script>
|
273 |
<?php
|