Make WordPress Core

Ticket #12260: patch.diff

File patch.diff, 2.1 KB (added by petervanderdoes, 14 years ago)

The patch required in teh core. the $r->required_php is made up of course.

  • wp-admin/includes/update.php

     
    171171add_action( 'admin_init', 'wp_plugin_update_rows' );
    172172
    173173function wp_plugin_update_row( $file, $plugin_data ) {
     174
    174175        $current = get_transient( 'update_plugins' );
    175176        if ( !isset( $current->response[ $file ] ) )
    176177                return false;
    177178
    178179        $r = $current->response[ $file ];
     180        $php_version = phpversion();
     181        $php_compat = version_compare( $php_version, $r->required_php, '>=' );
    179182
    180183        $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
    181184        $plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags );
     
    187190                printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s Details</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
    188191        else if ( empty($r->package) )
    189192                printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s Details</a> <em>automatic upgrade unavailable for this plugin</em>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version );
     193        else if (!$php_compat)
     194                printf( __('There is a new version of %1$s available. You cannot upgrade because the upgrade requires PHP version %2$s or higher. You are running version %3$s. <a href="%4$s" class="thickbox" title="53$s">View version %6$s Details</a>.'), $plugin_name, $r->php, $php_version, esc_url($details_url), esc_attr($plugin_name), $r->new_version) ;
    190195        else
    191196                printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s Details</a> or <a href="%5$s">upgrade automatically</a>.'), $plugin_name, esc_url($details_url), esc_attr($plugin_name), $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&plugin=' . $file, 'upgrade-plugin_' . $file) );
    192197