该插件尚未通过WordPress的最新3个主要版本进行测试。 当与较新版本的WordPress一起使用时,可能不再受到维护或支持,并且可能会存在兼容性问题。

PHP 兼容性检查工具

描述

WP Engine 的 PHP 兼容性检查工具可用于在任何虚拟主机的任何 WordPress 站点上检查 PHP 版本的兼容性。

该插件将对 WordPress 文件系统中的主题和插件代码进行检测,并给出兼容性问题的报告供您修复(兼容性问题被分为错误和警告)且同时列出违规代码的文件和行号,以及该行代码与所选 PHP 版本不兼容的原因。该插件也会建议更新主题和插件,因为新版本可能会提供兼容的代码。

该插件不执行您的主题和插件代码,因此也无法检测运行时的兼容性问题。

请注意,对代码的检查并不完美。该插件无法检测可能用于向后兼容的未使用的代码路径,因此可能会出现误报。我们维护了一个可能导致误报的插件的白名单。我们正在不断努力以确保检查工具尽可能提供最准确的结果。

此插件依靠 WP-Cron 在后台扫描文件。如果站点的 WP-Cron 不能正常运行,扫描将被卡住。请参阅常见问题以了解更多信息。

更新至 php 7.3

  • 使用此插件来检查您的站点是否兼容至 PHP 7.3!
  • 截至2019年7月,20.1%的 WordPress 网站运行的PHP版本早于 PHP 5.6。
  • 这些版本的 PHP 已被淘汰和放弃支持超过2年。
  • 只有 54.1%的 WordPress 网站运行 PHP 7,即当前主要版本的 PHP。

免责声明

虽然该插件的编写是为了尽可能准确地检测出更多问题,但检测无法保证 100% 可靠。在迁移到新的PHP版本之前的最佳做法是进行全面测试。

该插件由 WP Engine 创建,只在帮助 WordPress 社区增加对现代PHP版本的采用率。我们欢迎您对该插件做出贡献。我们也很高兴能看到其他开发者和 WordPress 主机商使用该插件。

要披露此插件的安全问题,请发电子邮件至 [email protected]
PHP兼容性检查工具包括 WP-CLI 命令支持。

wp phpcompat <version> [--scan=<scan>]


<version>
    PHP version to test.

[--scan=<scan>]
  Whether to scan only active plugins and themes or all of them.
  default: active
  options:
    - active
    - all

例子:wp phpcompat 7.2 --scan=active

屏幕截图

  • 主界面:兼容性检查选项
  • 兼容性结果界面

安装

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.

手动安装。
1. 上传phpcompat/wpengin-wp-content/plugins/目录中。
2. 通过 WordPress 的“插件”菜单启用该插件。

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. Feel free to navigate away from the page and check back later.

可用 WP-CLI 命令,详情请见其他说明部分。

常见问题

  1. Will this work outside of the WP Engine hosting account?

    Yes, this plugin can be used any ANY WordPress website on ANY host.

  2. 是否有 WP-CLI 命令可用?

    是,该插件扩展了 WP-CLI 并提供了命令。请参阅其他说明部分以了解详细信息。

  3. 我创建的一个插件被列为不兼容,应该怎么办?

    We maintain a whitelist of plugins that cause false positives. If your plugin shows up as incompatible but you think that is wrong, please open a GitHub issue on the project, or email [email protected] with info about your plugin and why you know it is compatible (you have automated tests, the failure is on backwards compatibility code paths, etc).

  4. Can I use this to test non-WordPress PHP Projects?

    Yes! While you cannot use this WordPress plugin to test your non-WordPress projects, you can use the Open Source PHPCompatibility Library that this plugin is built on.

  5. 为什么我的插件/主题被跳过?

    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 issue is to run this plugin on a local copy of your site, or you can use the WP-CLI command.

    您可以使用过滤器 wpephpcompat_scan_timeout 来自定义扫描超时。请参阅这里的例子。

    将超时设置为 0,可以禁用 cron/超时。

  6. 扫描被卡住了,我该怎么办?

    PHP 兼容性检查工具依靠 WP-Cron来 批量处理插件/主题,这对于避免服务器超时是必须的。如果您站点的 WP-Cron 没有正常运行,扫描就会被卡住。您可以使用WP Crontrol 进行排查。cron 的名称是 wpephpcompat_start_test_cron。如果您的站点使用的是基本身份验证,这也可能是导致此问题的原因。

    您也可以使用 WP-CLI 命令或禁用超时来避免使用 WP-Cron。

  7. 我发现了 Bug 或想反馈意见,我可以做出贡献吗?

    Yes! WP Engine has a public GitHub repo where you can contribute back to this plugin. Please open an issue on the Plugin GitHub. We actively develop this plugin, and are always happy to receive pull requests.

    该插件由 WP Engine 创建,只在帮助 WordPress 社区增加对现代PHP版本的采用率。我们欢迎您对该插件做出贡献。我们也很高兴能看到其他开发者和 WordPress 主机商使用该插件。

