Make WordPress Core


Ignore:
Timestamp:
02/12/2024 12:31:29 PM (2 years ago)
Author:
costdev
Message:

Upgrade/Install: Avoid update_option() calls during bootstrap.

[57545] introduced the Plugin Dependencies feature, which contains a new plugin_data option.

Previously, the plugin_data option was being updated during bootstrap and in get_plugins(), causing an error when using the install script as the options database table does not yet exist, and also risked an "out of sync" issue between the database and the cache on websites with heavy traffic.

This removes the calls to update_option() during Core's bootstrap, and guards the call in get_plugins() to ensure that it doesn't run when WordPress is installing.

Follow-up to [57545].

Props desrosj, swisspidy, huzaifaalmesbah, afragen, dd32, azaozz, costdev.
Fixes #60461. See #60457, #60491.

File:
1 edited

Legend:

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

    r57545 r57592  
    361361    $cache_plugins[ $plugin_folder ] = $wp_plugins;
    362362    wp_cache_set( 'plugins', $cache_plugins, 'plugins' );
    363     update_option( 'plugin_data', $new_plugin_data );
     363
     364    if ( ! wp_installing() ) {
     365        update_option( 'plugin_data', $new_plugin_data );
     366    }
    364367
    365368    return $wp_plugins;
Note: See TracChangeset for help on using the changeset viewer.