Changeset 36370 for trunk/src/wp-admin/includes/class-wp-upgrader.php
- Timestamp:
- 01/21/2016 01:21:52 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r36349 r36370 757 757 * @since 4.5.0 758 758 * @access public 759 * @static 759 760 * 760 761 * @param string $lock_name The name of this unique lock. … … 762 763 * @return bool 763 764 */ 764 public function create_lock( $lock_name, $release_timeout = null ) {765 public static function create_lock( $lock_name, $release_timeout = null ) { 765 766 global $wpdb; 766 767 if ( ! $release_timeout ) { … … 786 787 787 788 // There must exist an expired lock, clear it and re-gain it. 788 $this->release_lock( $lock_name );789 790 return $this->create_lock( $lock_name, $release_timeout );789 WP_Upgrader::release_lock( $lock_name ); 790 791 return WP_Upgrader::create_lock( $lock_name, $release_timeout ); 791 792 } 792 793 … … 802 803 * @since 4.5.0 803 804 * @access public 805 * @static 804 806 * 805 807 * @param string $lock_name The name of this unique lock. 806 808 * @return bool 807 809 */ 808 public function release_lock( $lock_name ) {810 public static function release_lock( $lock_name ) { 809 811 return delete_option( $lock_name . '.lock' ); 810 812 } … … 2313 2315 2314 2316 // Lock to prevent multiple Core Updates occuring 2315 $lock = $this->create_lock( 'core_updater', 15 * MINUTE_IN_SECONDS );2317 $lock = WP_Upgrader::create_lock( 'core_updater', 15 * MINUTE_IN_SECONDS ); 2316 2318 if ( ! $lock ) { 2317 2319 return new WP_Error( 'locked', $this->strings['locked'] ); … … 2320 2322 $download = $this->download_package( $current->packages->$to_download ); 2321 2323 if ( is_wp_error( $download ) ) { 2322 $this->release_lock( 'core_updater' );2324 WP_Upgrader::release_lock( 'core_updater' ); 2323 2325 return $download; 2324 2326 } … … 2326 2328 $working_dir = $this->unpack_package( $download ); 2327 2329 if ( is_wp_error( $working_dir ) ) { 2328 $this->release_lock( 'core_updater' );2330 WP_Upgrader::release_lock( 'core_updater' ); 2329 2331 return $working_dir; 2330 2332 } … … 2333 2335 if ( !$wp_filesystem->copy($working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true) ) { 2334 2336 $wp_filesystem->delete($working_dir, true); 2335 $this->release_lock( 'core_updater' );2337 WP_Upgrader::release_lock( 'core_updater' ); 2336 2338 return new WP_Error( 'copy_failed_for_update_core_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-admin/includes/update-core.php' ); 2337 2339 } … … 2341 2343 2342 2344 if ( ! function_exists( 'update_core' ) ) { 2343 $this->release_lock( 'core_updater' );2345 WP_Upgrader::release_lock( 'core_updater' ); 2344 2346 return new WP_Error( 'copy_failed_space', $this->strings['copy_failed_space'] ); 2345 2347 } … … 2418 2420 } 2419 2421 2420 $this->release_lock( 'core_updater' );2422 WP_Upgrader::release_lock( 'core_updater' ); 2421 2423 2422 2424 return $result; … … 3055 3057 return; 3056 3058 3057 if ( ! $this->create_lock( 'auto_updater' ) )3059 if ( ! WP_Upgrader::create_lock( 'auto_updater' ) ) 3058 3060 return; 3059 3061 … … 3155 3157 } 3156 3158 3157 $this->release_lock( 'auto_updater' );3159 WP_Upgrader::release_lock( 'auto_updater' ); 3158 3160 } 3159 3161
Note: See TracChangeset
for help on using the changeset viewer.