rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -21,7 +21,7 @@
class Core_Upgrader extends WP_Upgrader {
/**
* Initialize the upgrade strings.
* Initializes the upgrade strings.
*
* @since 2.8.0
*/
@@ -30,16 +30,16 @@ class Core_Upgrader extends WP_Upgrader {
$this->strings['locked'] = __( 'Another update is currently in progress.' );
$this->strings['no_package'] = __( 'Update package not available.' );
/* translators: %s: Package URL. */
$this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s&#8230;' ), '<span class="code">%s</span>' );
$this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s&#8230;' ), '<span class="code pre">%s</span>' );
$this->strings['unpack_package'] = __( 'Unpacking the update&#8230;' );
$this->strings['copy_failed'] = __( 'Could not copy files.' );
$this->strings['copy_failed_space'] = __( 'Could not copy files. You may have run out of disk space.' );
$this->strings['start_rollback'] = __( 'Attempting to roll back to previous version.' );
$this->strings['rollback_was_required'] = __( 'Due to an error during updating, WordPress has rolled back to your previous version.' );
$this->strings['start_rollback'] = __( 'Attempting to restore the previous version.' );
$this->strings['rollback_was_required'] = __( 'Due to an error during updating, WordPress has been restored to your previous version.' );
}
/**
* Upgrade WordPress core.
* Upgrades WordPress core.
*
* @since 2.8.0
*
@@ -123,8 +123,10 @@ class Core_Upgrader extends WP_Upgrader {
$download = $this->download_package( $current->packages->$to_download, true );
// Allow for signature soft-fail.
// WARNING: This may be removed in the future.
/*
* Allow for signature soft-fail.
* WARNING: This may be removed in the future.
*/
if ( is_wp_error( $download ) && $download->get_error_data( 'softfail-filename' ) ) {
// Output the failure error as a normal feedback, and not as an error:
/** This filter is documented in wp-admin/includes/update-core.php */
@@ -181,9 +183,9 @@ class Core_Upgrader extends WP_Upgrader {
* mkdir_failed__copy_dir, copy_failed__copy_dir_retry, and disk_full.
* do_rollback allows for update_core() to trigger a rollback if needed.
*/
if ( false !== strpos( $error_code, 'do_rollback' ) ) {
if ( str_contains( $error_code, 'do_rollback' ) ) {
$try_rollback = true;
} elseif ( false !== strpos( $error_code, '__copy_dir' ) ) {
} elseif ( str_contains( $error_code, '__copy_dir' ) ) {
$try_rollback = true;
} elseif ( 'disk_full' === $error_code ) {
$try_rollback = true;
@@ -323,7 +325,7 @@ class Core_Upgrader extends WP_Upgrader {
}
// Don't claim we can update on update-core.php if we have a non-critical failure logged.
if ( $wp_version === $failure_data['current'] && false !== strpos( $offered_ver, '.1.next.minor' ) ) {
if ( $wp_version === $failure_data['current'] && str_contains( $offered_ver, '.1.next.minor' ) ) {
return false;
}
@@ -385,7 +387,7 @@ class Core_Upgrader extends WP_Upgrader {
}
/**
* Compare the disk file checksums against the expected checksums.
* Compares the disk file checksums against the expected checksums.
*
* @since 3.7.0
*
@@ -405,7 +407,7 @@ class Core_Upgrader extends WP_Upgrader {
foreach ( $checksums as $file => $checksum ) {
// Skip files which get updated.
if ( 'wp-content' === substr( $file, 0, 10 ) ) {
if ( str_starts_with( $file, 'wp-content' ) ) {
continue;
}
if ( ! file_exists( ABSPATH . $file ) || md5_file( ABSPATH . $file ) !== $checksum ) {