Changeset 27673
- Timestamp:
- 03/24/2014 02:59:36 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r27369 r27673 114 114 * @since 3.7.0 115 115 * 116 * @param bool $reply Whether to bail without returning the package. Default is false. 117 * @param string $package The package file name. 118 * @param object $this The WP_Upgrader instance. 116 * @param bool $reply Whether to bail without returning the package. 117 * Default false. 118 * @param string $package The package file name. 119 * @param WP_Upgrader $this The WP_Upgrader instance. 119 120 */ 120 121 $reply = apply_filters( 'upgrader_pre_download', false, $package, $this ); … … 199 200 $this->skin->feedback('installing_package'); 200 201 201 $res = apply_filters('upgrader_pre_install', true, $hook_extra); 202 /** 203 * Filter the install response before the installation has started. 204 * 205 * Returning a truthy value, or one that could be evaluated as a WP_Error 206 * will effectively short-circuit the installation, returning that value 207 * instead. 208 * 209 * @since 2.8.0 210 * 211 * @param bool|WP_Error $response Response. 212 * @param array $hook_extra Extra arguments passed to hooked filters. 213 */ 214 $res = apply_filters( 'upgrader_pre_install', true, $hook_extra ); 202 215 if ( is_wp_error($res) ) 203 216 return $res; … … 218 231 $source = trailingslashit($source); 219 232 220 //Hook ability to change the source file location.. 221 $source = apply_filters('upgrader_source_selection', $source, $remote_source, $this); 233 /** 234 * Filter the source file location for the upgrade package. 235 * 236 * @since 2.8.0 237 * 238 * @param string $source File source location. 239 * @param string $remote_source Remove file source location. 240 * @param WP_Upgrader $this WP_Upgrader instance. 241 */ 242 $source = apply_filters( 'upgrader_source_selection', $source, $remote_source, $this ); 222 243 if ( is_wp_error($source) ) 223 244 return $source; … … 244 265 if ( $wp_filesystem->exists($remote_destination) ) 245 266 $removed = $wp_filesystem->delete($remote_destination, true); 246 $removed = apply_filters('upgrader_clear_destination', $removed, $local_destination, $remote_destination, $hook_extra); 267 268 /** 269 * Filter whether the upgrader cleared the destination. 270 * 271 * @since 2.8.0 272 * 273 * @param bool $removed Whether the destination was cleared. 274 * @param string $local_destination The local package destination. 275 * @param string $remote_destination The remote package destination. 276 * @param array $hook_extra Extra arguments passed to hooked filters. 277 */ 278 $removed = apply_filters( 'upgrader_clear_destination', $removed, $local_destination, $remote_destination, $hook_extra ); 247 279 248 280 if ( is_wp_error($removed) ) … … 283 315 $this->result = compact('local_source', 'source', 'source_name', 'source_files', 'destination', 'destination_name', 'local_destination', 'remote_destination', 'clear_destination', 'delete_source_dir'); 284 316 285 $res = apply_filters('upgrader_post_install', true, $hook_extra, $this->result); 317 /** 318 * Filter the install response after the installation has finished. 319 * 320 * @since 2.8.0 321 * 322 * @param bool $response Install response. 323 * @param array $hook_extra Extra arguments passed to hooked filters. 324 * @param array $result Installation result data. 325 */ 326 $res = apply_filters( 'upgrader_post_install', true, $hook_extra, $this->result ); 327 286 328 if ( is_wp_error($res) ) { 287 329 $this->result = $res; … … 374 416 375 417 if ( ! $is_multi ) { 418 419 /** This action is documented in wp-admin/includes/class-wp-upgrader.php */ 376 420 do_action( 'upgrader_process_complete', $this, $hook_extra ); 377 421 $this->skin->footer(); … … 594 638 $this->maintenance_mode(false); 595 639 640 /** 641 * Fires when the bulk upgrader process is complete. 642 * 643 * @since 3.6.0 644 * 645 * @param Plugin_Upgrader $this Plugin_Upgrader instance. In other contexts, $this, might 646 * be a Theme_Upgrader or Core_Upgrade instance. 647 * @param array $data { 648 * Array of bulk item update data. 649 * 650 * @type string $action Type of action. Default 'update'. 651 * @type string $type Type of update process. Accepts 'plugin', 'theme', or 'core'. 652 * @type bool $bulk Whether the update process is a bulk update. Default true. 653 * @type array $packages Array of plugin, theme, or core packages to update. 654 * } 655 */ 596 656 do_action( 'upgrader_process_complete', $this, array( 597 657 'action' => 'update', … … 977 1037 $this->maintenance_mode(false); 978 1038 1039 /** This action is documented in wp-admin/includes/class-wp-upgrader.php */ 979 1040 do_action( 'upgrader_process_complete', $this, array( 980 1041 'action' => 'update', … … 1347 1408 $partial = false; 1348 1409 1349 // If partial update is returned from the API, use that, unless we're doing a reinstall. 1350 // If we cross the new_bundled version number, then use the new_bundled zip. 1351 // Don't though if the constant is set to skip bundled items. 1352 // If the API returns a no_content zip, go with it. Finally, default to the full zip. 1410 /* 1411 * If partial update is returned from the API, use that, unless we're doing 1412 * a reinstall. If we cross the new_bundled version number, then use 1413 * the new_bundled zip. Don't though if the constant is set to skip bundled items. 1414 * If the API returns a no_content zip, go with it. Finally, default to the full zip. 1415 */ 1353 1416 if ( $parsed_args['do_rollback'] && $current->packages->rollback ) 1354 1417 $to_download = 'rollback'; … … 1404 1467 /** This filter is documented in wp-admin/includes/update-core.php */ 1405 1468 apply_filters( 'update_feedback', $result ); 1469 1406 1470 /** This filter is documented in wp-admin/includes/update-core.php */ 1407 1471 apply_filters( 'update_feedback', $this->strings['start_rollback'] ); … … 1414 1478 } 1415 1479 1480 /** This action is documented in wp-admin/includes/class-wp-upgrader.php */ 1416 1481 do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'core' ) ); 1417 1482 … … 1509 1574 // 3: 3.7-alpha-25000 -> 3.7-alpha-25678 -> 3.7-beta1 -> 3.7-beta2 1510 1575 if ( $current_is_development_version ) { 1576 1577 /** 1578 * Filter whether to enable automatic core updates for development versions. 1579 * 1580 * @since 3.7.0 1581 * 1582 * @param bool $upgrade_dev Whether to enable automatic updates for 1583 * development versions. 1584 */ 1511 1585 if ( ! apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ) ) 1512 1586 return false; … … 1515 1589 1516 1590 // 4: Minor In-branch updates (3.7.0 -> 3.7.1 -> 3.7.2 -> 3.7.4) 1517 if ( $current_branch == $new_branch ) 1591 if ( $current_branch == $new_branch ) { 1592 1593 /** 1594 * Filter whether to enable minor automatic core updates. 1595 * 1596 * @since 3.7.0 1597 * 1598 * @param bool $upgrade_minor Whether to enable minor automatic core updates. 1599 */ 1518 1600 return apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor ); 1601 } 1519 1602 1520 1603 // 5: Major version updates (3.7.0 -> 3.8.0 -> 3.9.1) 1521 if ( version_compare( $new_branch, $current_branch, '>' ) ) 1604 if ( version_compare( $new_branch, $current_branch, '>' ) ) { 1605 1606 /** 1607 * Filter whether to enable major automatic core updates. 1608 * 1609 * @since 3.7.0 1610 * 1611 * @param bool $upgrade_major Whether to enable major automatic core updates. 1612 */ 1522 1613 return apply_filters( 'allow_major_auto_core_updates', $upgrade_major ); 1614 } 1523 1615 1524 1616 // If we're not sure, we don't want it … … 1661 1753 * 1662 1754 * @since 3.7.0 1755 * 1663 1756 * @param bool $disabled Whether the updater should be disabled. 1664 1757 */ … … 1714 1807 1715 1808 /** 1716 * Filter whether the automatic updater should consider a filesystem location to be potentially1717 * managed by a version control system.1809 * Filter whether the automatic updater should consider a filesystem 1810 * location to be potentially managed by a version control system. 1718 1811 * 1719 1812 * @since 3.7.0 1720 1813 * 1721 * @param bool $checkout Whether a VCS checkout was discovered at $context or ABSPATH, or anywhere higher. 1722 * @param string $context The filesystem context (a path) against which filesystem status should be checked. 1814 * @param bool $checkout Whether a VCS checkout was discovered at $context 1815 * or ABSPATH, or anywhere higher. 1816 * @param string $context The filesystem context (a path) against which 1817 * filesystem status should be checked. 1723 1818 */ 1724 1819 return apply_filters( 'automatic_updates_is_vcs_checkout', $checkout, $context ); … … 1730 1825 * @since 3.7.0 1731 1826 * 1732 * @param string $type The type of update being checked: 'core', 'theme', 'plugin', 'translation'. 1827 * @param string $type The type of update being checked: 'core', 'theme', 1828 * 'plugin', 'translation'. 1733 1829 * @param object $item The update offer. 1734 * @param string $context The filesystem context (a path) against which filesystem access and status1735 * should be checked.1830 * @param string $context The filesystem context (a path) against which filesystem 1831 * access and status should be checked. 1736 1832 */ 1737 1833 public function should_update( $type, $item, $context ) { … … 1761 1857 * being checked. Can be 'core', 'theme', 'plugin', or 'translation'. 1762 1858 * 1763 * Generally speaking, plugins, themes, and major core versions are not updated by default, 1764 * while translations and minor and development versions for core are updated by default. 1765 * 1766 * See the filters allow_dev_auto_core_updates, allow_minor_auto_core_updates, and 1767 * allow_major_auto_core_updates more straightforward filters to adjust core updates. 1859 * Generally speaking, plugins, themes, and major core versions are not updated 1860 * by default, while translations and minor and development versions for core 1861 * are updated by default. 1862 * 1863 * See the allow_dev_auto_core_updates, allow_minor_auto_core_updates, and 1864 * allow_major_auto_core_updates filters for a more straightforward way to 1865 * adjust core updates. 1768 1866 * 1769 1867 * @since 3.7.0 … … 1816 1914 1817 1915 /** 1818 * Whether to notify the site administrator of a new core update. 1819 * 1820 * By default, administrators are notified when the update offer received from WordPress.org 1821 * sets a particular flag. This allows for discretion in if and when to notify. 1822 * 1823 * This filter only fires once per release -- if the same email address was already 1824 * notified of the same new version, we won't repeatedly email the administrator. 1825 * 1826 * This filter is also used on about.php to check if a plugin has disabled these notifications. 1916 * Filter whether to notify the site administrator of a new core update. 1917 * 1918 * By default, administrators are notified when the update offer received 1919 * from WordPress.org sets a particular flag. This allows some discretion 1920 * in if and when to notify. 1921 * 1922 * This filter is only evaluated once per release. If the same email address 1923 * was already notified of the same new version, WordPress won't repeatedly 1924 * email the administrator. 1925 * 1926 * This filter is also used on about.php to check if a plugin has disabled 1927 * these notifications. 1827 1928 * 1828 1929 * @since 3.7.0 1829 1930 * 1830 * @param bool $notify Whether the site administrator is notified.1831 * @param object $item The update offer.1931 * @param bool $notify Whether the site administrator is notified. 1932 * @param object $item The update offer. 1832 1933 */ 1833 1934 if ( ! apply_filters( 'send_core_update_notification_email', $notify, $item ) ) … … 2021 2122 if ( ! empty( $this->update_results ) ) { 2022 2123 $development_version = false !== strpos( $wp_version, '-' ); 2124 2023 2125 /** 2024 2126 * Filter whether to send a debugging email for each automatic background update. 2025 2127 * 2026 2128 * @since 3.7.0 2027 * @param bool $development_version By default, emails are sent if the install is a development version. 2129 * 2130 * @param bool $development_version By default, emails are sent if the 2131 * install is a development version. 2028 2132 * Return false to avoid the email. 2029 2133 */ … … 2035 2139 2036 2140 /** 2037 * Action triggeredafter all automatic updates have run.2038 2039 2040 2041 2042 2141 * Fires after all automatic updates have run. 2142 * 2143 * @since 3.8.0 2144 * 2145 * @param array $update_results The results of all attempted updates. 2146 */ 2043 2147 do_action( 'automatic_updates_complete', $this->update_results ); 2044 2148 } … … 2163 2267 * 2164 2268 * @param bool $send Whether to send the email. Default true. 2165 * @param string $type The type of email to send. Can be one of 'success', 'fail', 'critical'. 2269 * @param string $type The type of email to send. Can be one of 2270 * 'success', 'fail', 'critical'. 2166 2271 * @param object $core_update The update offer that was attempted. 2167 2272 * @param mixed $result The result for the core update. Can be WP_Error. … … 2294 2399 2295 2400 $email = compact( 'to', 'subject', 'body', 'headers' ); 2401 2296 2402 /** 2297 2403 * Filter the email sent following an automatic background core update. … … 2302 2408 * Array of email arguments that will be passed to wp_mail(). 2303 2409 * 2304 * @type string $to The email recipient. An array of emails can be returned, as handled by wp_mail(). 2410 * @type string $to The email recipient. An array of emails 2411 * can be returned, as handled by wp_mail(). 2305 2412 * @type string $subject The email's subject. 2306 2413 * @type string $body The email message body. 2307 2414 * @type string $headers Any email headers, defaults to no headers. 2308 2415 * } 2309 * @param string $type The type of email being sent. Can be one of 'success', 'fail', 'manual', 'critical'. 2416 * @param string $type The type of email being sent. Can be one of 2417 * 'success', 'fail', 'manual', 'critical'. 2310 2418 * @param object $core_update The update offer that was attempted. 2311 2419 * @param mixed $result The result for the core update. Can be WP_Error. … … 2444 2552 2445 2553 /** 2446 * Filter the debug email that can be sent following an automatic background core update. 2554 * Filter the debug email that can be sent following an automatic 2555 * background core update. 2447 2556 * 2448 2557 * @since 3.8.0 … … 2451 2560 * Array of email arguments that will be passed to wp_mail(). 2452 2561 * 2453 * @type string $to The email recipient. An array of emails can be returned,2454 * as handled by wp_mail().2562 * @type string $to The email recipient. An array of emails 2563 * can be returned, as handled by wp_mail(). 2455 2564 * @type string $subject Email subject. 2456 2565 * @type string $body Email message body.
Note: See TracChangeset
for help on using the changeset viewer.