Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

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

    r47057 r47122  
    9595     */
    9696    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.
    9898        $theme_info = $this->theme_info();
    9999
     
    120120                ),
    121121            )
    122         ); //Save on a bit of bandwidth.
     122        ); // Save on a bit of bandwidth.
    123123
    124124        if ( ! $api || is_wp_error( $api ) ) {
    125125            $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.
    127127            add_filter( 'install_theme_complete_actions', array( $this, 'hide_activate_preview_actions' ) );
    128128            return $install_result;
     
    133133        $child_success_message = $this->strings['process_success'];
    134134
    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 );
    138139
    139140        $this->skin->feedback( 'parent_theme_prepare_install', $api->name, $api->version );
     
    141142        add_filter( 'install_theme_complete_actions', '__return_false', 999 ); // Don't show any actions after installing the theme.
    142143
    143         // Install the parent theme
     144        // Install the parent theme.
    144145        $parent_result = $this->run(
    145146            array(
    146147                'package'           => $api->download_link,
    147148                'destination'       => get_theme_root(),
    148                 'clear_destination' => false, //Do not overwrite files.
     149                'clear_destination' => false, // Do not overwrite files.
    149150                'clear_working'     => true,
    150151            )
     
    155156        }
    156157
    157         // Start cleaning up after the parents installation
     158        // Start cleaning up after the parent's installation.
    158159        remove_filter( 'install_theme_complete_actions', '__return_false', 999 );
    159160
    160         // Reset child's result and data
     161        // Reset child's result and data.
    161162        $this->result                     = $child_result;
    162163        $this->skin->api                  = $child_api;
     
    220221                'package'           => $package,
    221222                'destination'       => get_theme_root(),
    222                 'clear_destination' => false, //Do not overwrite files.
     223                'clear_destination' => false, // Do not overwrite files.
    223224                'clear_working'     => true,
    224225                'hook_extra'        => array(
     
    237238        }
    238239
    239         // Refresh the Theme Update information
     240        // Refresh the Theme Update information.
    240241        wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
    241242
     
    350351        $this->skin->header();
    351352
    352         // Connect to the Filesystem first.
     353        // Connect to the filesystem first.
    353354        $res = $this->fs_connect( array( WP_CONTENT_DIR ) );
    354355        if ( ! $res ) {
     
    359360        $this->skin->bulk_header();
    360361
    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         */
    365368        $maintenance = ( is_multisite() && ! empty( $themes ) );
    366369        foreach ( $themes as $theme ) {
     
    389392            }
    390393
    391             // Get the URL to the zip file
     394            // Get the URL to the zip file.
    392395            $r = $current->response[ $theme ];
    393396
     
    407410            $results[ $theme ] = $this->result;
    408411
    409             // Prevent credentials auth screen from displaying multiple times
     412            // Prevent credentials auth screen from displaying multiple times.
    410413            if ( false === $result ) {
    411414                break;
    412415            }
    413         } //end foreach $plugins
     416        } // End foreach $themes.
    414417
    415418        $this->maintenance_mode( false );
    416419
    417         // Refresh the Theme Update information
     420        // Refresh the Theme Update information.
    418421        wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
    419422
     
    463466        }
    464467
    465         // Check the folder contains a valid theme
     468        // Check that the folder contains a valid theme.
    466469        $working_directory = str_replace( $wp_filesystem->wp_content_dir(), trailingslashit( WP_CONTENT_DIR ), $source );
    467470        if ( ! is_dir( $working_directory ) ) { // Sanity check, if the above fails, let's not prevent installation.
     
    469472        }
    470473
    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.
    472475        if ( ! file_exists( $working_directory . 'style.css' ) ) {
    473476            return new WP_Error(
     
    537540        $theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
    538541
    539         if ( $theme != get_stylesheet() ) { //If not current
     542        if ( $theme != get_stylesheet() ) { // If not current.
    540543            return $return;
    541544        }
    542         //Change to maintenance mode now.
     545
     546        // Change to maintenance mode now.
    543547        if ( ! $this->bulk ) {
    544548            $this->maintenance_mode( true );
     
    567571        $theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
    568572
    569         if ( $theme != get_stylesheet() ) { // If not current
     573        if ( $theme != get_stylesheet() ) { // If not current.
    570574            return $return;
    571575        }
     
    578582        }
    579583
    580         //Time to remove maintenance mode
     584        // Time to remove maintenance mode.
    581585        if ( ! $this->bulk ) {
    582586            $this->maintenance_mode( false );
Note: See TracChangeset for help on using the changeset viewer.