Changeset 52997
- Timestamp:
- 03/27/2022 02:43:25 PM (3 years ago)
- Location:
- trunk/src/wp-admin/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-plugin-upgrader.php
r52351 r52997 506 506 * @since 4.1.0 Added a return value. 507 507 * 508 * @param bool|WP_Error $re turn Upgrade offer return.509 * @param array $plugin Plugin package arguments.510 * @return bool|WP_Error The passed in $return paramor WP_Error.511 */ 512 public function deactivate_plugin_before_upgrade( $re turn, $plugin ) {513 514 if ( is_wp_error( $re turn) ) { // Bypass.515 return $re turn;508 * @param bool|WP_Error $response The installation response before the installation has started. 509 * @param array $plugin Plugin package arguments. 510 * @return bool|WP_Error The original `$response` parameter or WP_Error. 511 */ 512 public function deactivate_plugin_before_upgrade( $response, $plugin ) { 513 514 if ( is_wp_error( $response ) ) { // Bypass. 515 return $response; 516 516 } 517 517 518 518 // When in cron (background updates) don't deactivate the plugin, as we require a browser to reactivate it. 519 519 if ( wp_doing_cron() ) { 520 return $re turn;520 return $response; 521 521 } 522 522 … … 531 531 } 532 532 533 return $re turn;533 return $response; 534 534 } 535 535 … … 541 541 * @since 5.4.0 542 542 * 543 * @param bool|WP_Error $re turn Upgrade offer return.544 * @param array $plugin Plugin package arguments.545 * @return bool|WP_Error The passed in $return paramor WP_Error.546 */ 547 public function active_before( $re turn, $plugin ) {548 if ( is_wp_error( $re turn) ) {549 return $re turn;543 * @param bool|WP_Error $response The installation response before the installation has started. 544 * @param array $plugin Plugin package arguments. 545 * @return bool|WP_Error The original `$response` parameter or WP_Error. 546 */ 547 public function active_before( $response, $plugin ) { 548 if ( is_wp_error( $response ) ) { 549 return $response; 550 550 } 551 551 552 552 // Only enable maintenance mode when in cron (background update). 553 553 if ( ! wp_doing_cron() ) { 554 return $re turn;554 return $response; 555 555 } 556 556 … … 559 559 // Only run if plugin is active. 560 560 if ( ! is_plugin_active( $plugin ) ) { 561 return $re turn;561 return $response; 562 562 } 563 563 … … 567 567 } 568 568 569 return $re turn;569 return $response; 570 570 } 571 571 … … 577 577 * @since 5.4.0 578 578 * 579 * @param bool|WP_Error $re turn Upgrade offer return.580 * @param array $plugin Plugin package arguments.581 * @return bool|WP_Error The passed in $return paramor WP_Error.582 */ 583 public function active_after( $re turn, $plugin ) {584 if ( is_wp_error( $re turn) ) {585 return $re turn;579 * @param bool|WP_Error $response The installation response after the installation has finished. 580 * @param array $plugin Plugin package arguments. 581 * @return bool|WP_Error The original `$response` parameter or WP_Error. 582 */ 583 public function active_after( $response, $plugin ) { 584 if ( is_wp_error( $response ) ) { 585 return $response; 586 586 } 587 587 588 588 // Only disable maintenance mode when in cron (background update). 589 589 if ( ! wp_doing_cron() ) { 590 return $re turn;590 return $response; 591 591 } 592 592 593 593 $plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : ''; 594 594 595 // Only run if plugin is active 595 // Only run if plugin is active. 596 596 if ( ! is_plugin_active( $plugin ) ) { 597 return $re turn;597 return $response; 598 598 } 599 599 … … 603 603 } 604 604 605 return $re turn;605 return $response; 606 606 } 607 607 -
trunk/src/wp-admin/includes/class-wp-upgrader.php
r52986 r52997 478 478 479 479 /** 480 * Filters the install response before the installation has started.480 * Filters the installation response before the installation has started. 481 481 * 482 482 * Returning a value that could be evaluated as a `WP_Error` will effectively … … 485 485 * @since 2.8.0 486 486 * 487 * @param bool|WP_Error $response Response.487 * @param bool|WP_Error $response Installation response. 488 488 * @param array $hook_extra Extra arguments passed to hooked filters. 489 489 */
Note: See TracChangeset
for help on using the changeset viewer.