WordPress.org

Make WordPress Core

Ticket #36455: 36455.6.diff

File 36455.6.diff, 3.0 KB (added by jnylen0, 5 months ago)
  • src/wp-admin/includes/file.php

    diff --git a/src/wp-admin/includes/file.php b/src/wp-admin/includes/file.php
    index edfdef5756..dc95b9ba84 100644
    a b function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) { 
    17011701 * Copies a directory from one location to another via the WordPress Filesystem
    17021702 * Abstraction.
    17031703 *
    1704  * Assumes that WP_Filesystem() has already been called and setup.
     1704 * Assumes that WP_Filesystem() has already been called and set up.
    17051705 *
    17061706 * @since 2.5.0
    17071707 *
    function copy_dir( $from, $to, $skip_list = array() ) { 
    17331733                                        return new WP_Error( 'copy_failed_copy_dir', __( 'Could not copy file.' ), $to . $filename );
    17341734                                }
    17351735                        }
     1736                        if (
     1737                                '.php' === strtolower( substr( $filename, -4 ) ) &&
     1738                                function_exists( 'opcache_invalidate' ) &&
     1739                                /**
     1740                                 * Filters whether to invalidate a file in the PHP opcache
     1741                                 * after it is written during an upgrade.
     1742                                 *
     1743                                 * @since 1.3.0
     1744                                 *
     1745                                 * @param bool $invalidate Whether to invalidate. Default true.
     1746                                 * @param string $filename The PHP filename that was just copied.
     1747                                 */
     1748                                apply_filters( 'wp_opcache_invalidate_file', true, $to . $filename )
     1749                        ) {
     1750                                opcache_invalidate( $to . $filename );
     1751                        }
    17361752                } elseif ( 'd' == $fileinfo['type'] ) {
    17371753                        if ( ! $wp_filesystem->is_dir( $to . $filename ) ) {
    17381754                                if ( ! $wp_filesystem->mkdir( $to . $filename, FS_CHMOD_DIR ) ) {
  • src/wp-admin/includes/update-core.php

    diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php
    index 9dbe8bead1..fd69c38447 100644
    a b function update_core( $from, $to ) { 
    13071307}
    13081308
    13091309/**
    1310  * Copies a directory from one location to another via the WordPress Filesystem Abstraction.
    1311  * Assumes that WP_Filesystem() has already been called and setup.
     1310 * Copies a directory from one location to another via the WordPress Filesystem
     1311 * Abstraction.
    13121312 *
    1313  * This is a temporary function for the 3.1 -> 3.2 upgrade, as well as for those upgrading to
    1314  * 3.7+
     1313 * Assumes that WP_Filesystem() has already been called and set up.
     1314 *
     1315 * This is a standalone copy of the `copy_dir()` function that is used to
     1316 * upgrade the core files. It is placed here so that the version of this
     1317 * function from the *new* WordPress version will be called.
    13151318 *
    13161319 * @ignore
    13171320 * @since 3.2.0
    function _copy_dir( $from, $to, $skip_list = array() ) { 
    13461349                                        return new WP_Error( 'copy_failed__copy_dir', __( 'Could not copy file.' ), $to . $filename );
    13471350                                }
    13481351                        }
     1352                        if (
     1353                                '.php' === strtolower( substr( $filename, -4 ) ) &&
     1354                                function_exists( 'opcache_invalidate' ) &&
     1355                                /** This filter is documented in wp-admin/includes/file.php */
     1356                                apply_filters( 'wp_opcache_invalidate_file', true, $to . $filename )
     1357                        ) {
     1358                                opcache_invalidate( $to . $filename );
     1359                        }
    13491360                } elseif ( 'd' == $fileinfo['type'] ) {
    13501361                        if ( ! $wp_filesystem->is_dir( $to . $filename ) ) {
    13511362                                if ( ! $wp_filesystem->mkdir( $to . $filename, FS_CHMOD_DIR ) ) {