Make WordPress Core

Ticket #28660: update-service.diff

File update-service.diff, 1.9 KB (added by DavidAnderson, 11 years ago)

Implements "Update Service" header (default: wordpressorg) and omits plugins where this is set to something other than wordpressorg from the API call to api.wordpress.org (see discussion in #23318 for rationale)

  • wp-admin/includes/plugin.php

     
    4747 *              'TextDomain' - Plugin's text domain for localization.
    4848 *              'DomainPath' - Plugin's relative directory path to .mo files.
    4949 *              'Network' - Boolean. Whether the plugin can only be activated network wide.
     50 *              'UpdateService' - String. Indicates which update service should be used to obtain plugin information. Defaults to wordpressorg (which is the only one handled natively by WordPress core).
    5051 *
    5152 * Some users have issues with opening large files and manipulating the contents
    5253 * for want is usually the first 1kiB or 2kiB. This function stops pulling in
     
    8182                'TextDomain' => 'Text Domain',
    8283                'DomainPath' => 'Domain Path',
    8384                'Network' => 'Network',
     85                'UpdateService' => 'Update Service',
    8486                // Site Wide Only is deprecated in favor of Network.
    8587                '_sitewide' => 'Site Wide Only',
    8688        );
     
    9395                $plugin_data['Network'] = $plugin_data['_sitewide'];
    9496        }
    9597        $plugin_data['Network'] = ( 'true' == strtolower( $plugin_data['Network'] ) );
     98        if ( empty( $plugin_data['UpdateService'] ) )
     99                $plugin_data['UpdateService'] = 'wordpressorg';
    96100        unset( $plugin_data['_sitewide'] );
    97101
    98102        if ( $markup || $translate ) {
  • wp-includes/update.php

     
    228228        if ( $time_not_changed && ! $extra_stats ) {
    229229                $plugin_changed = false;
    230230                foreach ( $plugins as $file => $p ) {
     231                        if ( 'wordpressorg' != $p['UpdateService'] ) {
     232                                unset( $plugins[ $file ] );
     233                                continue;
     234                        }
     235
    231236                        $new_option->checked[ $file ] = $p['Version'];
    232237
    233238                        if ( !isset( $current->checked[ $file ] ) || strval($current->checked[ $file ]) !== strval($p['Version']) )