Changeset 57252
- Timestamp:
- 01/08/2024 11:17:48 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-theme-upgrader.php
r57239 r57252 372 372 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional. 373 373 * 374 * @global string $wp_version The WordPress version string. 375 * 374 376 * @param string[] $themes Array of the theme slugs. 375 377 * @param array $args { … … 382 384 */ 383 385 public function bulk_upgrade( $themes, $args = array() ) { 386 global $wp_version; 387 384 388 $defaults = array( 385 389 'clear_update_cache' => true, … … 443 447 $r = $current->response[ $theme ]; 444 448 445 $result = $this->run( 446 array( 447 'package' => $r['package'], 448 'destination' => get_theme_root( $theme ), 449 'clear_destination' => true, 450 'clear_working' => true, 451 'is_multi' => true, 452 'hook_extra' => array( 453 'theme' => $theme, 454 'temp_backup' => array( 455 'slug' => $theme, 456 'src' => get_theme_root( $theme ), 457 'dir' => 'themes', 449 if ( isset( $r['requires'] ) && ! is_wp_version_compatible( $r['requires'] ) ) { 450 $result = new WP_Error( 451 'incompatible_wp_required_version', 452 sprintf( 453 /* translators: 1: Current WordPress version, 2: WordPress version required by the new theme version. */ 454 __( 'Your WordPress version is %1$s, however the new theme version requires %2$s.' ), 455 $wp_version, 456 $r['requires'] 457 ) 458 ); 459 460 $this->skin->before( $result ); 461 $this->skin->error( $result ); 462 $this->skin->after(); 463 } elseif ( isset( $r['requires_php'] ) && ! is_php_version_compatible( $r['requires_php'] ) ) { 464 $result = new WP_Error( 465 'incompatible_php_required_version', 466 sprintf( 467 /* translators: 1: Current PHP version, 2: PHP version required by the new theme version. */ 468 __( 'The PHP version on your server is %1$s, however the new theme version requires %2$s.' ), 469 PHP_VERSION, 470 $r['requires_php'] 471 ) 472 ); 473 474 $this->skin->before( $result ); 475 $this->skin->error( $result ); 476 $this->skin->after(); 477 } else { 478 add_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); 479 $result = $this->run( 480 array( 481 'package' => $r['package'], 482 'destination' => get_theme_root( $theme ), 483 'clear_destination' => true, 484 'clear_working' => true, 485 'is_multi' => true, 486 'hook_extra' => array( 487 'theme' => $theme, 488 'temp_backup' => array( 489 'slug' => $theme, 490 'src' => get_theme_root( $theme ), 491 'dir' => 'themes', 492 ), 458 493 ), 459 ), 460 ) 461 ); 494 ) 495 ); 496 remove_filter( 'upgrader_source_selection', array( $this, 'check_package' ) ); 497 } 462 498 463 499 $results[ $theme ] = $result;
Note: See TracChangeset
for help on using the changeset viewer.