要披露该插件的安全问题,请发电子邮件至 [email protected]

评价

2021年8月3日
This plugin hasn't been updated for 2+ years and is obsolete, and therefore seems clear that it has been abandoned. However, I can't uninstall it from the WP plugin dashboard - I click deactivate and then Delete, and it says "Deleting..." but it gets stuck there. I don't like to leave it in the site since it seems it could become vulnerable to being hacked. Can someone please advise how to uninstall this plugin that has essentially died to the point where you can't even uninstall it? Is it as simple as just disabling or deleting the plugin directory via FTP?
2021年7月24日
No updates in 2 years? Never tested with the last 3 versions of WordPress? Old and slow,.. never completes the job. Kinda like me! :o\
2021年7月14日
the plugin analyses the compatibility with PHP 7.3 (which is supported only until end of 2021). It would be great if it would check compatibility with PHP 7.4 or 8.
2021年4月21日
My first 1 star rating. Firstly, the plugin does not work for php 8.0. Secondly it can not be deleted using the normal WordPress interface/process. Had to manually delete it from the server.
2021年2月15日
\wp-content\plugins\php-compatibility-checker\wpengine-phpcompat.php:230 Divide by zero. WP: 5.6.1 PHP: 7.2.10
阅读所有98条评价

贡献者及开发者

“PHP 兼容性检查工具” 是开源软件。 以下人员对此插件做出了贡献。

贡献者

“PHP 兼容性检查工具”插件已被翻译至21种本地话语言。 感谢所有译者为本插件所做的贡献。

将“PHP 兼容性检查工具”翻译成您的语言。

对开发感兴趣吗?

您可以浏览代码,查看SVN仓库,或通过RSS订阅开发日志

更新日志

1.5.0

  • Added support for PHP 7.3 compatibility checks

1.4.8

  • Update dependencies.

1.4.7

  • Better translation support.

1.4.6

  • Switched to new PHPCompatibilityWP library to help prevent false positives.

1.4.5

  • Use plugin version number to enqueue scripts and styles.

1.4.4

  • PHP 5.2 Support & PHP 7.1 and 7.2 Lints.
  • Updated call to action sidebar depending on platform.

1.4.3

  • Fixed Composer issue.

1.4.1

  • Updated PHP_CodeSniffer to fix a security advisory.
  • Whitelisted a number of plugins.

1.4.0

  • Updated UX for viewing PHP errors to be more intuitive and require less scrolling.
  • Added links for non-technical users who need assistance from developers to fix PHP errors or to test their site in PHP 7 enabled hosting environments.

1.3.2

  • Added a “Clean up” button and uninstall.php.
  • Added phpcompat_phpversions filter.

1.3.1

  • Whitelisted a number of plugins.

1.3.0

  • Updated the PHPCompatibility library to latest version. Should fix many false positives.
  • Changed language and added help text to Admin UI.

1.2.4

  • Fixed Composer issue.

1.2.3

  • Updated the PHPCompatibility library to latest version.
  • Whitelisted TablePress.

1.2.2

  • Whitelisted UpdraftPlus and Max Mega Menu.

1.2.1

  • Updated the PHPCompatibility library to latest version

1.2.0

  • Updated the PHPCompatibility library to latest version
  • Added support for PHP 5.6

1.1.2

  • Fixed issue with WordPress notices breaking the plugin header.
  • Changed the way we send and parse JSON.
  • You can now restart an in progress scan.
  • Updated download.js to v4.2 for better Safari compatibility.

1.1.1

  • Fixed bug with active job display.
  • Updated progress bar calculation.

1.1.0

  • Test results now persist page reloads.
  • Failed tests will show an overview of the results.
  • The scan timeout is now configurable using a filter. See the FAQ for more details.

1.0.3

  • Fixed a bug in the WP-CLI command
  • Added a handful of PHP 7 compatible plugins to the whitelist

1.0.2

  • 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

1.0.1

  • Updated compatibility library with a few bugfixes
  • Added skip logic to prevent checker from hanging

1.0.0

  • Major update to add PHP 7 checking support
  • Improved the UX of the progress bar
  • Fixed bug with the way the plugin menu was registered

0.1.0

  • Initial version
  • PHP 5.5, 5.4, and 5.3 Support
  • Basic WP-CLI Commands