Changeset 47122 for trunk/src/wp-admin/includes/class-theme-upgrader.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-theme-upgrader.php
r47057 r47122 95 95 */ 96 96 public function check_parent_theme_filter( $install_result, $hook_extra, $child_result ) { 97 // Check to see if we need to install a parent theme 97 // Check to see if we need to install a parent theme. 98 98 $theme_info = $this->theme_info(); 99 99 … … 120 120 ), 121 121 ) 122 ); // Save on a bit of bandwidth.122 ); // Save on a bit of bandwidth. 123 123 124 124 if ( ! $api || is_wp_error( $api ) ) { 125 125 $this->skin->feedback( 'parent_theme_not_found', $theme_info->get( 'Template' ) ); 126 // Don't show activate or preview actions after installation 126 // Don't show activate or preview actions after installation. 127 127 add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) ); 128 128 return $install_result; … … 133 133 $child_success_message = $this->strings['process_success']; 134 134 135 // Override them 136 $this->skin->api = $api; 137 $this->strings['process_success_specific'] = $this->strings['parent_theme_install_success'];//, $api->name, $api->version); 135 // Override them. 136 $this->skin->api = $api; 137 138 $this->strings['process_success_specific'] = $this->strings['parent_theme_install_success']; //, $api->name, $api->version ); 138 139 139 140 $this->skin->feedback( 'parent_theme_prepare_install', $api->name, $api->version ); … … 141 142 add_filter( 'install_theme_complete_actions', '__return_false', 999 ); // Don't show any actions after installing the theme. 142 143 143 // Install the parent theme 144 // Install the parent theme. 144 145 $parent_result = $this->run( 145 146 array( 146 147 'package' => $api->download_link, 147 148 'destination' => get_theme_root(), 148 'clear_destination' => false, // Do not overwrite files.149 'clear_destination' => false, // Do not overwrite files. 149 150 'clear_working' => true, 150 151 ) … … 155 156 } 156 157 157 // Start cleaning up after the parent s installation158 // Start cleaning up after the parent's installation. 158 159 remove_filter( 'install_theme_complete_actions', '__return_false', 999 ); 159 160 160 // Reset child's result and data 161 // Reset child's result and data. 161 162 $this->result = $child_result; 162 163 $this->skin->api = $child_api; … … 220 221 'package' => $package, 221 222 'destination' => get_theme_root(), 222 'clear_destination' => false, // Do not overwrite files.223 'clear_destination' => false, // Do not overwrite files. 223 224 'clear_working' => true, 224 225 'hook_extra' => array( … … 237 238 } 238 239 239 // Refresh the Theme Update information 240 // Refresh the Theme Update information. 240 241 wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); 241 242 … … 350 351 $this->skin->header(); 351 352 352 // Connect to the Filesystem first.353 // Connect to the filesystem first. 353 354 $res = $this->fs_connect( array( WP_CONTENT_DIR ) ); 354 355 if ( ! $res ) { … … 359 360 $this->skin->bulk_header(); 360 361 361 // Only start maintenance mode if: 362 // - running Multisite and there are one or more themes specified, OR 363 // - a theme with an update available is currently in use. 364 // @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible. 362 /* 363 * Only start maintenance mode if: 364 * - running Multisite and there are one or more themes specified, OR 365 * - a theme with an update available is currently in use. 366 * @todo For multisite, maintenance mode should only kick in for individual sites if at all possible. 367 */ 365 368 $maintenance = ( is_multisite() && ! empty( $themes ) ); 366 369 foreach ( $themes as $theme ) { … … 389 392 } 390 393 391 // Get the URL to the zip file 394 // Get the URL to the zip file. 392 395 $r = $current->response[ $theme ]; 393 396 … … 407 410 $results[ $theme ] = $this->result; 408 411 409 // Prevent credentials auth screen from displaying multiple times 412 // Prevent credentials auth screen from displaying multiple times. 410 413 if ( false === $result ) { 411 414 break; 412 415 } 413 } // end foreach $plugins416 } // End foreach $themes. 414 417 415 418 $this->maintenance_mode( false ); 416 419 417 // Refresh the Theme Update information 420 // Refresh the Theme Update information. 418 421 wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); 419 422 … … 463 466 } 464 467 465 // Check th e folder contains a valid theme468 // Check that the folder contains a valid theme. 466 469 $working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source ); 467 470 if ( ! is_dir( $working_directory ) ) { // Sanity check, if the above fails, let's not prevent installation. … … 469 472 } 470 473 471 // A proper archive should have a style.css file in the single subdirectory 474 // A proper archive should have a style.css file in the single subdirectory. 472 475 if ( ! file_exists( $working_directory . 'style.css' ) ) { 473 476 return new WP_Error( … … 537 540 $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; 538 541 539 if ( $theme != get_stylesheet() ) { // If not current542 if ( $theme != get_stylesheet() ) { // If not current. 540 543 return $return; 541 544 } 542 //Change to maintenance mode now. 545 546 // Change to maintenance mode now. 543 547 if ( ! $this->bulk ) { 544 548 $this->maintenance_mode( true ); … … 567 571 $theme = isset( $theme['theme'] ) ? $theme['theme'] : ''; 568 572 569 if ( $theme != get_stylesheet() ) { // If not current 573 if ( $theme != get_stylesheet() ) { // If not current. 570 574 return $return; 571 575 } … … 578 582 } 579 583 580 // Time to remove maintenance mode584 // Time to remove maintenance mode. 581 585 if ( ! $this->bulk ) { 582 586 $this->maintenance_mode( false );
Note: See TracChangeset
for help on using the changeset viewer.