diff --git a/wp-admin/includes/class-plugin-upgrader.php b/wp-admin/includes/class-plugin-upgrader.php index 97343fcf9d..091cfebc18 100644 --- a/wp-admin/includes/class-plugin-upgrader.php +++ b/wp-admin/includes/class-plugin-upgrader.php @@ -155,12 +155,6 @@ class Plugin_Upgrader extends WP_Upgrader { // Force refresh of plugin update information. wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); - $all_plugin_data = get_option( 'plugin_data', array() ); - $plugin_file = $this->new_plugin_data['file']; - unset( $this->new_plugin_data['file'] ); - $all_plugin_data[ $plugin_file ] = $this->new_plugin_data; - update_option( 'plugin_data', $all_plugin_data ); - if ( $parsed_args['overwrite_package'] ) { /** * Fires when the upgrader has successfully overwritten a currently installed @@ -488,16 +482,7 @@ class Plugin_Upgrader extends WP_Upgrader { foreach ( $files as $file ) { $info = get_plugin_data( $file, false, false ); if ( ! empty( $info['Name'] ) ) { - $basename = basename( $file ); - $dirname = basename( dirname( $file ) ); - - if ( '.' === $dirname ) { - $plugin_file = $basename; - } else { - $plugin_file = "$dirname/$basename"; - } - $this->new_plugin_data = ( $info ); - $this->new_plugin_data['file'] = $plugin_file; + $this->new_plugin_data = $info; break; } } diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php index 2de2aabbc3..2399ffc807 100644 --- a/wp-admin/includes/plugin-install.php +++ b/wp-admin/includes/plugin-install.php @@ -927,7 +927,7 @@ function wp_get_plugin_action_button( $name, $data, $compatible_php, $compatible // Determine the status of plugin dependencies. $installed_plugins = get_plugins(); - $active_plugins = get_option( 'active_plugins' ); + $active_plugins = get_option( 'active_plugins', array() ); $plugin_dependencies_count = count( $requires_plugins ); $installed_plugin_dependencies_count = 0; $active_plugin_dependencies_count = 0; diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index fa3fa09f09..680f4a7728 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -333,7 +333,6 @@ function get_plugins( $plugin_folder = '' ) { return $wp_plugins; } - $new_plugin_data = array(); foreach ( $plugin_files as $plugin_file ) { if ( ! is_readable( "$plugin_root/$plugin_file" ) ) { continue; @@ -346,13 +345,6 @@ function get_plugins( $plugin_folder = '' ) { continue; } - $new_plugin_file = str_replace( - trailingslashit( WP_PLUGIN_DIR ), - '', - "$plugin_root/$plugin_file" - ); - - $new_plugin_data[ $new_plugin_file ] = $plugin_data; $wp_plugins[ plugin_basename( $plugin_file ) ] = $plugin_data; } @@ -361,10 +353,6 @@ function get_plugins( $plugin_folder = '' ) { $cache_plugins[ $plugin_folder ] = $wp_plugins; wp_cache_set( 'plugins', $cache_plugins, 'plugins' ); - if ( ! wp_installing() ) { - update_option( 'plugin_data', $new_plugin_data ); - } - return $wp_plugins; } @@ -975,7 +963,6 @@ function delete_plugins( $plugins, $deprecated = '' ) { $plugins_dir = trailingslashit( $plugins_dir ); $plugin_translations = wp_get_installed_translations( 'plugins' ); - $all_plugin_data = get_option( 'plugin_data', array() ); $errors = array(); @@ -1020,7 +1007,6 @@ function delete_plugins( $plugins, $deprecated = '' ) { $errors[] = $plugin_file; continue; } - unset( $all_plugin_data[ $plugin_file ] ); $plugin_slug = dirname( $plugin_file ); @@ -1069,7 +1055,6 @@ function delete_plugins( $plugins, $deprecated = '' ) { return new WP_Error( 'could_not_remove_plugin', sprintf( $message, implode( ', ', $errors ) ) ); } - update_option( 'plugin_data', $all_plugin_data ); return true; } @@ -1214,6 +1199,8 @@ function validate_plugin_requirements( $plugin ) { ); } + WP_Plugin_Dependencies::initialize(); + if ( WP_Plugin_Dependencies::has_unmet_dependencies( $plugin ) ) { $dependencies = WP_Plugin_Dependencies::get_dependencies( $plugin ); $unmet_dependencies = array(); diff --git a/wp-admin/plugin-install.php b/wp-admin/plugin-install.php index a8beb8249b..5c8be143bf 100644 --- a/wp-admin/plugin-install.php +++ b/wp-admin/plugin-install.php @@ -135,8 +135,8 @@ get_current_screen()->set_screen_reader_content( */ require_once ABSPATH . 'wp-admin/admin-header.php'; +WP_Plugin_Dependencies::initialize(); WP_Plugin_Dependencies::display_admin_notice_for_unmet_dependencies(); -WP_Plugin_Dependencies::display_admin_notice_for_deactivated_dependents(); WP_Plugin_Dependencies::display_admin_notice_for_circular_dependencies(); ?>
' . sprintf( - /* translators: %s: URL to Update PHP page. */ - __( 'Learn more about updating PHP.' ), - esc_url( wp_get_update_php_url() ) - ); - - $annotation = wp_get_update_php_annotation(); - - if ( $annotation ) { - $php_update_message .= '
' . $annotation . ''; - } - - if ( ! $compatible_wp && ! $compatible_php ) { - $errors[] = sprintf( - /* translators: 1: Current WordPress version, 2: Current PHP version, 3: Plugin name, 4: Required WordPress version, 5: Required PHP version. */ - _x( 'Error: Current versions of WordPress (%1$s) and PHP (%2$s) do not meet minimum requirements for %3$s. The plugin requires WordPress %4$s and PHP %5$s.', 'plugin' ), - get_bloginfo( 'version' ), - PHP_VERSION, - $plugin_headers['Name'], - $requirements['requires'], - $requirements['requires_php'] - ) . $php_update_message; - } elseif ( ! $compatible_php ) { - $errors[] = sprintf( - /* translators: 1: Current PHP version, 2: Plugin name, 3: Required PHP version. */ - _x( 'Error: Current PHP version (%1$s) does not meet minimum requirements for %2$s. The plugin requires PHP %3$s.', 'plugin' ), - PHP_VERSION, - $plugin_headers['Name'], - $requirements['requires_php'] - ) . $php_update_message; - } elseif ( ! $compatible_wp ) { - $errors[] = sprintf( - /* translators: 1: Current WordPress version, 2: Plugin name, 3: Required WordPress version. */ - _x( 'Error: Current WordPress version (%1$s) does not meet minimum requirements for %2$s. The plugin requires WordPress %3$s.', 'plugin' ), - get_bloginfo( 'version' ), - $plugin_headers['Name'], - $requirements['requires'] - ); - } - - if ( ! empty( $errors ) ) { - $failed_plugins[ $plugin_file ] = ''; - foreach ( $errors as $error ) { - $failed_plugins[ $plugin_file ] .= wp_get_admin_notice( - $error, - array( - 'type' => 'error', - 'dismissible' => true, - ) - ); - } - continue; - } - } - wp_register_plugin_realpath( $plugin ); $_wp_plugin_file = $plugin; @@ -595,20 +512,6 @@ foreach ( wp_get_active_and_valid_plugins() as $plugin ) { } unset( $plugin, $_wp_plugin_file ); -if ( ! empty( $failed_plugins ) ) { - add_action( - 'admin_notices', - function () use ( $failed_plugins ) { - global $pagenow; - - if ( 'index.php' === $pagenow || 'plugins.php' === $pagenow ) { - echo implode( '', $failed_plugins ); - } - } - ); -} -unset( $failed_plugins ); - // Load pluggable functions. require ABSPATH . WPINC . '/pluggable.php'; require ABSPATH . WPINC . '/pluggable-deprecated.php';