Make WordPress Core

Ticket #28571: 28571.diff

File 28571.diff, 1.7 KB (added by nacin, 11 years ago)
  • src/wp-admin/includes/class-wp-upgrader.php

     
    11961196
    11971197        public static function async_upgrade( $upgrader = false ) {
    11981198                // Avoid recursion.
    1199                 if ( $upgrader && $upgrader instanceof Language_Pack_Upgrader )
     1199                if ( $upgrader && $upgrader instanceof Language_Pack_Upgrader ) {
    12001200                        return;
     1201                }
    12011202
    12021203                // Nothing to do?
    12031204                $language_updates = wp_get_translation_updates();
    1204                 if ( ! $language_updates )
     1205                if ( ! $language_updates ) {
    12051206                        return;
     1207                }
    12061208
     1209                // Avoid messing with VCS installs, at least for now.
     1210                // Noted: this is not the ideal way to accomplish this.
     1211                $check_vcs = new WP_Automatic_Updater;
     1212                if ( $check_vcs->is_vcs_checkout( WP_CONTENT_DIR ) ) {
     1213                        return;
     1214                }
     1215
     1216                foreach ( $language_updates as $key => $language_update ) {
     1217                        $update = ! empty( $language_update->autoupdate );
     1218
     1219                        /**
     1220                         * Filter whether to asynchronously update translation for core, a plugin, or a theme.
     1221                         *
     1222                         * @since 4.0.0
     1223                         *
     1224                         * @param bool   $update          Whether to update.
     1225                         * @param object $language_update The update offer.
     1226                         */
     1227                        $update = apply_filters( 'async_update_translation', $update, $language_update );
     1228
     1229                        if ( ! $update ) {
     1230                                unset( $language_updates[ $key ] );
     1231                        }
     1232                }
     1233
     1234                if ( empty( $language_updates ) ) {
     1235                        return;
     1236                }
     1237
    12071238                $skin = new Language_Pack_Upgrader_Skin( array(
    12081239                        'skip_header_footer' => true,
    12091240                ) );
    12101241
    12111242                $lp_upgrader = new Language_Pack_Upgrader( $skin );
    1212                 $lp_upgrader->upgrade();
     1243                $lp_upgrader->bulk_upgrade( $language_updates );
    12131244        }
    12141245
    12151246        public function upgrade_strings() {