WordPress.org

Make WordPress Core

Changeset 25815


Ignore:
Timestamp:
10/16/2013 07:34:05 PM (5 years ago)
Author:
nacin
Message:

Merge the should_auto_update() and can_auto_update() methods. see #22704.

File:
1 edited

Legend:

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

    r25812 r25815  
    16021602
    16031603    /**
    1604      * Tests to see if we should upgrade a specific item, does not test to see if we CAN update the item.
     1604     * Tests to see if we can and should upgrade a specific item.
    16051605     */
    16061606    static function should_auto_update( $type, $item, $context ) {
     1607
     1608        // Checks to see if WP_Filesystem is set up to allow unattended upgrades.
     1609        $skin = new Automatic_Upgrader_Skin;
     1610        if ( ! $skin->request_filesystem_credentials( false, $context ) )
     1611            return false;
    16071612
    16081613        if ( self::upgrader_disabled() )
     
    16321637            return false;
    16331638
    1634         // If it's a core update, are we actually compatible with it's requirements?
     1639        // If it's a core update, are we actually compatible with its requirements?
    16351640        if ( 'core' == $type ) {
    16361641            global $wpdb;
     
    16471652
    16481653        return true;
    1649     }
    1650 
    1651     // Checks to see if WP_Filesystem is setup to allow unattended upgrades
    1652     static function can_auto_update( $context, $skin = false ) {
    1653         if ( ! $skin )
    1654             $skin = new Automatic_Upgrader_Skin();
    1655         return (bool) $skin->request_filesystem_credentials( false, $context );
    16561654    }
    16571655
     
    16811679        }
    16821680
    1683         // Determine if we can perform this upgrade or not
    1684         if ( ! self::should_auto_update( $type, $item, $context ) || ! self::can_auto_update( $context, $skin ) )
     1681        // Determine whether we can and should perform this upgrade.
     1682        if ( ! self::should_auto_update( $type, $item, $context ) )
    16851683            return false;
    16861684
Note: See TracChangeset for help on using the changeset viewer.