// If a lock couldn't be created, and there isn't a lock, bail.
if ( !
$lock_result ) { return false;
} // Check to see if the lock is still valid. If it is, bail.
if ( $lock_result >
( time() -
$release_timeout ) ) { return false;
} // There must exist an expired lock, clear it and re-gain it.
WP_Upgrader::
release_lock( $lock_name );
return WP_Upgrader::
create_lock( $lock_name,
$release_timeout );
} // Update the lock, as by this point we've definitely got a lock, just need to fire the actions.
update_option( $lock_option,
time() );
return true;
} /**
* Releases an upgrader lock.
*
* @since 4.5.0
*
* @see WP_Upgrader::create_lock()
*
* @param string $lock_name The name of this unique lock.
* @return bool True if the lock was successfully released. False on failure.
*/