Make WordPress Core


Ignore:
Timestamp:
03/03/2016 07:07:31 AM (9 years ago)
Author:
DrewAPicture
Message:

Docs: Improve documentation for WP_Upgrader::create_lock(), introduced in [36349].

See #34878. See #35986.

File:
1 edited

Legend:

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

    r36370 r36821  
    753753
    754754    /**
    755      * Create a Lock using WordPress options.
     755     * Creates a lock using WordPress options.
    756756     *
    757757     * @since 4.5.0
     
    760760     *
    761761     * @param string $lock_name       The name of this unique lock.
    762      * @param int    $release_timeout The duration in seconds to respect an existing lock. Default: 1 hour.
    763      * @return bool
     762     * @param int    $release_timeout Optional. The duration in seconds to respect an existing lock.
     763     *                                Default: 1 hour.
     764     * @return bool False if a lock couldn't be created or if the lock is no longer valid. True otherwise.
    764765     */
    765766    public static function create_lock( $lock_name, $release_timeout = null ) {
     
    770771        $lock_option = $lock_name . '.lock';
    771772
    772         // Try to lock
     773        // Try to lock.
    773774        $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_option, time() ) );
    774775
     
    776777            $lock_result = get_option( $lock_option );
    777778
    778             // If we couldn't create a lock, and there isn't a lock, bail
     779            // If a lock couldn't be created, and there isn't a lock, bail.
    779780            if ( ! $lock_result ) {
    780781                return false;
    781782            }
    782783
    783             // Check to see if the lock is still valid
     784            // Check to see if the lock is still valid. If not, bail.
    784785            if ( $lock_result > ( time() - $release_timeout ) ) {
    785786                return false;
     
    792793        }
    793794
    794         // Update the lock, as by this point we've definitely got a lock, just need to fire the actions
     795        // Update the lock, as by this point we've definitely got a lock, just need to fire the actions.
    795796        update_option( $lock_option, time() );
    796797
Note: See TracChangeset for help on using the changeset viewer.