Ticket #25603: 25603.22.diff
File 25603.22.diff, 5.9 KB (added by , 12 years ago) |
---|
-
wp-admin/about.php
52 52 <p><?php _e( 'You’ll still need to click “Update Now” once WordPress 3.8 is released, but we’ve never had more confidence in that beautiful blue button.' ); ?></p> 53 53 </div> 54 54 <?php 55 $can_auto_update = wp_http_supports( 'ssl' ); 55 if ( current_user_can( 'update_core' ) ) { 56 $future_minor_update = (object) array( 57 'current' => $wp_version . '.1.next.minor', 58 'version' => $wp_version . '.1.next.minor', 59 'php_version' => $required_php_version, 60 'mysql_version' => $required_mysql_version, 61 ); 62 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; 63 $updater = new WP_Automatic_Updater; 64 $can_auto_update = wp_http_supports( 'ssl' ) && $updater->should_update( 'core', $future_minor_update, ABSPATH ); 65 56 66 if ( $can_auto_update ) { 57 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; 58 $upgrader = new WP_Automatic_Updater; 59 $future_minor_update = (object) array( 60 'current' => $wp_version . '.1.next.minor', 61 'version' => $wp_version . '.1.next.minor', 62 'php_version' => $required_php_version, 63 'mysql_version' => $required_mysql_version, 64 ); 65 $can_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH ); 67 echo '<p class="about-auto-update cool">' . __( 'This site <strong>is</strong> able to apply these updates automatically. Cool!' ). '</p>'; 68 69 // If the updater is disabled entirely, don't show them anything. 70 } elseif ( ! $updater->is_disabled() ) { 71 echo '<p class="about-auto-update">'; 72 // If this is is filtered to false, they won't get emails, so don't claim we will. 73 // Assumption: If the user can update core, they can see what the admin email is. 74 75 /** This filter is documented in wp-admin/includes/class-wp-upgrader.php */ 76 if ( apply_filters( 'send_core_update_notification_email', true, $future_minor_update ) ) { 77 printf( __( 'This site <strong>is not</strong> able to apply these updates automatically. But we’ll email %s when there is a new security release.' ), esc_html( get_site_option( 'admin_email' ) ) ); 78 } else { 79 _e( 'This site <strong>is not</strong> able to apply these updates automatically.' ); 80 } 81 echo '</p>'; 66 82 } 67 if ( $can_auto_update ) : ?> 68 <p class="about-auto-update cool"><?php _e( 'This site <strong>is</strong> able to apply these updates automatically. Cool!' ); ?></p> 69 <?php else : ?> 70 <p class="about-auto-update"><?php printf( __( 'This site <strong>is not</strong> able to apply these updates automatically. But we’ll email %s when there is a new security release.' ), esc_html( get_site_option( 'admin_email' ) ) ); ?></p> 71 <?php endif; ?> 83 } 84 ?> 72 85 </div> 73 86 </div> 74 87 -
wp-admin/includes/class-wp-upgrader.php
1739 1739 // If we can't do an auto core update, we may still be able to email the user. 1740 1740 if ( ! $skin->request_filesystem_credentials( false, $context ) || $this->is_vcs_checkout( $context ) ) { 1741 1741 if ( 'core' == $type ) 1742 $this-> notify_core_update( $item );1742 $this->send_core_update_notification_email( $item ); 1743 1743 return false; 1744 1744 } 1745 1745 … … 1770 1770 1771 1771 if ( ! $update ) { 1772 1772 if ( 'core' == $type ) 1773 $this-> notify_core_update( $item );1773 $this->send_core_update_notification_email( $item ); 1774 1774 return false; 1775 1775 } 1776 1776 … … 1798 1798 * 1799 1799 * @param object $item The update offer. 1800 1800 */ 1801 protected function notify_core_update( $item ) { 1802 // See if we need to notify users of a core update. 1803 if ( empty( $item->notify_email ) ) 1804 return false; 1805 1801 protected function send_core_update_notification_email( $item ) { 1806 1802 $notify = true; 1807 1803 $notified = get_site_option( 'auto_core_update_notified' ); 1808 1804 … … 1810 1806 if ( $notified && $notified['email'] == get_site_option( 'admin_email' ) && $notified['version'] == $item->current ) 1811 1807 return false; 1812 1808 1809 // See if we need to notify users of a core update. 1810 $notify = ! empty( $item->notify_email ); 1811 1812 /** 1813 * Whether to notify the site administrator of a new core update. 1814 * 1815 * By default, administrators are notified when the update offer received from WordPress.org 1816 * sets a particular flag. This allows for discretion in if and when to notify. 1817 * 1818 * This filter only fires once per release -- if the same email address was already 1819 * notified of the same new version, we won't repeatedly email the administrator. 1820 * 1821 * This filter is also used on about.php to check if a plugin has disabled these notifications. 1822 * 1823 * @since 3.7.0 1824 * 1825 * @param bool $notify Whether the site administrator is notified. 1826 * @param object $item The update offer. 1827 */ 1828 if ( ! apply_filters( 'send_core_update_notification_email', $notify, $item ) ) 1829 return false; 1830 1813 1831 $this->send_email( 'manual', $item ); 1814 1832 return true; 1815 1833 } … … 2127 2145 * @since 3.7.0 2128 2146 * 2129 2147 * @param bool $send Whether to send the email. Default true. 2130 * @param string $type The type of email to send. Can be one of 'success', 'fail', ' manual', 'critical'.2148 * @param string $type The type of email to send. Can be one of 'success', 'fail', 'critical'. 2131 2149 * @param object $core_update The update offer that was attempted. 2132 2150 * @param mixed $result The result for the core update. Can be WP_Error. 2133 2151 */ 2134 if ( ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) )2152 if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) ) 2135 2153 return; 2136 2154 2137 2155 switch ( $type ) {