- Timestamp:
- 07/13/2020 01:33:32 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-plugin-installer-skin.php
r48453 r48455 187 187 188 188 $current_plugin_data = false; 189 foreach ( get_plugins() as $plugin => $plugin_data ) { 189 $all_plugins = get_plugins(); 190 191 foreach ( $all_plugins as $plugin => $plugin_data ) { 190 192 if ( strrpos( $plugin, $folder ) !== 0 ) { 191 193 continue; … … 195 197 } 196 198 197 if ( empty( $current_plugin_data ) || empty( $this->upgrader->new_plugin_data ) ) { 199 $new_plugin_data = $this->upgrader->new_plugin_data; 200 201 if ( ! $current_plugin_data || ! $new_plugin_data ) { 198 202 return false; 199 203 } … … 201 205 echo '<h2 class="update-from-upload-heading">' . esc_html( __( 'This plugin is already installed.' ) ) . '</h2>'; 202 206 203 $this->is_downgrading = version_compare( $current_plugin_data['Version'], $ this->upgrader->new_plugin_data['Version'], '>' );207 $this->is_downgrading = version_compare( $current_plugin_data['Version'], $new_plugin_data['Version'], '>' ); 204 208 205 209 $rows = array( … … 219 223 foreach ( $rows as $field => $label ) { 220 224 $old_value = ! empty( $current_plugin_data[ $field ] ) ? (string) $current_plugin_data[ $field ] : '-'; 221 $new_value = ! empty( $ this->upgrader->new_plugin_data[ $field ] ) ? (string) $this->upgrader->new_plugin_data[ $field ] : '-';225 $new_value = ! empty( $new_plugin_data[ $field ] ) ? (string) $new_plugin_data[ $field ] : '-'; 222 226 223 227 $is_same_plugin = $is_same_plugin && ( $old_value === $new_value ); … … 242 246 * @param array $new_plugin_data Array with uploaded plugin data. 243 247 */ 244 echo apply_filters( 'install_plugin_ovewrite_comparison', $table, $current_plugin_data, $ this->upgrader->new_plugin_data );248 echo apply_filters( 'install_plugin_ovewrite_comparison', $table, $current_plugin_data, $new_plugin_data ); 245 249 246 250 $install_actions = array(); … … 250 254 $blocked_message .= '<ul class="ul-disc">'; 251 255 252 if ( ! empty( $this->upgrader->new_plugin_data['RequiresPHP'] ) 253 && ! is_php_version_compatible( $this->upgrader->new_plugin_data['RequiresPHP'] ) 254 ) { 256 $requires_php = isset( $new_plugin_data['RequiresPHP'] ) ? $new_plugin_data['RequiresPHP'] : null; 257 $requires_wp = isset( $new_plugin_data['RequiresWP'] ) ? $new_plugin_data['RequiresWP'] : null; 258 259 if ( ! is_php_version_compatible( $requires_php ) ) { 255 260 $error = sprintf( 256 261 /* translators: 1: Current PHP version, 2: Version required by the uploaded plugin. */ 257 262 __( 'The PHP version on your server is %1$s, however the uploaded plugin requires %2$s.' ), 258 263 phpversion(), 259 $ this->upgrader->new_plugin_data['RequiresPHP']264 $requires_php 260 265 ); 261 266 … … 264 269 } 265 270 266 if ( ! empty( $this->upgrader->new_plugin_data['RequiresWP'] ) 267 && ! is_wp_version_compatible( $this->upgrader->new_plugin_data['RequiresWP'] ) 268 ) { 271 if ( ! is_wp_version_compatible( $requires_wp ) ) { 269 272 $error = sprintf( 270 273 /* translators: 1: Current WordPress version, 2: Version required by the uploaded plugin. */ 271 274 __( 'Your WordPress version is %1$s, however the uploaded plugin requires %2$s.' ), 272 $GLOBALS['wp_version'],273 $ this->upgrader->new_plugin_data['RequiresWP']275 get_bloginfo( 'version' ), 276 $requires_wp 274 277 ); 275 278 … … 325 328 * @param array $new_plugin_data Array with uploaded plugin data. 326 329 */ 327 $install_actions = apply_filters( 'install_plugin_ovewrite_actions', $install_actions, $this->api, $ this->upgrader->new_plugin_data );330 $install_actions = apply_filters( 'install_plugin_ovewrite_actions', $install_actions, $this->api, $new_plugin_data ); 328 331 329 332 if ( ! empty( $install_actions ) ) {
Note: See TracChangeset
for help on using the changeset viewer.