Ticket #34676: 34676.4.patch
File 34676.4.patch, 53.6 KB (added by , 5 years ago) |
---|
-
src/js/_enqueues/admin/common.js
diff --git src/js/_enqueues/admin/common.js src/js/_enqueues/admin/common.js index 2fc0c38828..84208a0268 100644
$document.ready( function() { 1569 1569 * notice. Make sure it gets moved just the first time. 1570 1570 */ 1571 1571 if ( ! $progressDiv.hasClass( 'update-details-moved' ) ) { 1572 $progressDiv. insertAfter( $updateNotice ).addClass( 'update-details-moved' );1572 $progressDiv.( $updateNotice ).addClass( 'update-details-moved' ); 1573 1573 } 1574 1574 1575 1575 // Toggle the progress div visibility. -
src/wp-admin/css/common.css
diff --git src/wp-admin/css/common.css src/wp-admin/css/common.css index 868978d55f..e475c0aa54 100644
code { 554 554 margin-left: 0; 555 555 } 556 556 557 558 559 560 561 562 563 564 565 566 567 568 557 569 .no-js .widefat thead .check-column input, 558 570 .no-js .widefat tfoot .check-column input { 559 571 display: none; -
src/wp-admin/includes/class-bulk-plugin-upgrader-skin.php
diff --git src/wp-admin/includes/class-bulk-plugin-upgrader-skin.php src/wp-admin/includes/class-bulk-plugin-upgrader-skin.php index a568d6b107..9e8fe2f69b 100644
class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin { 22 22 parent::add_strings(); 23 23 /* translators: 1: name of plugin being updated, 2: number of updating plugin, 3: total number of plugins being updated */ 24 24 $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)' ); 25 25 26 } 26 27 27 28 /** 28 * @param string $title 29 * Outputs copy before workload output. 30 * 31 * @param string $title Title or string identifier to use. 32 * 33 * @return void 29 34 */ 30 35 public function before( $title = '' ) { 31 parent::before( $this->plugin_info['Title'] ); 36 $title = ( $title === '' ) ? $this->plugin_info['Title'] : $title; 37 parent::before( $title ); 32 38 } 33 39 34 40 /** 35 * @param string $title 41 * Outputs copy after workload output. 42 * 43 * @param string $title Title or string identifier to use. 44 * 45 * @return void 36 46 */ 37 47 public function after( $title = '' ) { 38 parent::after( $this->plugin_info['Title'] ); 48 $title = ( $title === '' ) ? $this->plugin_info['Title'] : $title; 49 parent::after( $title ); 39 50 $this->decrement_update_count( 'plugin' ); 40 51 } 41 52 42 53 /** 54 55 56 43 57 */ 44 58 public function bulk_footer() { 45 59 parent::bulk_footer(); -
src/wp-admin/includes/class-bulk-theme-upgrader-skin.php
diff --git src/wp-admin/includes/class-bulk-theme-upgrader-skin.php src/wp-admin/includes/class-bulk-theme-upgrader-skin.php index ce426e0154..3c4d69ffe6 100644
16 16 * @see Bulk_Upgrader_Skin 17 17 */ 18 18 class Bulk_Theme_Upgrader_Skin extends Bulk_Upgrader_Skin { 19 public $theme_info = array(); // Theme_Upgrader::bulk_upgrade() will fill this in. 19 /** 20 * Theme information, which will be filled by Theme_Upgrader::bulk_upgrade() 21 * @var array 22 */ 23 public $theme_info = array(); 20 24 25 26 27 28 29 21 30 public function add_strings() { 22 31 parent::add_strings(); 23 32 /* translators: 1: name of theme being updated, 2: number of updating themes, 3: total number of themes being updated */ 24 33 $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Theme %1$s (%2$d/%3$d)' ); 34 25 35 } 26 36 27 37 /** 28 * @param string $title 38 * Outputs copy before workload output. 39 * 40 * @param string $title Title or string identifier to use. 41 * 42 * @return void 29 43 */ 30 44 public function before( $title = '' ) { 31 parent::before( $this->theme_info->display( 'Name' ) ); 45 $title = ( $title === '' ) ? $this->theme_info->display( 'Name' ) : $title; 46 parent::before( $title ); 32 47 } 33 48 34 49 /** 35 * @param string $title 50 * Outputs copy after workload output. 51 * 52 * @param string $title Title or string identifier to use. 53 * 54 * @return void 36 55 */ 37 56 public function after( $title = '' ) { 38 parent::after( $this->theme_info->display( 'Name' ) ); 57 $title = ( $title === '' ) ? $this->theme_info->display( 'Name' ) : $title; 58 parent::after( $title ); 39 59 $this->decrement_update_count( 'theme' ); 40 60 } 41 61 42 62 /** 63 64 65 43 66 */ 44 67 public function bulk_footer() { 45 68 parent::bulk_footer(); -
new file src/wp-admin/includes/class-bulk-upgrade-element-base.php
diff --git src/wp-admin/includes/class-bulk-upgrade-element-base.php src/wp-admin/includes/class-bulk-upgrade-element-base.php new file mode 100644 index 0000000000..b950d94c71
- + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 -
new file src/wp-admin/includes/class-bulk-upgrade-repository-element-base.php
diff --git src/wp-admin/includes/class-bulk-upgrade-repository-element-base.php src/wp-admin/includes/class-bulk-upgrade-repository-element-base.php new file mode 100644 index 0000000000..7fe211574c
- + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 -
new file src/wp-admin/includes/class-bulk-upgrader-base.php
diff --git src/wp-admin/includes/class-bulk-upgrader-base.php src/wp-admin/includes/class-bulk-upgrader-base.php new file mode 100644 index 0000000000..266cec600f
- + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 -
src/wp-admin/includes/class-bulk-upgrader-skin.php
diff --git src/wp-admin/includes/class-bulk-upgrader-skin.php src/wp-admin/includes/class-bulk-upgrader-skin.php index c1454e62f1..16028a5f34 100644
16 16 * @see WP_Upgrader_Skin 17 17 */ 18 18 class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { 19 20 21 22 23 19 24 public $in_loop = false; 25 20 26 /** 27 28 21 29 * @var string|false 22 30 */ 23 31 public $error = false; 24 32 25 33 /** 26 * @param array $args 34 * @param array $args 27 35 */ 28 36 public function __construct( $args = array() ) { 29 37 $defaults = array( … … class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { 36 44 } 37 45 38 46 /** 47 48 49 39 50 */ 40 51 public function add_strings() { 41 52 $this->upgrader->strings['skin_upgrade_start'] = __( 'The update process is starting. This process may take a while on some hosts, so please be patient.' ); … … class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { 46 57 /* translators: %s: Title of an update */ 47 58 $this->upgrader->strings['skin_update_successful'] = __( '%s updated successfully.' ); 48 59 $this->upgrader->strings['skin_upgrade_end'] = __( 'All updates have been completed.' ); 60 61 49 62 } 50 63 51 64 /** 52 * @param string $string 65 * Outputs feedback. 66 * 67 * @param string $string Text to show. 68 * 69 * @return void 53 70 */ 54 71 public function feedback( $string ) { 72 73 55 74 if ( isset( $this->upgrader->strings[ $string ] ) ) { 56 75 $string = $this->upgrader->strings[ $string ]; 57 76 } … … class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { 65 84 $string = vsprintf( $string, $args ); 66 85 } 67 86 } 87 68 88 if ( empty( $string ) ) { 69 89 return; 70 90 } 71 if ( $this->in_loop ) { 72 echo "$string<br />\n"; 91 92 if ( $original_string === 'maintenance_start' ) { 93 printf( '<p class="update-maintenance-start"><strong>%s</strong></p><div class="update-maintenance-content">', $string ); 94 } elseif( $original_string === 'maintenance_end' ) { 95 printf( '</div><p class="update-maintenance-end"><strong>%s</strong></p>', $string ); 73 96 } else { 74 echo "<p>$string</p>\n"; 97 if ( $this->in_loop ) { 98 $string = "$string<br/>"; 99 } else { 100 $string = "<p>$string</p>"; 101 } 102 103 echo "$string\n"; 75 104 } 105 106 76 107 } 77 108 78 109 /** 110 111 112 79 113 */ 80 114 public function header() { 81 115 // Nothing, This will be displayed within a iframe. 82 116 } 83 117 84 118 /** 119 120 121 85 122 */ 86 123 public function footer() { 87 124 // Nothing, This will be displayed within a iframe. 88 125 } 89 126 90 127 /** 91 * @param string|WP_Error $error 128 * Showns an error. 129 * 130 * @param string|WP_Error $error Error that will be shown. 92 131 */ 93 132 public function error( $error ) { 94 133 if ( is_string( $error ) && isset( $this->upgrader->strings[ $error ] ) ) { … … class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { 110 149 } 111 150 112 151 /** 152 153 154 113 155 */ 114 156 public function bulk_header() { 115 157 $this->feedback( 'skin_upgrade_start' ); 116 158 } 117 159 118 160 /** 161 162 163 119 164 */ 120 165 public function bulk_footer() { 121 166 $this->feedback( 'skin_upgrade_end' ); 122 167 } 123 168 124 169 /** 125 * @param string $title 170 * Shows an header for an element. 171 * side-effect: Flushes the output buffer 172 * 173 * @param string $title Copy or string identifier to use. 174 * 175 * @return void 126 176 */ 127 177 public function before( $title = '' ) { 128 178 $this->in_loop = true; 129 printf( '<h2>' . $this->upgrader->strings['skin_before_update_header'] . ' <span class="spinner waiting-' . $this->upgrader->update_current . '"></span></h2>', $title, $this->upgrader->update_current, $this->upgrader->update_count ); 130 echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js( $this->upgrader->update_current ) . '\').css("display", "inline-block");</script>'; 179 180 $format = $this->upgrader->strings['skin_before_update_header']; 181 182 $identifier = $this->upgrader->update_current; 183 if ( isset( $this->upgrader->strings[ $title ] ) ) { 184 $identifier = $title; 185 $format = $this->upgrader->strings[ $title ]; 186 } 187 188 printf( 189 '<h2>' . $format . ' <span class="' . esc_attr( 'spinner waiting-' . $identifier ) . '"></span></h2>', 190 $title, 191 $this->upgrader->update_current, 192 $this->upgrader->update_count 193 ); 194 195 echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js( $identifier ) . '\').css("display", "inline-block");</script>'; 131 196 // This progress messages div gets moved via JavaScript when clicking on "Show details.". 132 echo '<div class="update-messages hide-if-js" id=" progress-' . esc_attr( $this->upgrader->update_current) . '"><p>';197 echo '<div class="update-messages hide-if-js" id=" ) . '"><p>'; 133 198 $this->flush_output(); 134 199 } 135 200 136 201 /** 137 * @param string $title 202 * Shows a footer for an element. 203 * side-effect: Flushes the output buffer 204 * 205 * @param string $title Copy or string identifier to use. 206 * 207 * @return void 138 208 */ 139 209 public function after( $title = '' ) { 210 211 212 213 214 215 216 217 218 219 220 221 222 223 140 224 echo '</p></div>'; 225 141 226 if ( $this->error || ! $this->result ) { 142 227 if ( $this->error ) { 143 echo '<div class="error"><p>' . sprintf( $ this->upgrader->strings['skin_update_failed_error'], $title, '<strong>' . $this->error . '</strong>' ) . '</p></div>';228 echo '<div class="error"><p>' . sprintf( $, $title, '<strong>' . $this->error . '</strong>' ) . '</p></div>'; 144 229 } else { 145 echo '<div class="error"><p>' . sprintf( $ this->upgrader->strings['skin_update_failed'], $title ) . '</p></div>';230 echo '<div class="error"><p>' . sprintf( $, $title ) . '</p></div>'; 146 231 } 147 232 148 echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js( $ this->upgrader->update_current) . '\').show();</script>';233 echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js( $ ) . '\').show();</script>'; 149 234 } 235 150 236 if ( $this->result && ! is_wp_error( $this->result ) ) { 151 237 if ( ! $this->error ) { 152 echo '<div class="updated js-update-details" data-update-details=" progress-' . esc_attr( $this->upgrader->update_current) . '">' .153 '<p>' . sprintf( $ this->upgrader->strings['skin_update_successful'], $title ) .238 echo '<div class="updated js-update-details" data-update-details=" ) . '">' . 239 '<p>' . sprintf( $, $title ) . 154 240 ' <button type="button" class="hide-if-no-js button-link js-update-details-toggle" aria-expanded="false">' . __( 'Show details.' ) . '</button>' . 155 241 '</p></div>'; 156 242 } … … class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { 163 249 } 164 250 165 251 /** 252 253 254 166 255 */ 167 256 public function reset() { 168 257 $this->in_loop = false; … … class Bulk_Upgrader_Skin extends WP_Upgrader_Skin { 170 259 } 171 260 172 261 /** 262 263 264 173 265 */ 174 266 public function flush_output() { 175 267 wp_ob_end_flush_all(); -
src/wp-admin/includes/class-core-upgrader.php
diff --git src/wp-admin/includes/class-core-upgrader.php src/wp-admin/includes/class-core-upgrader.php index 977f6ec9c6..e2c2ffdee2 100644
class Core_Upgrader extends WP_Upgrader { 32 32 /* translators: %s: package URL */ 33 33 $this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s…' ), '<span class="code">%s</span>' ); 34 34 $this->strings['unpack_package'] = __( 'Unpacking the update…' ); 35 35 36 $this->strings['copy_failed'] = __( 'Could not copy files.' ); 36 37 $this->strings['copy_failed_space'] = __( 'Could not copy files. You may have run out of disk space.' ); 37 38 $this->strings['start_rollback'] = __( 'Attempting to roll back to previous version.' ); -
new file src/wp-admin/includes/class-plugin-bulk-upgrade-element.php
diff --git src/wp-admin/includes/class-plugin-bulk-upgrade-element.php src/wp-admin/includes/class-plugin-bulk-upgrade-element.php new file mode 100644 index 0000000000..a73d5b549e
- + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 -
new file src/wp-admin/includes/class-plugin-bulk-upgrader.php
diff --git src/wp-admin/includes/class-plugin-bulk-upgrader.php src/wp-admin/includes/class-plugin-bulk-upgrader.php new file mode 100644 index 0000000000..c49acf0650
- + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 -
src/wp-admin/includes/class-plugin-upgrader.php
diff --git src/wp-admin/includes/class-plugin-upgrader.php src/wp-admin/includes/class-plugin-upgrader.php index c80c9c4c97..5811cd0f49 100644
class Plugin_Upgrader extends WP_Upgrader { 49 49 /* translators: %s: package URL */ 50 50 $this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s…' ), '<span class="code">%s</span>' ); 51 51 $this->strings['unpack_package'] = __( 'Unpacking the update…' ); 52 52 53 $this->strings['remove_old'] = __( 'Removing the old version of the plugin…' ); 53 54 $this->strings['remove_old_failed'] = __( 'Could not remove the old plugin.' ); 54 55 $this->strings['process_failed'] = __( 'Plugin update failed.' ); … … class Plugin_Upgrader extends WP_Upgrader { 66 67 /* translators: %s: package URL */ 67 68 $this->strings['downloading_package'] = sprintf( __( 'Downloading installation package from %s…' ), '<span class="code">%s</span>' ); 68 69 $this->strings['unpack_package'] = __( 'Unpacking the package…' ); 70 69 71 $this->strings['installing_package'] = __( 'Installing the plugin…' ); 70 72 $this->strings['no_files'] = __( 'The plugin contains no files.' ); 71 73 $this->strings['process_failed'] = __( 'Plugin installation failed.' ); … … class Plugin_Upgrader extends WP_Upgrader { 228 230 $this->bulk = true; 229 231 $this->upgrade_strings(); 230 232 231 $current = get_site_transient( 'update_plugins' );232 233 233 add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_plugin' ), 10, 4 ); 234 234 235 235 $this->skin->header(); … … class Plugin_Upgrader extends WP_Upgrader { 243 243 244 244 $this->skin->bulk_header(); 245 245 246 /* 247 * Only start maintenance mode if: 248 * - running Multisite and there are one or more plugins specified, OR 249 * - a plugin with an update available is currently active. 250 * @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible. 251 */ 252 $maintenance = ( is_multisite() && ! empty( $plugins ) ); 253 foreach ( $plugins as $plugin ) { 254 $maintenance = $maintenance || ( is_plugin_active( $plugin ) && isset( $current->response[ $plugin ] ) ); 255 } 256 if ( $maintenance ) { 257 $this->maintenance_mode( true ); 258 } 259 260 $results = array(); 261 262 $this->update_count = count( $plugins ); 263 $this->update_current = 0; 264 foreach ( $plugins as $plugin ) { 265 $this->update_current++; 266 $this->skin->plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin, false, true ); 267 268 if ( ! isset( $current->response[ $plugin ] ) ) { 269 $this->skin->set_result( 'up_to_date' ); 270 $this->skin->before(); 271 $this->skin->feedback( 'up_to_date' ); 272 $this->skin->after(); 273 $results[ $plugin ] = true; 274 continue; 275 } 276 277 // Get the URL to the zip file. 278 $r = $current->response[ $plugin ]; 279 280 $this->skin->plugin_active = is_plugin_active( $plugin ); 281 282 $result = $this->run( 283 array( 284 'package' => $r->package, 285 'destination' => WP_PLUGIN_DIR, 286 'clear_destination' => true, 287 'clear_working' => true, 288 'is_multi' => true, 289 'hook_extra' => array( 290 'plugin' => $plugin, 291 ), 292 ) 293 ); 294 295 $results[ $plugin ] = $this->result; 296 297 // Prevent credentials auth screen from displaying multiple times 298 if ( false === $result ) { 299 break; 300 } 301 } //end foreach $plugins 302 303 $this->maintenance_mode( false ); 246 $plugin_bulk_upgrader = new WP_Plugin_Bulk_Upgrader( $this, $plugins ); 247 $results = $plugin_bulk_upgrader->run(); 304 248 305 249 // Force refresh of plugin update information. 306 250 wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); -
new file src/wp-admin/includes/class-theme-bulk-upgrade-element.php
diff --git src/wp-admin/includes/class-theme-bulk-upgrade-element.php src/wp-admin/includes/class-theme-bulk-upgrade-element.php new file mode 100644 index 0000000000..05cab0e440
- + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 -
new file src/wp-admin/includes/class-theme-bulk-upgrader.php
diff --git src/wp-admin/includes/class-theme-bulk-upgrader.php src/wp-admin/includes/class-theme-bulk-upgrader.php new file mode 100644 index 0000000000..de4c95327d
- + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 -
src/wp-admin/includes/class-theme-upgrader.php
diff --git src/wp-admin/includes/class-theme-upgrader.php src/wp-admin/includes/class-theme-upgrader.php index 7b521063f8..497717de97 100644
class Theme_Upgrader extends WP_Upgrader { 48 48 /* translators: %s: package URL */ 49 49 $this->strings['downloading_package'] = sprintf( __( 'Downloading update from %s…' ), '<span class="code">%s</span>' ); 50 50 $this->strings['unpack_package'] = __( 'Unpacking the update…' ); 51 51 52 $this->strings['remove_old'] = __( 'Removing the old version of the theme…' ); 52 53 $this->strings['remove_old_failed'] = __( 'Could not remove the old theme.' ); 53 54 $this->strings['process_failed'] = __( 'Theme update failed.' ); … … class Theme_Upgrader extends WP_Upgrader { 64 65 /* translators: %s: package URL */ 65 66 $this->strings['downloading_package'] = sprintf( __( 'Downloading installation package from %s…' ), '<span class="code">%s</span>' ); 66 67 $this->strings['unpack_package'] = __( 'Unpacking the package…' ); 68 67 69 $this->strings['installing_package'] = __( 'Installing the theme…' ); 68 70 $this->strings['no_files'] = __( 'The theme contains no files.' ); 69 71 $this->strings['process_failed'] = __( 'Theme installation failed.' ); … … class Theme_Upgrader extends WP_Upgrader { 358 360 359 361 $this->skin->bulk_header(); 360 362 361 // Only start maintenance mode if: 362 // - running Multisite and there are one or more themes specified, OR 363 // - a theme with an update available is currently in use. 364 // @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible. 365 $maintenance = ( is_multisite() && ! empty( $themes ) ); 366 foreach ( $themes as $theme ) { 367 $maintenance = $maintenance || $theme == get_stylesheet() || $theme == get_template(); 368 } 369 if ( $maintenance ) { 370 $this->maintenance_mode( true ); 371 } 372 373 $results = array(); 374 375 $this->update_count = count( $themes ); 376 $this->update_current = 0; 377 foreach ( $themes as $theme ) { 378 $this->update_current++; 379 380 $this->skin->theme_info = $this->theme_info( $theme ); 381 382 if ( ! isset( $current->response[ $theme ] ) ) { 383 $this->skin->set_result( true ); 384 $this->skin->before(); 385 $this->skin->feedback( 'up_to_date' ); 386 $this->skin->after(); 387 $results[ $theme ] = true; 388 continue; 389 } 390 391 // Get the URL to the zip file 392 $r = $current->response[ $theme ]; 393 394 $result = $this->run( 395 array( 396 'package' => $r['package'], 397 'destination' => get_theme_root( $theme ), 398 'clear_destination' => true, 399 'clear_working' => true, 400 'is_multi' => true, 401 'hook_extra' => array( 402 'theme' => $theme, 403 ), 404 ) 405 ); 406 407 $results[ $theme ] = $this->result; 408 409 // Prevent credentials auth screen from displaying multiple times 410 if ( false === $result ) { 411 break; 412 } 413 } //end foreach $plugins 414 415 $this->maintenance_mode( false ); 363 $theme_bulk_upgrader = new WP_Theme_Bulk_Upgrader( $this, $themes ); 364 $results = $theme_bulk_upgrader->run(); 416 365 417 366 // Refresh the Theme Update information 418 367 wp_clean_themes_cache( $parsed_args['clear_update_cache'] ); -
new file src/wp-admin/includes/class-wp-upgrader-bulk.php
diff --git src/wp-admin/includes/class-wp-upgrader-bulk.php src/wp-admin/includes/class-wp-upgrader-bulk.php new file mode 100644 index 0000000000..6e1c43828c
- + 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 -
src/wp-admin/includes/class-wp-upgrader-skin.php
diff --git src/wp-admin/includes/class-wp-upgrader-skin.php src/wp-admin/includes/class-wp-upgrader-skin.php index ddcfd19f18..5b110fb0ff 100644
15 15 */ 16 16 class WP_Upgrader_Skin { 17 17 18 19 20 21 22 18 23 public $upgrader; 19 24 public $done_header = false; 20 25 public $done_footer = false; … … class WP_Upgrader_Skin { 42 47 } 43 48 44 49 /** 45 * @param WP_Upgrader $upgrader 50 * Sets the upgrader to use internally. 51 * 52 * @param WP_Upgrader $upgrader Upgrader to use. 46 53 */ 47 54 public function set_upgrader( &$upgrader ) { 48 55 if ( is_object( $upgrader ) ) { -
src/wp-admin/includes/class-wp-upgrader.php
diff --git src/wp-admin/includes/class-wp-upgrader.php src/wp-admin/includes/class-wp-upgrader.php index b8258d4bc2..1737f46849 100644
9 9 * @since 2.8.0 10 10 */ 11 11 12 13 14 12 15 /** WP_Upgrader_Skin class */ 13 16 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader-skin.php'; 14 17 … … class WP_Upgrader { 64 67 * @since 2.8.0 65 68 * @var Automatic_Upgrader_Skin|WP_Upgrader_Skin $skin 66 69 */ 67 public $skin = null;70 public $skin; 68 71 69 72 /** 70 73 * The result of the installation. … … class WP_Upgrader { 120 123 * instance. 121 124 */ 122 125 public function __construct( $skin = null ) { 123 if ( null == $skin) {126 if ( ) { 124 127 $this->skin = new WP_Upgrader_Skin(); 125 128 } else { 126 129 $this->skin = $skin; … … class WP_Upgrader { 300 303 public function unpack_package( $package, $delete_package = true ) { 301 304 global $wp_filesystem; 302 305 303 $this->skin->feedback( 'unpack_package' ); 306 if ( $this->update_count > 1 ) { 307 $this->skin->feedback( 'unpack_package_bulk', $this->update_current, $this->update_count ); 308 } else { 309 $this->skin->feedback( 'unpack_package' ); 310 } 304 311 305 312 $upgrade_folder = $wp_filesystem->wp_content_dir() . 'upgrade/'; 306 313 307 //Clean up contents of upgrade directory beforehand.308 $upgrade_files = $wp_filesystem->dirlist( $upgrade_folder );309 if ( ! empty( $upgrade_files ) ) {310 foreach ( $upgrade_files as $file ) {311 $wp_filesystem->delete( $upgrade_folder . $file['name'], true );312 }313 }314 315 314 // We need a working directory - Strip off any .tmp or .zip suffixes 316 315 $working_dir = $upgrade_folder . basename( basename( $package, '.tmp' ), '.zip' ); 317 316 … … class WP_Upgrader { 702 701 */ 703 702 $options = apply_filters( 'upgrader_package_options', $options ); 704 703 705 if ( ! $options['is_multi'] ) { // call $this->header separately if running multiple times 706 $this->skin->header(); 707 } 704 $this->skin->header(); 708 705 709 706 // Connect to the Filesystem first. 710 707 $res = $this->fs_connect( array( WP_CONTENT_DIR, $options['destination'] ) ); … … class WP_Upgrader { 727 724 return $res; 728 725 } 729 726 727 728 730 729 /* 731 730 * Download the package (Note, This just returns the filename 732 731 * of the file if the package is a local file) … … class WP_Upgrader { 925 924 return delete_option( $lock_name . '.lock' ); 926 925 } 927 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 928 960 } 929 961 930 962 /** Plugin_Upgrader class */