Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (7 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-core-upgrader.php

    r47099 r47122  
    116116                }
    117117
    118                 // Lock to prevent multiple Core Updates occurring
     118                // Lock to prevent multiple Core Updates occurring.
    119119                $lock = WP_Upgrader::create_lock( 'core_updater', 15 * MINUTE_IN_SECONDS );
    120120                if ( ! $lock ) {
     
    221221                );
    222222
    223                 // Clear the current updates
     223                // Clear the current updates.
    224224                delete_site_transient( 'update_core' );
    225225
     
    273273                include( ABSPATH . WPINC . '/version.php' ); // $wp_version; // x.y.z
    274274
    275                 $current_branch                 = implode( '.', array_slice( preg_split( '/[.-]/', $wp_version ), 0, 2 ) ); // x.y
    276                 $new_branch                     = implode( '.', array_slice( preg_split( '/[.-]/', $offered_ver ), 0, 2 ) ); // x.y
     275                $current_branch = implode( '.', array_slice( preg_split( '/[.-]/', $wp_version ), 0, 2 ) ); // x.y
     276                $new_branch     = implode( '.', array_slice( preg_split( '/[.-]/', $offered_ver ), 0, 2 ) ); // x.y
     277
    277278                $current_is_development_version = (bool) strpos( $wp_version, '-' );
    278279
     
    285286                if ( defined( 'WP_AUTO_UPDATE_CORE' ) ) {
    286287                        if ( false === WP_AUTO_UPDATE_CORE ) {
    287                                 // Defaults to turned off, unless a filter allows it
     288                                // Defaults to turned off, unless a filter allows it.
    288289                                $upgrade_dev   = false;
    289290                                $upgrade_minor = false;
    290291                                $upgrade_major = false;
    291292                        } elseif ( true === WP_AUTO_UPDATE_CORE ) {
    292                                 // ALL updates for core
     293                                // ALL updates for core.
    293294                                $upgrade_dev   = true;
    294295                                $upgrade_minor = true;
    295296                                $upgrade_major = true;
    296297                        } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) {
    297                                 // Only minor updates for core
     298                                // Only minor updates for core.
    298299                                $upgrade_dev   = false;
    299300                                $upgrade_minor = true;
     
    307308                }
    308309
    309                 // 2: If we're running a newer version, that's a nope
     310                // 2: If we're running a newer version, that's a nope.
    310311                if ( version_compare( $wp_version, $offered_ver, '>' ) ) {
    311312                        return false;
     
    324325                        }
    325326
    326                         // Cannot update if we're retrying the same A to B update that caused a non-critical failure.
    327                         // Some non-critical failures do allow retries, like download_failed.
    328                         // 3.7.1 => 3.7.2 resulted in files_not_writable, if we are still on 3.7.1 and still trying to update to 3.7.2.
     327                        /*
     328                         * Cannot update if we're retrying the same A to B update that caused a non-critical failure.
     329                         * Some non-critical failures do allow retries, like download_failed.
     330                         * 3.7.1 => 3.7.2 resulted in files_not_writable, if we are still on 3.7.1 and still trying to update to 3.7.2.
     331                         */
    329332                        if ( empty( $failure_data['retry'] ) && $wp_version == $failure_data['current'] && $offered_ver == $failure_data['attempted'] ) {
    330333                                return false;
     
    332335                }
    333336
    334                 // 3: 3.7-alpha-25000 -> 3.7-alpha-25678 -> 3.7-beta1 -> 3.7-beta2
     337                // 3: 3.7-alpha-25000 -> 3.7-alpha-25678 -> 3.7-beta1 -> 3.7-beta2.
    335338                if ( $current_is_development_version ) {
    336339
     
    349352                }
    350353
    351                 // 4: Minor In-branch updates (3.7.0 -> 3.7.1 -> 3.7.2 -> 3.7.4)
     354                // 4: Minor in-branch updates (3.7.0 -> 3.7.1 -> 3.7.2 -> 3.7.4).
    352355                if ( $current_branch == $new_branch ) {
    353356
     
    362365                }
    363366
    364                 // 5: Major version updates (3.7.0 -> 3.8.0 -> 3.9.1)
     367                // 5: Major version updates (3.7.0 -> 3.8.0 -> 3.9.1).
    365368                if ( version_compare( $new_branch, $current_branch, '>' ) ) {
    366369
     
    375378                }
    376379
    377                 // If we're not sure, we don't want it
     380                // If we're not sure, we don't want it.
    378381                return false;
    379382        }
     
    399402
    400403                foreach ( $checksums as $file => $checksum ) {
    401                         // Skip files which get updated
     404                        // Skip files which get updated.
    402405                        if ( 'wp-content' == substr( $file, 0, 10 ) ) {
    403406                                continue;
Note: See TracChangeset for help on using the changeset viewer.