Make WordPress Core

Changeset 61028


Ignore:
Timestamp:
10/21/2025 01:40:13 PM (3 weeks ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use more meaningful variable names in Theme Upgrader.

Per the Naming Conventions:

Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.

This commit includes renaming of the following variables:

  • $r to $upgrade_data.
  • $res to $connected.
  • $info to $new_theme_data.

Follow-up to [8989], [11005], [13686], [18618], [20268], [57252].

Props costdev, mukesh27.
See #63168.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-theme-upgrader.php

    r59159 r61028  
    312312        }
    313313
    314         $r = $current->response[ $theme ];
     314        $upgrade_data = $current->response[ $theme ];
    315315
    316316        add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 );
     
    324324        $this->run(
    325325            array(
    326                 'package'           => $r['package'],
     326                'package'           => $upgrade_data['package'],
    327327                'destination'       => get_theme_root( $theme ),
    328328                'clear_destination' => true,
     
    401401
    402402        // Connect to the filesystem first.
    403         $res = $this->fs_connect( array( WP_CONTENT_DIR ) );
    404         if ( ! $res ) {
     403        $connected = $this->fs_connect( array( WP_CONTENT_DIR ) );
     404        if ( ! $connected ) {
    405405            $this->skin->footer();
    406406            return false;
     
    442442
    443443            // Get the URL to the zip file.
    444             $r = $current->response[ $theme ];
    445 
    446             if ( isset( $r['requires'] ) && ! is_wp_version_compatible( $r['requires'] ) ) {
     444            $upgrade_data = $current->response[ $theme ];
     445
     446            if ( isset( $upgrade_data['requires'] ) && ! is_wp_version_compatible( $upgrade_data['requires'] ) ) {
    447447                $result = new WP_Error(
    448448                    'incompatible_wp_required_version',
     
    451451                        __( 'Your WordPress version is %1$s, however the new theme version requires %2$s.' ),
    452452                        $wp_version,
    453                         $r['requires']
     453                        $upgrade_data['requires']
    454454                    )
    455455                );
     
    458458                $this->skin->error( $result );
    459459                $this->skin->after();
    460             } elseif ( isset( $r['requires_php'] ) && ! is_php_version_compatible( $r['requires_php'] ) ) {
     460            } elseif ( isset( $upgrade_data['requires_php'] ) && ! is_php_version_compatible( $upgrade_data['requires_php'] ) ) {
    461461                $result = new WP_Error(
    462462                    'incompatible_php_required_version',
     
    465465                        __( 'The PHP version on your server is %1$s, however the new theme version requires %2$s.' ),
    466466                        PHP_VERSION,
    467                         $r['requires_php']
     467                        $upgrade_data['requires_php']
    468468                    )
    469469                );
     
    476476                $result = $this->run(
    477477                    array(
    478                         'package'           => $r['package'],
     478                        'package'           => $upgrade_data['package'],
    479479                        'destination'       => get_theme_root( $theme ),
    480480                        'clear_destination' => true,
     
    590590
    591591        // All these headers are needed on Theme_Installer_Skin::do_overwrite().
    592         $info = get_file_data(
     592        $new_theme_data = get_file_data(
    593593            $working_directory . 'style.css',
    594594            array(
     
    602602        );
    603603
    604         if ( empty( $info['Name'] ) ) {
     604        if ( empty( $new_theme_data['Name'] ) ) {
    605605            return new WP_Error(
    606606                'incompatible_archive_theme_no_name',
     
    620620         */
    621621        if (
    622             empty( $info['Template'] ) &&
     622            empty( $new_theme_data['Template'] ) &&
    623623            ! file_exists( $working_directory . 'index.php' ) &&
    624624            ! file_exists( $working_directory . 'templates/index.html' ) &&
     
    640640        }
    641641
    642         $requires_php = isset( $info['RequiresPHP'] ) ? $info['RequiresPHP'] : null;
    643         $requires_wp  = isset( $info['RequiresWP'] ) ? $info['RequiresWP'] : null;
     642        $requires_php = isset( $new_theme_data['RequiresPHP'] ) ? $new_theme_data['RequiresPHP'] : null;
     643        $requires_wp  = isset( $new_theme_data['RequiresWP'] ) ? $new_theme_data['RequiresWP'] : null;
    644644
    645645        if ( ! is_php_version_compatible( $requires_php ) ) {
     
    664664        }
    665665
    666         $this->new_theme_data = $info;
     666        $this->new_theme_data = $new_theme_data;
    667667
    668668        return $source;
Note: See TracChangeset for help on using the changeset viewer.