Changeset 58139
- Timestamp:
- 05/13/2024 03:22:07 PM (6 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-automatic-updater.php
r58128 r58139 447 447 } 448 448 449 $is_debug = WP_DEBUG && WP_DEBUG_LOG; 449 450 if ( 'plugin' === $type ) { 450 451 $was_active = is_plugin_active( $upgrader_item ); 451 error_log( ' Upgrading plugin ' . var_export( $item->slug, true ) . '...' ); 452 } 453 454 if ( 'theme' === $type ) { 452 if ( $is_debug ) { 453 error_log( ' Upgrading plugin ' . var_export( $item->slug, true ) . '...' ); 454 } 455 } 456 457 if ( 'theme' === $type && $is_debug ) { 455 458 error_log( ' Upgrading theme ' . var_export( $item->theme, true ) . '...' ); 456 459 } … … 521 524 } 522 525 523 if ( 'theme' === $type ) { 526 $is_debug = WP_DEBUG && WP_DEBUG_LOG; 527 528 if ( 'theme' === $type && $is_debug ) { 524 529 error_log( ' Theme ' . var_export( $item->theme, true ) . ' has been upgraded.' ); 525 530 } 526 531 527 532 if ( 'plugin' === $type ) { 528 error_log( ' Plugin ' . var_export( $item->slug, true ) . ' has been upgraded.' ); 529 if ( is_plugin_inactive( $upgrader_item ) ) { 530 error_log( ' ' . var_export( $upgrader_item, true ) . ' is inactive and will not be checked for fatal errors.' ); 533 if ( $is_debug ) { 534 error_log( ' Plugin ' . var_export( $item->slug, true ) . ' has been upgraded.' ); 535 if ( is_plugin_inactive( $upgrader_item ) ) { 536 error_log( ' ' . var_export( $upgrader_item, true ) . ' is inactive and will not be checked for fatal errors.' ); 537 } 531 538 } 532 539 … … 597 604 * appear above this entry in the log file. 598 605 */ 599 error_log( ' ' . implode( "\n", $upgrade_result->get_error_messages() ) ); 600 } else { 606 if ( $is_debug ) { 607 error_log( ' ' . implode( "\n", $upgrade_result->get_error_messages() ) ); 608 } 609 } elseif ( $is_debug ) { 601 610 error_log( ' The update for ' . var_export( $item->slug, true ) . ' has no fatal errors.' ); 602 611 } … … 635 644 } 636 645 637 error_log( 'Automatic updates starting...' ); 646 $is_debug = WP_DEBUG && WP_DEBUG_DISPLAY; 647 648 if ( $is_debug ) { 649 error_log( 'Automatic updates starting...' ); 650 } 638 651 639 652 // Don't automatically run these things, as we'll handle it ourselves. … … 647 660 $plugin_updates = get_site_transient( 'update_plugins' ); 648 661 if ( $plugin_updates && ! empty( $plugin_updates->response ) ) { 649 error_log( ' Automatic plugin updates starting...' ); 662 if ( $is_debug ) { 663 error_log( ' Automatic plugin updates starting...' ); 664 } 650 665 651 666 foreach ( $plugin_updates->response as $plugin ) { … … 656 671 wp_clean_plugins_cache(); 657 672 658 error_log( ' Automatic plugin updates complete.' ); 673 if ( $is_debug ) { 674 error_log( ' Automatic plugin updates complete.' ); 675 } 659 676 } 660 677 … … 663 680 $theme_updates = get_site_transient( 'update_themes' ); 664 681 if ( $theme_updates && ! empty( $theme_updates->response ) ) { 665 error_log( ' Automatic theme updates starting...' ); 682 if ( $is_debug ) { 683 error_log( ' Automatic theme updates starting...' ); 684 } 666 685 667 686 foreach ( $theme_updates->response as $theme ) { … … 671 690 wp_clean_themes_cache(); 672 691 673 error_log( ' Automatic theme updates complete.' ); 674 } 675 676 error_log( 'Automatic updates complete.' ); 692 if ( $is_debug ) { 693 error_log( ' Automatic theme updates complete.' ); 694 } 695 } 696 697 if ( $is_debug ) { 698 error_log( 'Automatic updates complete.' ); 699 } 677 700 678 701 // Next, process any core update. … … 1735 1758 $timeout = 50; // 50 seconds. 1736 1759 1737 error_log( ' Scraping home page...' ); 1760 $is_debug = WP_DEBUG && WP_DEBUG_DISPLAY; 1761 if ( $is_debug ) { 1762 error_log( ' Scraping home page...' ); 1763 } 1738 1764 1739 1765 $needle_start = "###### wp_scraping_result_start:$scrape_key ######"; … … 1743 1769 1744 1770 if ( is_wp_error( $response ) ) { 1745 error_log( 'Loopback request failed: ' . $response->get_error_message() ); 1771 if ( $is_debug ) { 1772 error_log( 'Loopback request failed: ' . $response->get_error_message() ); 1773 } 1746 1774 return true; 1747 1775 } 1748 1776 1749 1777 // If this outputs `true` in the log, it means there were no fatal errors detected. 1750 error_log( var_export( substr( $response['body'], strpos( $response['body'], '###### wp_scraping_result_start:' ) ), true ) ); 1778 if ( $is_debug ) { 1779 error_log( var_export( substr( $response['body'], strpos( $response['body'], '###### wp_scraping_result_start:' ) ), true ) ); 1780 } 1751 1781 1752 1782 $body = wp_remote_retrieve_body( $response );
Note: See TracChangeset
for help on using the changeset viewer.