WordPress.org

Make WordPress Core

Ticket #11227: #11227.patch

File #11227.patch, 3.2 KB (added by arena, 8 years ago)

patch

  • wp-admin/includes/plugin.php

     
    4343 *              'PluginURI' - Plugin web site address.
    4444 *              'TextDomain' - Plugin's text domain for localization.
    4545 *              'DomainPath' - Plugin's relative directory path to .mo files.
     46 *              'UpgradeCheck' - (optional) Plugin's auto-upgrade check discarded
     47 *              'UpgradeText' - (optional) Plugin's auto-upgrade message when upgradable.
    4648 *
    4749 * Some users have issues with opening large files and manipulating the contents
    4850 * for want is usually the first 1kiB or 2kiB. This function stops pulling in
     
    7577                'Author' => 'Author',
    7678                'AuthorURI' => 'Author URI',
    7779                'TextDomain' => 'Text Domain',
    78                 'DomainPath' => 'Domain Path'
     80                'DomainPath' => 'Domain Path',
     81                'UpgradeCheck' => 'Upgrade Check',
     82                'UpgradeText' => 'Upgrade Text'
    7983                );
    8084
    8185        $plugin_data = get_file_data( $plugin_file, $default_headers, 'plugin' );
  • wp-admin/includes/update.php

     
    185185        echo '<tr class="plugin-update-tr"><td colspan="3" class="plugin-update"><div class="update-message">';
    186186        if ( ! current_user_can('update_plugins') )
    187187                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 );
     188        else if (isset($plugin_data['UpgradeText']) && !empty($plugin_data['UpgradeText']))
     189                printf( __('There is a new version of %1$s available. %2$s'), $plugin_name, $plugin_data['UpgradeText'] );
    188190        else if ( empty($r->package) )
    189191                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 );
    190192        else
  • wp-includes/update.php

     
    120120
    121121        $plugin_changed = false;
    122122        foreach ( $plugins as $file => $p ) {
     123
     124                if (isset($p['UpgradeCheck']) && !empty($p['UpgradeCheck']))
     125                {
     126                        unset($plugins[$file]);
     127                        continue;
     128                }
     129
    123130                $new_option->checked[ $file ] = $p['Version'];
    124131
    125132                if ( !isset( $current->checked[ $file ] ) || strval($current->checked[ $file ]) !== strval($p['Version']) )
     
    139146        if ( $time_not_changed && !$plugin_changed )
    140147                return false;
    141148
     149        if (empty($plugins)) return false;
     150
     151        // active plugins synchronized with plugins ($active clean-up)
     152        $active_flip = array_flip($active);
     153        $active = array();
     154        foreach($plugins as $file => $p) if (isset($active_flip[$file])) $active[] = $file;
     155
    142156        // Update last_checked for current to prevent multiple blocking requests if request hangs
    143157        $current->last_checked = time();
    144158        set_transient( 'update_plugins', $current );