Ticket #27436: 27436.diff
File 27436.diff, 11.0 KB (added by , 11 years ago) |
---|
-
src/wp-admin/includes/class-wp-upgrader.php
113 113 * 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. Default is false. 117 * @param string $package The package file name. 118 * @param WP_Upgrader $this The WP_Upgrader instance. 119 119 */ 120 120 $reply = apply_filters( 'upgrader_pre_download', false, $package, $this ); 121 121 if ( false !== $reply ) … … 198 198 199 199 $this->skin->feedback('installing_package'); 200 200 201 $res = apply_filters('upgrader_pre_install', true, $hook_extra); 201 /** 202 * Filter install response before the installation has started. 203 * 204 * Returning a value that could be evaluated as a WP_Error will effectively 205 * short-circuit the installation, returning that value instead. 206 * 207 * @since 208 * 209 * @param bool|WP_Error $response Response. 210 * @param array $hook_extra Extra arguments passed to hooked filters. 211 */ 212 $res = apply_filters( 'upgrader_pre_install', true, $hook_extra ); 202 213 if ( is_wp_error($res) ) 203 214 return $res; 204 215 … … 217 228 else //It's only a single file, the upgrader will use the foldername of this file as the destination folder. foldername is based on zip filename. 218 229 $source = trailingslashit($source); 219 230 220 //Hook ability to change the source file location.. 221 $source = apply_filters('upgrader_source_selection', $source, $remote_source, $this); 231 /** 232 * Filter the source file location for the upgrade package. 233 * 234 * @since 235 * 236 * @param string $source File source location. 237 * @param string $remote_source Remove file source location. 238 * @param WP_Upgrader $this WP_Upgrader instance. 239 */ 240 $source = apply_filters( 'upgrader_source_selection', $source, $remote_source, $this ); 222 241 if ( is_wp_error($source) ) 223 242 return $source; 224 243 … … 243 262 $removed = true; 244 263 if ( $wp_filesystem->exists($remote_destination) ) 245 264 $removed = $wp_filesystem->delete($remote_destination, true); 246 $removed = apply_filters('upgrader_clear_destination', $removed, $local_destination, $remote_destination, $hook_extra);247 265 266 /** 267 * Filter whether the upgrader cleared the destination. 268 * 269 * @since 270 * 271 * @param bool $removed Whether the destination was cleared. 272 * @param string $local_destination The local package destination. 273 * @param string $remote_destination The remote package destination. 274 * @param array $hook_extra Extra arguments passed to hooked filters. 275 */ 276 $removed = apply_filters( 'upgrader_clear_destination', $removed, $local_destination, $remote_destination, $hook_extra ); 277 248 278 if ( is_wp_error($removed) ) 249 279 return $removed; 250 280 else if ( ! $removed ) … … 282 312 283 313 $this->result = compact('local_source', 'source', 'source_name', 'source_files', 'destination', 'destination_name', 'local_destination', 'remote_destination', 'clear_destination', 'delete_source_dir'); 284 314 285 $res = apply_filters('upgrader_post_install', true, $hook_extra, $this->result); 315 /** 316 * Filter install response after the installation has finished. 317 * 318 * @since 319 * 320 * @param bool $response Install response. 321 * @param array $hook_extra Extra arguments passed to hooked filters. 322 * @param array $result Installation result data. 323 */ 324 $res = apply_filters( 'upgrader_post_install', true, $hook_extra, $this->result ); 325 286 326 if ( is_wp_error($res) ) { 287 327 $this->result = $res; 288 328 return $res; … … 373 413 $this->skin->after(); 374 414 375 415 if ( ! $is_multi ) { 416 /** This action is documented in wp-admin/includes/class-wp-upgrader.php */ 376 417 do_action( 'upgrader_process_complete', $this, $hook_extra ); 377 418 $this->skin->footer(); 378 419 } … … 593 634 594 635 $this->maintenance_mode(false); 595 636 637 /** 638 * Fires when the bulk plugin upgrader process is complete. 639 * 640 * @since 641 * 642 * @param Plugin_Upgrader $this Plugin_Upgrader instance. 643 * @param array $data { 644 * Array of bulk plugin update data. 645 * 646 * @type string $action Type of action. Default 'update'. 647 * @type string $type Type of update process. Accepts 'plugin', 'theme'. 648 * @type bool $bulk Whether the update process is a bulk update. Default true. 649 * @type array $packages Array of plugins or themes to update. 650 * } 651 */ 596 652 do_action( 'upgrader_process_complete', $this, array( 597 653 'action' => 'update', 598 654 'type' => 'plugin', … … 976 1032 977 1033 $this->maintenance_mode(false); 978 1034 1035 /** This action is documented in wp-admin/includes/class-wp-upgrader.php */ 979 1036 do_action( 'upgrader_process_complete', $this, array( 980 1037 'action' => 'update', 981 1038 'type' => 'theme', … … 1403 1460 if ( $try_rollback ) { 1404 1461 /** This filter is documented in wp-admin/includes/update-core.php */ 1405 1462 apply_filters( 'update_feedback', $result ); 1463 1406 1464 /** This filter is documented in wp-admin/includes/update-core.php */ 1407 1465 apply_filters( 'update_feedback', $this->strings['start_rollback'] ); 1408 1466 … … 1413 1471 } 1414 1472 } 1415 1473 1474 /** This action is documented in wp-admin/includes/class-wp-upgrader.php */ 1416 1475 do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'core' ) ); 1417 1476 1418 1477 // Clear the current updates … … 1508 1567 1509 1568 // 3: 3.7-alpha-25000 -> 3.7-alpha-25678 -> 3.7-beta1 -> 3.7-beta2 1510 1569 if ( $current_is_development_version ) { 1570 1571 /** 1572 * Filter whether to allow automatic core updates for development versions. 1573 * 1574 * @since 1575 * 1576 * @param bool $upgrade_dev Whether to allow automatic updates for development versions. 1577 */ 1511 1578 if ( ! apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ) ) 1512 1579 return false; 1513 1580 // else fall through to minor + major branches below 1514 1581 } 1515 1582 1516 1583 // 4: Minor In-branch updates (3.7.0 -> 3.7.1 -> 3.7.2 -> 3.7.4) 1517 if ( $current_branch == $new_branch ) 1584 if ( $current_branch == $new_branch ) { 1585 1586 /** 1587 * Filter whether to allow automatic minor core updates. 1588 * 1589 * @since 1590 * 1591 * @param bool $upgrade_minor Whether to allow automatic minor core updates. 1592 */ 1518 1593 return apply_filters( 'allow_minor_auto_core_updates', $upgrade_minor ); 1594 } 1519 1595 1520 1596 // 5: Major version updates (3.7.0 -> 3.8.0 -> 3.9.1) 1521 if ( version_compare( $new_branch, $current_branch, '>' ) ) 1597 if ( version_compare( $new_branch, $current_branch, '>' ) ) { 1598 1599 /** 1600 * Filter whether to allow automatic major core updates. 1601 * 1602 * @since 1603 * 1604 * @param bool $upgrade_major Whether to allow automatic major core updates. 1605 */ 1522 1606 return apply_filters( 'allow_major_auto_core_updates', $upgrade_major ); 1607 } 1523 1608 1524 1609 // If we're not sure, we don't want it 1525 1610 return false; … … 1660 1745 * This also disables update notification emails. That may change in the future. 1661 1746 * 1662 1747 * @since 3.7.0 1748 * 1663 1749 * @param bool $disabled Whether the updater should be disabled. 1664 1750 */ 1665 1751 return apply_filters( 'automatic_updater_disabled', $disabled ); … … 1713 1799 } 1714 1800 1715 1801 /** 1716 * Filter whether the automatic updater should consider a filesystem location to be potentially1717 * managed by a version control system.1802 * Filter whether the automatic updater should consider a filesystem 1803 * location to be potentially managed by a version control system. 1718 1804 * 1719 1805 * @since 3.7.0 1720 1806 * 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. 1807 * @param bool $checkout Whether a VCS checkout was discovered at $context 1808 * or ABSPATH, or anywhere higher. 1809 * @param string $context The filesystem context (a path) against which 1810 * filesystem status should be checked. 1723 1811 */ 1724 1812 return apply_filters( 'automatic_updates_is_vcs_checkout', $checkout, $context ); 1725 1813 } … … 1729 1817 * 1730 1818 * @since 3.7.0 1731 1819 * 1732 * @param string $type The type of update being checked: 'core', 'theme', 'plugin', 'translation'. 1820 * @param string $type The type of update being checked: 'core', 'theme', 1821 * 'plugin', 'translation'. 1733 1822 * @param object $item The update offer. 1734 * @param string $context The filesystem context (a path) against which filesystem access and status1735 * should be checked.1823 * @param string $context The filesystem context (a path) against which filesystem 1824 * access and status should be checked. 1736 1825 */ 1737 1826 public function should_update( $type, $item, $context ) { 1738 1827 // Used to see if WP_Filesystem is set up to allow unattended updates. … … 1827 1916 * 1828 1917 * @since 3.7.0 1829 1918 * 1830 * @param bool $notify Whether the site administrator is notified.1831 * @param object $item The update offer.1919 * @param bool $notify Whether the site administrator is notified. 1920 * @param object $item The update offer. 1832 1921 */ 1833 1922 if ( ! apply_filters( 'send_core_update_notification_email', $notify, $item ) ) 1834 1923 return false; … … 2024 2113 * Filter whether to send a debugging email for each automatic background update. 2025 2114 * 2026 2115 * @since 3.7.0 2027 * @param bool $development_version By default, emails are sent if the install is a development version.2028 * Return false to avoid the email.2116 * @param bool $development_version By default, emails are sent if the install is 2117 * a development version. Return false to avoid the email. 2029 2118 */ 2030 2119 if ( apply_filters( 'automatic_updates_send_debug_email', $development_version ) ) 2031 2120 $this->send_debug_email(); … … 2301 2390 * @param array $email { 2302 2391 * Array of email arguments that will be passed to wp_mail(). 2303 2392 * 2304 * @type string $to The email recipient. An array of emails can be returned, as handled by wp_mail(). 2393 * @type string $to The email recipient. An array of emails can be returned, as handled 2394 * by wp_mail(). 2305 2395 * @type string $subject The email's subject. 2306 2396 * @type string $body The email message body. 2307 2397 * @type string $headers Any email headers, defaults to no headers. 2308 2398 * } 2309 * @param string $type The type of email being sent. Can be one of 'success', 'fail', 'manual', 'critical'. 2399 * @param string $type The type of email being sent. Can be one of 'success', 'fail', 2400 * 'manual', 'critical'. 2310 2401 * @param object $core_update The update offer that was attempted. 2311 2402 * @param mixed $result The result for the core update. Can be WP_Error. 2312 2403 */