Title: ryanericw's Replies | WordPress.org

---

# ryanericw

  [  ](https://wordpress.org/support/users/ryanericw/)

 *   [Profile](https://wordpress.org/support/users/ryanericw/)
 *   [Topics Started](https://wordpress.org/support/users/ryanericw/topics/)
 *   [Replies Created](https://wordpress.org/support/users/ryanericw/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/ryanericw/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/ryanericw/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/ryanericw/engagements/)
 *   [Favorites](https://wordpress.org/support/users/ryanericw/favorites/)

 Search replies:

## Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [UPDATE to 5.6 Bug](https://wordpress.org/support/topic/update-to-5-6-bug/)
 *  Thread Starter [ryanericw](https://wordpress.org/support/users/ryanericw/)
 * (@ryanericw)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/update-to-5-6-bug/#post-13798749)
 * My modified static function that is displaying this code. Note – I’ve since manually
   upgraded again this time to 5.6. Once another WP update comes out, I’ll verify
   this is still an issue and then maybe I can narrow it down to a Database/Table
   issue.
 *     ```
       	public static function create_lock( $lock_name, $release_timeout = null ) {
       		global $wpdb;
       		if ( ! $release_timeout ) {
       			$release_timeout = HOUR_IN_SECONDS;
       		}
       		$lock_option = $lock_name . '.lock';
   
       		// Try to lock.
       		$q = $wpdb->prepare( "INSERT INTO <code>$wpdb->options</code> ( <code>option_name</code>, <code>option_value</code>, <code>autoload</code> ) VALUES (%s, %s, 'no') /* LOCK */", $lock_option, time() );
       		$lock_result = $wpdb->query( $q );
   
       		echo "QUERY[   $q   ]<br>";
       		echo "QUERY ERROR[   ".$wpdb->last_error."   ]<br>";
       		//$test_result = $wpdb->query( "INSERT INTO wp_options (option_name, option_value, autoload) VALUES('ZZZ', '1', 'no')");
       		//if( ! $test_result ) echo "test failed";
   
       		if ( ! $lock_result ) 
       		{
       			$lock_result = get_option( $lock_option );
   
       			// If a lock couldn't be created, and there isn't a lock, bail.
       			if ( ! $lock_result ) {
       				echo "There is where I'm failing<br>";
       				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;
       	}
       ```
   
    -  This reply was modified 5 years, 5 months ago by [ryanericw](https://wordpress.org/support/users/ryanericw/).
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [UPDATE to 5.6 Bug](https://wordpress.org/support/topic/update-to-5-6-bug/)
 *  Thread Starter [ryanericw](https://wordpress.org/support/users/ryanericw/)
 * (@ryanericw)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/update-to-5-6-bug/#post-13793553)
 * Running the query below manually actually inserts the record:
 * INSERT INTO`wp_options`(`option_name`,`option_value`,`autoload`) VALUES (‘core_updater.
   lock’, ‘1608054699’, ‘no’) /* LOCK */
 * Then if I run the query
    SELECT * FROM wp_options WHERE option_name=”core_updater.
   lock”
 * It will find the row. After I delete it manually, wordpress says it still exists
   which is insane.
    -  This reply was modified 5 years, 5 months ago by [ryanericw](https://wordpress.org/support/users/ryanericw/).
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [UPDATE to 5.6 Bug](https://wordpress.org/support/topic/update-to-5-6-bug/)
 *  Thread Starter [ryanericw](https://wordpress.org/support/users/ryanericw/)
 * (@ryanericw)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/update-to-5-6-bug/#post-13793533)
 * Running the query below returns 0 results:
 * `SELECT * FROM wp_options WHERE option_name="core_updater.lock"`

Viewing 3 replies - 1 through 3 (of 3 total)