Skip to content

Commit eb3a4be

Browse files
Coding Standards: Use more meaningful variable names in Theme Upgrader.
Per the [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions 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. git-svn-id: https://develop.svn.wordpress.org/trunk@61028 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 62bbb79 commit eb3a4be

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public function upgrade( $theme, $args = array() ) {
311311
return false;
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 );
317317
add_filter( 'upgrader_post_install', array( $this, 'current_after' ), 10, 2 );
@@ -323,7 +323,7 @@ public function upgrade( $theme, $args = array() ) {
323323

324324
$this->run(
325325
array(
326-
'package' => $r['package'],
326+
'package' => $upgrade_data['package'],
327327
'destination' => get_theme_root( $theme ),
328328
'clear_destination' => true,
329329
'clear_working' => true,
@@ -400,8 +400,8 @@ public function bulk_upgrade( $themes, $args = array() ) {
400400
$this->skin->header();
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;
407407
}
@@ -441,30 +441,30 @@ public function bulk_upgrade( $themes, $args = array() ) {
441441
}
442442

443443
// Get the URL to the zip file.
444-
$r = $current->response[ $theme ];
444+
$upgrade_data = $current->response[ $theme ];
445445

446-
if ( isset( $r['requires'] ) && ! is_wp_version_compatible( $r['requires'] ) ) {
446+
if ( isset( $upgrade_data['requires'] ) && ! is_wp_version_compatible( $upgrade_data['requires'] ) ) {
447447
$result = new WP_Error(
448448
'incompatible_wp_required_version',
449449
sprintf(
450450
/* translators: 1: Current WordPress version, 2: WordPress version required by the new theme 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
);
456456

457457
$this->skin->before( $result );
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',
463463
sprintf(
464464
/* translators: 1: Current PHP version, 2: PHP version required by the new theme 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
);
470470

@@ -475,7 +475,7 @@ public function bulk_upgrade( $themes, $args = array() ) {
475475
add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) );
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,
481481
'clear_working' => true,
@@ -589,7 +589,7 @@ public function check_package( $source ) {
589589
}
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(
595595
'Name' => 'Theme Name',
@@ -601,7 +601,7 @@ public function check_package( $source ) {
601601
)
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',
607607
$this->strings['incompatible_archive'],
@@ -619,7 +619,7 @@ public function check_package( $source ) {
619619
* - block themes require /templates/index.html or block-templates/index.html (deprecated 5.9.0).
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' ) &&
625625
! file_exists( $working_directory . 'block-templates/index.html' )
@@ -639,8 +639,8 @@ public function check_package( $source ) {
639639
);
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 ) ) {
646646
$error = sprintf(
@@ -663,7 +663,7 @@ public function check_package( $source ) {
663663
return new WP_Error( 'incompatible_wp_required_version', $this->strings['incompatible_archive'], $error );
664664
}
665665

666-
$this->new_theme_data = $info;
666+
$this->new_theme_data = $new_theme_data;
667667

668668
return $source;
669669
}

0 commit comments

Comments
 (0)