diff --git src/wp-admin/includes/file.php src/wp-admin/includes/file.php
index cca39895ba..5b4146eebb 100644
|
|
|
function copy_dir( $from, $to, $skip_list = array() ) { |
| 1728 | 1728 | $from = trailingslashit( $from ); |
| 1729 | 1729 | $to = trailingslashit( $to ); |
| 1730 | 1730 | |
| | 1731 | /** |
| | 1732 | * Filters whether to invalidate files in the PHP opcache |
| | 1733 | * after it is written during an upgrade. |
| | 1734 | * |
| | 1735 | * @since 5.5.0 |
| | 1736 | * |
| | 1737 | * @param bool $invalidate Whether to invalidate. Default true. |
| | 1738 | */ |
| | 1739 | $opcache_invalidate_allowed = function_exists( 'opcache_invalidate' ) && apply_filters( 'wp_opcache_invalidate_allowed', true ); |
| | 1740 | |
| 1731 | 1741 | foreach ( (array) $dirlist as $filename => $fileinfo ) { |
| 1732 | 1742 | if ( in_array( $filename, $skip_list, true ) ) { |
| 1733 | 1743 | continue; |
| 1734 | 1744 | } |
| 1735 | 1745 | |
| | 1746 | if ( $opcache_invalidate_allowed && in_array( pathinfo( $filename, PATHINFO_EXTENSION ), array( 'php', 'phtml' ), true ) ) { |
| | 1747 | opcache_invalidate( $to . $filename ); |
| | 1748 | } |
| | 1749 | |
| 1736 | 1750 | if ( 'f' === $fileinfo['type'] ) { |
| 1737 | 1751 | if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) { |
| 1738 | 1752 | // If copy failed, chmod file to 0644 and try again. |
diff --git src/wp-admin/includes/update-core.php src/wp-admin/includes/update-core.php
index 595ebc053a..1abfd9bb2e 100644
|
|
|
function _copy_dir( $from, $to, $skip_list = array() ) { |
| 1339 | 1339 | $from = trailingslashit( $from ); |
| 1340 | 1340 | $to = trailingslashit( $to ); |
| 1341 | 1341 | |
| | 1342 | /** This filter is documented in wp-admin/includes/file.php */ |
| | 1343 | $opcache_invalidate_allowed = function_exists( 'opcache_invalidate' ) && apply_filters( 'wp_opcache_invalidate_allowed', true ); |
| | 1344 | |
| 1342 | 1345 | foreach ( (array) $dirlist as $filename => $fileinfo ) { |
| 1343 | 1346 | if ( in_array( $filename, $skip_list, true ) ) { |
| 1344 | 1347 | continue; |
| 1345 | 1348 | } |
| 1346 | 1349 | |
| | 1350 | if ( $opcache_invalidate_allowed && in_array( pathinfo( $filename, PATHINFO_EXTENSION ), array( 'php', 'phtml' ), true ) ) { |
| | 1351 | opcache_invalidate( $to . $filename ); |
| | 1352 | } |
| | 1353 | |
| 1347 | 1354 | if ( 'f' === $fileinfo['type'] ) { |
| 1348 | 1355 | if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) { |
| 1349 | 1356 | // If copy failed, chmod file to 0644 and try again. |