3

I know that a similar question has been asked before, but this is NOT a duplicate because this is specific to Wordpress 5+ and the answers to the similar question have all been tried to no avail.

Issue:

My Wordpress is Version 5.01 and there are some technical issues PHP error logs indicate the core WordPress needs to be reinstalled (bad syntax errors on core SQL queries with empty $vars) .

However; when presented with Re-installing Wordpress on the admin area; it states that:

Another update is currently in progress

I have run through all of the answers in this question and they are invalid or not applicable (they have all been attempted to confirm this):

  • The .maintenance file has been manually disabled.
  • The <...>_options table directory does NOT contain the wordpress update .lock tag. Despite this being confirmed as appearing in the PHP code.
  • All plugins have been disabled.
  • The lock does not time out and resolve after 15 minutes.

Yet I am still unable to find either the cause of the notification or the notfication itself in the PHP code, to manually override it (reference here again) .

Request:

How do I over-ride the "Another update is currently in progress" in WordPress 5. This request is specific to WP5 as it appears the system may have changed since before 5.0,

Update

I am not looking [just] for how to work-around the problem; more an explanation as to how the text "Another update is currently in progress" is generated on WordPress 5

Thank you for any guidance on this.

1
  • Just noting that I've been running into this too and fixed it with a manual update, as suggested by @Keonramses. However after the manual update, if I attempt to update using the dashboard again, the update will get stuck on Disabling Maintenance mode" and If I then try yet another update from the Dashboard, I'll get *Another update is currently in progress which I can resolve by deleting the core_updater.lock option. This is happening on my Windows dev machine running XAMPP 5. Long story short; manual update fixes it for me but I'm not exactly sure what the cause is. Commented Dec 18, 2018 at 1:39

4 Answers 4

4

you can try doing a manual update, so as long as you didn't make any changes to the WordPress core files(if you did I suggest you take note of them and reapply after the upgrade), just head over to WordPress.org download the latest WordPress package and copy it over to your root folder on the server make sure you overwrite only the core WordPress files, leave the wp-content folder out of this, input your details to the wp-config.php file and that should probably sort this issue out for you. PS. remember to back up your database and original WordPress folders before continuing.

1
  • Hello, thanks yes I'm aware of the manual update but didn't know if there was anoither tweak/method I could perform to cicumvent this need. Thanks. +1
    – Martin
    Commented Dec 18, 2018 at 10:59
2

You'll get this error also if WP can not insert a lock in the wp_options table. It may be that the table is not configured correctly, e.g. when copied from another source. The option_id should be autoincrement or the update fails. Check if can insert a lock entry in the database manually:

INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('core_updater.lock', '1', 'no');

If the option_id is not autoincrement and this query fails, you'll need to make the option_id field autoincrement. You may need to remove the index in this field before making it autoincrement.

2

Not sure if this will help expand the conversation to help figure this out but I've narrowed the error message down to being generated by line 118-122 of class-core-upgrade.php (wp-admin/includes)

// Lock to prevent multiple Core Updates occurring.
$lock = WP_Upgrader::create_lock( 'core_updater', 15 * MINUTE_IN_SECONDS );
if ( ! $lock ) {
    return new WP_Error( 'locked', $this->strings['locked'] );
}

function create_lock is in file class-wp-upgrader.php on line 885-918

putting echo codes in before the returns, I was able to narrow it down to these lines in the function (899-901)

// If a lock couldn't be created, and there isn't a lock, bail.
if ( ! $lock_result ) {
    return false;
}

For some reason, I am able to query the code above by RouteXL and a lock gets generated, but WP is failing to insert the query on line 893

$lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_option, time() ) );

Inserting this line right after 893

echo $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_option, time() );

gives me the echo code when doing an update

INSERT IGNORE INTO `wp_options` ( `option_name`, `option_value`, `autoload` ) VALUES ('core_updater.lock', '1606851384', 'no') /* LOCK */

I ran this query manually and it inserts the row correctly into the MySQL database using the same user/pass as my WP install.

I'm not entirely sure why wordpress is failing to do this but I can do it manually using the same credentials.

1

I modified the create_lock function to produce some error codes and information. I also changed the query removing the IGNORE after INSERT and it finally gives me an error when trying to update with the MySQL:

update-core.php now generates:

Update WordPress
QUERY[ INSERT INTO `wp_options` ( `option_name`, `option_value`, `autoload` ) VALUES ('core_updater.lock', '1606853111', 'no') /* LOCK */ ]
QUERY ERROR[ Duplicate entry 'core_updater.lock' for key 'option_name' ]
There is where I'm failing
Another update is currently in progress.

Duplicate entry 'core_updater.lock' for key 'option_name' This is why it's failing!

The kicker? I don't see that line or value in my wp_options table! Very very strange! Now I need to see why it's saying it's a duplicate, even though this option doesn't exist in my database!

class-wp-upgrader.php (modified to produce diag data)

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 `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) 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;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.