Upgrade/Install: Only check plugins whose data is already stored.

In [57592], some `update_option()` calls were removed from bootstrapping. However, this also removed a check to ensure an array key existed, and populated it if not.

Scaffolding tests by WP-CLI revealed that a plugin in the `active_plugins` option may not have data already stored within the `plugin_data` option, causing a PHP warning for an undefined array key. This data will be added the next time `get_plugins()` is called.

This adds a condition to ensure the requirements checks are only performed on plugins whose data is already stored in the `plugin_data` option.

Follow-up to [57592].

Props swissspidy, hellofromTonya, costdev.
Fixes #60461.
Built from https://develop.svn.wordpress.org/trunk@57622


git-svn-id: http://core.svn.wordpress.org/trunk@57123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
costdev 2024-02-13 13:30:06 +00:00
parent 2a78e6400c
commit 0ab75261f4
2 changed files with 69 additions and 58 deletions

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.5-alpha-57621';
$wp_version = '6.5-alpha-57622';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -504,6 +504,16 @@ $failed_plugins = array();
$plugins_dir_strlen = strlen( trailingslashit( WP_PLUGIN_DIR ) );
foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
$plugin_file = substr( $plugin, $plugins_dir_strlen );
/*
* Skip any plugins that have not been added to the 'plugin_data' option yet.
*
* Some plugin files may be added locally and activated, but will not yet be
* added to the 'plugin_data' option. This causes the 'active_plugins' option
* and the 'plugin_data' option to be temporarily out of sync until the next
* call to `get_plugins()`.
*/
if ( isset( $all_plugin_data[ $plugin_file ] ) ) {
$plugin_headers = $all_plugin_data[ $plugin_file ];
$errors = array();
$requirements = array(
@ -566,6 +576,7 @@ foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
}
continue;
}
}
wp_register_plugin_realpath( $plugin );