Upgrade/Install: Improve wp_opcache_invalidate() performance.

Changes from using `preg_match()` based `.php` extension checking to using `substr()` in `wp_opcache_invalidate()`.

Props jnylen0, aaroncampbell, SergeyBiryukov, desrosj, mikeschroder.
Fixes #50784.

git-svn-id: https://develop.svn.wordpress.org/trunk@48657 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mike Schroder 2020-07-28 08:07:04 +00:00
parent b29101aca0
commit 81c39e949f

View File

@ -2356,7 +2356,7 @@ function wp_opcache_invalidate( $filepath, $force = false ) {
}
// Verify that file to be invalidated has a PHP extension.
if ( ! preg_match( '/\.(?:php)$/i', $filepath ) ) {
if ( '.php' !== strtolower( substr( $filepath, -4 ) ) ) {
return false;
}