WordPress Core Automatic Updates: Switch from using a transient for locking the upgrade process, to using a site option. See #22704
git-svn-id: https://develop.svn.wordpress.org/trunk@25467 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
194f6f75ae
commit
d1dcc8cca3
|
@ -1448,15 +1448,17 @@ class WP_Automatic_Upgrader {
|
||||||
static function perform_auto_updates() {
|
static function perform_auto_updates() {
|
||||||
|
|
||||||
$lock_name = 'auto_upgrader.lock';
|
$lock_name = 'auto_upgrader.lock';
|
||||||
if ( get_site_transient( $lock_name ) ) {
|
if ( get_site_option( $lock_name ) ) {
|
||||||
// Test to see if it was set more than an hour ago, if so, cleanup.
|
// Test to see if it was set more than an hour ago, if so, cleanup.
|
||||||
if ( true || get_site_transient( $lock_name ) < ( time() - HOUR_IN_SECONDS ) )
|
if ( get_site_option( $lock_name ) < ( time() - HOUR_IN_SECONDS ) )
|
||||||
delete_site_transient( $lock_name );
|
delete_site_option( $lock_name );
|
||||||
else // Recent lock
|
else { // The process is already locked
|
||||||
|
echo "There's a lock in place";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Lock upgrades for us for half an hour
|
// Lock upgrades for us for half an hour
|
||||||
if ( ! set_site_transient( $lock_name, microtime( true ), HOUR_IN_SECONDS / 2 ) )
|
if ( ! add_site_option( $lock_name, microtime( true ), HOUR_IN_SECONDS / 2 ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Next, Plugins
|
// Next, Plugins
|
||||||
|
@ -1492,8 +1494,8 @@ class WP_Automatic_Upgrader {
|
||||||
wp_update_themes(); // Check for Theme updates
|
wp_update_themes(); // Check for Theme updates
|
||||||
wp_update_plugins(); // Check for Plugin updates
|
wp_update_plugins(); // Check for Plugin updates
|
||||||
|
|
||||||
// TODO The core database upgrade has already cleared this transient..
|
// Clear the lock
|
||||||
delete_site_transient( $lock_name );
|
delete_site_option( $lock_name );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue