Make WordPress Core


Ignore:
Timestamp:
09/17/2013 02:27:21 AM (11 years ago)
Author:
dd32
Message:

WordPress Core Automatic Updates: Switch from using a transient for locking the upgrade process, to using a site option. See #22704

File:
1 edited

Legend:

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

    r25447 r25467  
    14491449
    14501450        $lock_name = 'auto_upgrader.lock';
    1451         if ( get_site_transient( $lock_name ) ) {
     1451        if ( get_site_option( $lock_name ) ) {
    14521452            // Test to see if it was set more than an hour ago, if so, cleanup.
    1453             if ( true || get_site_transient( $lock_name ) < ( time() - HOUR_IN_SECONDS ) )
    1454                 delete_site_transient( $lock_name );
    1455             else // Recent lock
     1453            if ( get_site_option( $lock_name ) < ( time() - HOUR_IN_SECONDS ) )
     1454                delete_site_option( $lock_name );
     1455            else { // The process is already locked
     1456                echo "There's a lock in place";
    14561457                return;
     1458            }
    14571459        }
    14581460        // Lock upgrades for us for half an hour
    1459         if ( ! set_site_transient( $lock_name, microtime( true ), HOUR_IN_SECONDS / 2 ) )
     1461        if ( ! add_site_option( $lock_name, microtime( true ), HOUR_IN_SECONDS / 2 ) )
    14601462            return;
    14611463
     
    14931495        wp_update_plugins(); // Check for Plugin updates
    14941496
    1495         // TODO The core database upgrade has already cleared this transient..
    1496         delete_site_transient( $lock_name );
     1497        // Clear the lock
     1498        delete_site_option( $lock_name );
    14971499
    14981500    }
Note: See TracChangeset for help on using the changeset viewer.