Changeset 25828 for trunk/src/wp-admin/includes/class-wp-upgrader.php
- Timestamp:
- 10/17/2013 05:23:35 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r25823 r25828 1737 1737 */ 1738 1738 function run() { 1739 global $wpdb; 1740 1741 if ( ! is_main_network() || ! is_main_site() ) 1742 return; 1743 1739 1744 $lock_name = 'auto_upgrader.lock'; 1740 if ( get_site_option( $lock_name ) ) { 1741 // Test to see if it was set more than an hour ago, if so, cleanup. 1742 if ( get_site_option( $lock_name ) < ( time() - HOUR_IN_SECONDS ) ) 1743 delete_site_option( $lock_name ); 1744 else // The process is already locked 1745 1746 // Try to lock 1747 $lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time() ) ); 1748 1749 if ( ! $lock_result ) { 1750 $lock_result = get_option( $lock_name ); 1751 1752 // If we couldn't create a lock, and there isn't a lock, bail 1753 if ( ! $lock_result ) 1745 1754 return; 1746 } 1747 // Lock upgrades for us for half an hour 1748 if ( ! add_site_option( $lock_name, microtime( true ), HOUR_IN_SECONDS / 2 ) ) 1749 return; 1755 1756 // Check to see if the lock is still valid 1757 if ( $lock_result > ( time() - HOUR_IN_SECONDS ) ) 1758 return; 1759 } 1760 1761 // Update the lock, as by this point we've definately got a lock, just need to fire the actions 1762 update_option( $lock_name, time() ); 1750 1763 1751 1764 // Don't automatically run these thins, as we'll handle it ourselves … … 1830 1843 1831 1844 // Clear the lock 1832 delete_site_option( $lock_name ); 1833 1845 delete_option( $lock_name ); 1834 1846 } 1835 1847
Note: See TracChangeset
for help on using the changeset viewer.