WordPress.org

Make WordPress Core

Changeset 50475


Ignore:
Timestamp:
03/02/2021 05:11:35 PM (6 weeks ago)
Author:
mikeschroder
Message:

Upgrade/Install: Invalidate OPcache for version.php during update.

Invalidate OPcache for wp-content/version.php on update individually, since it’s copied separately.

Props stodorovic, krstarica, cenay, desrosj, pbiron, sergeybiryukov, mikeschroder.
Fixes #51686, #51281.
See #36455.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/update-core.php

    r50460 r50475  
    947947
    948948    $wp_filesystem->chmod( $versions_file, FS_CHMOD_FILE );
     949
     950    /*
     951     * `wp_opcache_invalidate()` only exists in WordPress 5.5 or later,
     952     * so don't run it when upgrading from older versions.
     953     */
     954    if ( function_exists( 'wp_opcache_invalidate' ) ) {
     955        wp_opcache_invalidate( $versions_file );
     956    }
     957
    949958    require WP_CONTENT_DIR . '/upgrade/version-current.php';
    950959    $wp_filesystem->delete( $versions_file );
     
    11181127        }
    11191128        $wp_filesystem->chmod( $to . 'wp-includes/version.php', FS_CHMOD_FILE );
     1129
     1130        /*
     1131         * `wp_opcache_invalidate()` only exists in WordPress 5.5 or later,
     1132         * so don't run it when upgrading from older versions.
     1133         */
     1134        if ( function_exists( 'wp_opcache_invalidate' ) ) {
     1135            wp_opcache_invalidate( $to . 'wp-includes/version.php' );
     1136        }
    11201137    }
    11211138
Note: See TracChangeset for help on using the changeset viewer.