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.
Built from https://develop.svn.wordpress.org/trunk@57592


git-svn-id: http://core.svn.wordpress.org/trunk@57093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
costdev
2024-02-12 12:33:10 +00:00
parent c309be74be
commit c04996591b
4 changed files with 15 additions and 49 deletions

View File

@@ -360,7 +360,10 @@ function get_plugins( $plugin_folder = '' ) {
$cache_plugins[ $plugin_folder ] = $wp_plugins;
wp_cache_set( 'plugins', $cache_plugins, 'plugins' );
update_option( 'plugin_data', $new_plugin_data );
if ( ! wp_installing() ) {
update_option( 'plugin_data', $new_plugin_data );
}
return $wp_plugins;
}