Skip to content

Commit 3d59107

Browse files
committed
General: Do not use the new wp_get_wp_version() in update-core.php and class-core-upgrader.php.
All functions that are used there must be present in both the previous version being upgraded from, and the later version that's being installed (e.g. when rolling back Core) as these files are used in both. Props djennez, SergeyBiryukov, jorbin, peterwilsoncc, azaozz. Fixes #62165. See 61627. git-svn-id: https://develop.svn.wordpress.org/trunk@59180 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 6c285f0 commit 3d59107

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/wp-admin/includes/class-core-upgrader.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
* It allows for WordPress to upgrade itself in combination with
1414
* the wp-admin/includes/update-core.php file.
1515
*
16+
* Note: newly introduced functions and methods cannot be used here.
17+
* All functions must be present in both the previous version being upgraded from,
18+
* and the later version that's being installed (e.g. when rolling back Core)
19+
* as this file is used in both.
20+
*
1621
* @since 2.8.0
1722
* @since 4.6.0 Moved to its own file from wp-admin/includes/class-wp-upgrader.php.
1823
*
@@ -391,13 +396,13 @@ public static function should_update_to_version( $offered_ver ) {
391396
*
392397
* @since 3.7.0
393398
*
399+
* @global string $wp_version The WordPress version string.
394400
* @global string $wp_local_package Locale code of the package.
395401
*
396402
* @return bool True if the checksums match, otherwise false.
397403
*/
398404
public function check_files() {
399-
global $wp_local_package;
400-
$wp_version = wp_get_wp_version();
405+
global $wp_version, $wp_local_package;
401406

402407
$checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
403408

src/wp-admin/includes/update-core.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
/**
33
* WordPress core upgrade functionality.
44
*
5+
* Note: newly introduced functions and methods cannot be used here.
6+
* All functions must be present in both the previous version being upgraded from,
7+
* and the later version that's being installed (e.g. when rolling back Core)
8+
* as this file is used in both.
9+
*
510
* @package WordPress
611
* @subpackage Administration
712
* @since 2.7.0
@@ -1539,12 +1544,12 @@ function update_core( $from, $to ) {
15391544
*
15401545
* @global array $_old_requests_files Requests files to be preloaded.
15411546
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
1547+
* @global string $wp_version The WordPress version string.
15421548
*
15431549
* @param string $to Path to old WordPress installation.
15441550
*/
15451551
function _preload_old_requests_classes_and_interfaces( $to ) {
1546-
global $_old_requests_files, $wp_filesystem;
1547-
$wp_version = wp_get_wp_version();
1552+
global $_old_requests_files, $wp_filesystem, $wp_version;
15481553

15491554
/*
15501555
* Requests was introduced in WordPress 4.6.
@@ -1587,14 +1592,14 @@ function _preload_old_requests_classes_and_interfaces( $to ) {
15871592
*
15881593
* @since 3.3.0
15891594
*
1590-
* @global string $pagenow The filename of the current screen.
1595+
* @global string $wp_version The WordPress version string.
1596+
* @global string $pagenow The filename of the current screen.
15911597
* @global string $action
15921598
*
15931599
* @param string $new_version
15941600
*/
15951601
function _redirect_to_about_wordpress( $new_version ) {
1596-
global $pagenow, $action;
1597-
$wp_version = wp_get_wp_version();
1602+
global $wp_version, $pagenow, $action;
15981603

15991604
if ( version_compare( $wp_version, '3.4-RC1', '>=' ) ) {
16001605
return;

0 commit comments

Comments
 (0)