rebase on oct-10-2023
This commit is contained in:
@@ -863,6 +863,10 @@ $_old_files = array(
|
||||
'wp-includes/blocks/comments-query-loop/editor-rtl.css',
|
||||
'wp-includes/blocks/comments-query-loop/editor-rtl.min.css',
|
||||
'wp-includes/blocks/comments-query-loop',
|
||||
// 6.3
|
||||
'wp-includes/images/wlw',
|
||||
'wp-includes/wlwmanifest.xml',
|
||||
'wp-includes/random_compat',
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1134,9 +1138,14 @@ function update_core( $from, $to ) {
|
||||
require WP_CONTENT_DIR . '/upgrade/version-current.php';
|
||||
$wp_filesystem->delete( $versions_file );
|
||||
|
||||
$php_version = PHP_VERSION;
|
||||
$mysql_version = $wpdb->db_version();
|
||||
$old_wp_version = $GLOBALS['wp_version']; // The version of WordPress we're updating from.
|
||||
$php_version = PHP_VERSION;
|
||||
$mysql_version = $wpdb->db_version();
|
||||
$old_wp_version = $GLOBALS['wp_version']; // The version of WordPress we're updating from.
|
||||
/*
|
||||
* Note: str_contains() is not used here, as this file is included
|
||||
* when updating from older WordPress versions, in which case
|
||||
* the polyfills from wp-includes/compat.php may not be available.
|
||||
*/
|
||||
$development_build = ( false !== strpos( $old_wp_version . $wp_version, '-' ) ); // A dash in the version indicates a development release.
|
||||
$php_compat = version_compare( $php_version, $required_php_version, '>=' );
|
||||
|
||||
@@ -1221,8 +1230,10 @@ function update_core( $from, $to ) {
|
||||
/** This filter is documented in wp-admin/includes/update-core.php */
|
||||
apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) );
|
||||
|
||||
// Don't copy wp-content, we'll deal with that below.
|
||||
// We also copy version.php last so failed updates report their old version.
|
||||
/*
|
||||
* Don't copy wp-content, we'll deal with that below.
|
||||
* We also copy version.php last so failed updates report their old version.
|
||||
*/
|
||||
$skip = array( 'wp-content', 'wp-includes/version.php' );
|
||||
$check_is_writable = array();
|
||||
|
||||
@@ -1239,6 +1250,11 @@ function update_core( $from, $to ) {
|
||||
|
||||
if ( is_array( $checksums ) ) {
|
||||
foreach ( $checksums as $file => $checksum ) {
|
||||
/*
|
||||
* Note: str_starts_with() is not used here, as this file is included
|
||||
* when updating from older WordPress versions, in which case
|
||||
* the polyfills from wp-includes/compat.php may not be available.
|
||||
*/
|
||||
if ( 'wp-content' === substr( $file, 0, 10 ) ) {
|
||||
continue;
|
||||
}
|
||||
@@ -1346,6 +1362,11 @@ function update_core( $from, $to ) {
|
||||
|
||||
if ( isset( $checksums ) && is_array( $checksums ) ) {
|
||||
foreach ( $checksums as $file => $checksum ) {
|
||||
/*
|
||||
* Note: str_starts_with() is not used here, as this file is included
|
||||
* when updating from older WordPress versions, in which case
|
||||
* the polyfills from wp-includes/compat.php may not be available.
|
||||
*/
|
||||
if ( 'wp-content' === substr( $file, 0, 10 ) ) {
|
||||
continue;
|
||||
}
|
||||
@@ -1379,8 +1400,10 @@ function update_core( $from, $to ) {
|
||||
}
|
||||
}
|
||||
|
||||
// If we don't have enough free space, it isn't worth trying again.
|
||||
// Unlikely to be hit due to the check in unzip_file().
|
||||
/*
|
||||
* If we don't have enough free space, it isn't worth trying again.
|
||||
* Unlikely to be hit due to the check in unzip_file().
|
||||
*/
|
||||
$available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( ABSPATH ) : false;
|
||||
|
||||
if ( $available_space && $total_size >= $available_space ) {
|
||||
@@ -1398,15 +1421,21 @@ function update_core( $from, $to ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Custom content directory needs updating now.
|
||||
// Copy languages.
|
||||
/*
|
||||
* Custom content directory needs updating now.
|
||||
* Copy languages.
|
||||
*/
|
||||
if ( ! is_wp_error( $result ) && $wp_filesystem->is_dir( $from . $distro . 'wp-content/languages' ) ) {
|
||||
if ( WP_LANG_DIR !== ABSPATH . WPINC . '/languages' || @is_dir( WP_LANG_DIR ) ) {
|
||||
$lang_dir = WP_LANG_DIR;
|
||||
} else {
|
||||
$lang_dir = WP_CONTENT_DIR . '/languages';
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: str_starts_with() is not used here, as this file is included
|
||||
* when updating from older WordPress versions, in which case
|
||||
* the polyfills from wp-includes/compat.php may not be available.
|
||||
*/
|
||||
// Check if the language directory exists first.
|
||||
if ( ! @is_dir( $lang_dir ) && 0 === strpos( $lang_dir, ABSPATH ) ) {
|
||||
// If it's within the ABSPATH we can handle it here, otherwise they're out of luck.
|
||||
@@ -1437,8 +1466,10 @@ function update_core( $from, $to ) {
|
||||
// Remove maintenance file, we're done with potential site-breaking changes.
|
||||
$wp_filesystem->delete( $maintenance_file );
|
||||
|
||||
// 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users,
|
||||
// preventing installation of Twenty Twelve.
|
||||
/*
|
||||
* 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users,
|
||||
* preventing installation of Twenty Twelve.
|
||||
*/
|
||||
if ( '3.5' === $old_wp_version ) {
|
||||
if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' )
|
||||
&& ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' )
|
||||
@@ -1493,7 +1524,10 @@ function update_core( $from, $to ) {
|
||||
$wp_filesystem->mkdir( $dest . $filename, FS_CHMOD_DIR );
|
||||
$_result = copy_dir( $from . $distro . 'wp-content/' . $file, $dest . $filename );
|
||||
|
||||
// If a error occurs partway through this final step, keep the error flowing through, but keep process going.
|
||||
/*
|
||||
* If an error occurs partway through this final step,
|
||||
* keep the error flowing through, but keep the process going.
|
||||
*/
|
||||
if ( is_wp_error( $_result ) ) {
|
||||
if ( ! is_wp_error( $result ) ) {
|
||||
$result = new WP_Error();
|
||||
@@ -1758,6 +1792,11 @@ function _upgrade_422_find_genericons_files_in_folder( $directory ) {
|
||||
$files = array();
|
||||
|
||||
if ( file_exists( "{$directory}example.html" )
|
||||
/*
|
||||
* Note: str_contains() is not used here, as this file is included
|
||||
* when updating from older WordPress versions, in which case
|
||||
* the polyfills from wp-includes/compat.php may not be available.
|
||||
*/
|
||||
&& false !== strpos( file_get_contents( "{$directory}example.html" ), '<title>Genericons</title>' )
|
||||
) {
|
||||
$files[] = "{$directory}example.html";
|
||||
@@ -1767,7 +1806,13 @@ function _upgrade_422_find_genericons_files_in_folder( $directory ) {
|
||||
$dirs = array_filter(
|
||||
$dirs,
|
||||
static function( $dir ) {
|
||||
// Skip any node_modules directories.
|
||||
/*
|
||||
* Skip any node_modules directories.
|
||||
*
|
||||
* Note: str_contains() is not used here, as this file is included
|
||||
* when updating from older WordPress versions, in which case
|
||||
* the polyfills from wp-includes/compat.php may not be available.
|
||||
*/
|
||||
return false === strpos( $dir, 'node_modules' );
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user