diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php
index 05fee27fa0..b633a660c2 100644
--- a/wp-admin/includes/plugin-install.php
+++ b/wp-admin/includes/plugin-install.php
@@ -425,8 +425,23 @@ function install_plugin_information() {
break;
}
}
- if ( 'install' == $type && file_exists( WP_PLUGIN_DIR . '/' . $api->slug ) ) //TODO: Make more.. searchable?
- $type = 'latest_installed';
+ if ( 'install' == $type && is_dir( WP_PLUGIN_DIR . '/' . $api->slug ) ) {
+ $installed_plugin = get_plugins('/' . $api->slug);
+ if ( ! empty($installed_plugin) ) {
+ $key = array_shift( $key = array_keys($installed_plugin) ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
+ if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '>') ){
+ $type = 'latest_installed';
+ } elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) {
+ $type = 'newer_installed';
+ $newer_version = $installed_plugin[ $key ]['Version'];
+ } else {
+ //If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh
+ delete_option('update_plugins');
+ $update_file = $api->slug . '/' . $key; //This code branch only deals with a plugin which is in a folder the same name as its slug, Doesnt support plugins which have 'non-standard' names
+ $type = 'update_available';
+ }
+ }
+ }
switch ( $type ) :
default:
@@ -440,6 +455,11 @@ function install_plugin_information() {
?>