Make WordPress Core

Changeset 55296


Ignore:
Timestamp:
02/08/2023 03:01:32 PM (16 months ago)
Author:
hellofromTonya
Message:

Upgrade/Install: Skip preloading Requests for WordPress versions before 4.6.

Skip preloading Requests files in _preload_old_requests_classes_and_interfaces() when updating from a WordPress version older than 4.6.

Why?

Requests library was first introduced into WordPress 4.6 via #33055 / [37428]. If a user is upgrading from a version older than 4.6, this changeset prevents the Requests preloading to prevent a fatal error of attempting to load files that do not exist in their current WordPress version.

Follow-up to [54997], [37428].

Props afragen, costdev, ironprogrammer, antonvlasenko.
Fixes #57662.

File:
1 edited

Legend:

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

    r55258 r55296  
    15961596 * @global array              $_old_requests_files Requests files to be preloaded.
    15971597 * @global WP_Filesystem_Base $wp_filesystem       WordPress filesystem subclass.
     1598 * @global string             $wp_version          The WordPress version string.
    15981599 *
    15991600 * @param string $to Path to old WordPress installation.
    16001601 */
    16011602function _preload_old_requests_classes_and_interfaces( $to ) {
    1602     global $_old_requests_files, $wp_filesystem;
     1603    global $_old_requests_files, $wp_filesystem, $wp_version;
     1604
     1605    /*
     1606     * Requests was introduced in WordPress 4.6.
     1607     *
     1608     * Skip preloading if the website was previously using
     1609     * an earlier version of WordPress.
     1610     */
     1611    if ( version_compare( $wp_version, '4.6', '<' ) ) {
     1612        return;
     1613    }
    16031614
    16041615    if ( ! defined( 'REQUESTS_SILENCE_PSR0_DEPRECATIONS' ) ) {
Note: See TracChangeset for help on using the changeset viewer.