Changeset 36821 for trunk/src/wp-admin/includes/class-wp-upgrader.php
- Timestamp:
- 03/03/2016 07:07:31 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r36370 r36821 753 753 754 754 /** 755 * Create a Lock using WordPress options.755 * Creates a lock using WordPress options. 756 756 * 757 757 * @since 4.5.0 … … 760 760 * 761 761 * @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. 764 765 */ 765 766 public static function create_lock( $lock_name, $release_timeout = null ) { … … 770 771 $lock_option = $lock_name . '.lock'; 771 772 772 // Try to lock 773 // Try to lock. 773 774 $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_option, time() ) ); 774 775 … … 776 777 $lock_result = get_option( $lock_option ); 777 778 778 // If we couldn't create a lock, and there isn't a lock, bail779 // If a lock couldn't be created, and there isn't a lock, bail. 779 780 if ( ! $lock_result ) { 780 781 return false; 781 782 } 782 783 783 // Check to see if the lock is still valid 784 // Check to see if the lock is still valid. If not, bail. 784 785 if ( $lock_result > ( time() - $release_timeout ) ) { 785 786 return false; … … 792 793 } 793 794 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. 795 796 update_option( $lock_option, time() ); 796 797
Note: See TracChangeset
for help on using the changeset viewer.