Changeset 30758
- Timestamp:
- 12/07/2014 12:25:44 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r30703 r30758 22 22 */ 23 23 class WP_Upgrader { 24 25 /** 26 * The error/notification strings used to update the user on the progress. 27 * 28 * @since 2.8.0 29 * @var string $strings 30 */ 24 31 public $strings = array(); 32 33 /** 34 * The upgrader skin being used. 35 * 36 * @since 2.8.0 37 * @var WP_Upgrader_Skin $skin 38 */ 25 39 public $skin = null; 40 41 /** 42 * The result of the installation. 43 * 44 * This is set by {@see WP_Upgrader::install_package()}, only when the package is installed 45 * successfully. It will then be an array, unless a {@see WP_Error} is returned by the 46 * {@see 'upgrader_post_install'} filter. In that case, the `WP_Error` will be assigned to 47 * it. 48 * 49 * @since 2.8.0 50 * @var WP_Error|array $result { 51 * @type string $source The full path to the source the files were installed from. 52 * @type string $source_files List of all the files in the source directory. 53 * @type string $destination The full path to the install destination folder. 54 * @type string $destination_name The name of the destination folder, or empty if `$destination` 55 * and `$local_destination` are the same. 56 * @type string $local_destination The full local path to the destination folder. This is usually 57 * the same as `$destination`. 58 * @type string $remote_destination The full remote path to the destination folder 59 * (i.e., from `$wp_filesystem`). 60 * @type bool $clear_destination Whether the destination folder was cleared. 61 * } 62 */ 26 63 public $result = array(); 64 65 /** 66 * The total number of updates being performed. 67 * 68 * Set by the bulk update methods. 69 * 70 * @since 3.0.0 71 * @var int $update_count 72 */ 27 73 public $update_count = 0; 74 75 /** 76 * The current update if multiple updates are being performed. 77 * 78 * Used by the bulk update methods, and incremented for each update. 79 * 80 * @since 3.0.0 81 * @var int 82 */ 28 83 public $update_current = 0; 29 84 30 public function __construct($skin = null) { 85 /** 86 * Construct the upgrader with a skin. 87 * 88 * @since 2.8.0 89 * 90 * @param WP_Upgrader_Skin $skin The upgrader skin to use. Default is a {@see WP_Upgrader_Skin} 91 * instance. 92 */ 93 public function __construct( $skin = null ) { 31 94 if ( null == $skin ) 32 95 $this->skin = new WP_Upgrader_Skin(); … … 35 98 } 36 99 100 /** 101 * Initialize the upgrader. 102 * 103 * This will set the relationship between the skin being used and this upgrader, 104 * and also add the generic strings to `WP_Upgrader::$strings`. 105 * 106 * @since 2.8.0 107 */ 37 108 public function init() { 38 109 $this->skin->set_upgrader($this); … … 40 111 } 41 112 113 /** 114 * Add the generic strings to WP_Upgrader::$strings. 115 * 116 * @since 2.8.0 117 */ 42 118 public function generic_strings() { 43 119 $this->strings['bad_request'] = __('Invalid Data provided.'); … … 62 138 } 63 139 140 /** 141 * Connect to the filesystem. 142 * 143 * @since 2.8.0 144 * 145 * @param array $directories Optional. A list of directories. If any of these do 146 * not exist, a {@see WP_Error} object will be returned. 147 * Default empty array. 148 * @param bool $allow_relaxed_file_ownership Whether to allow relaxed file ownership. 149 * Default false. 150 * @return bool|WP_Error True if able to connect, false or a {@see WP_Error} otherwise. 151 */ 64 152 public function fs_connect( $directories = array(), $allow_relaxed_file_ownership = false ) { 65 153 global $wp_filesystem; … … 111 199 } //end fs_connect(); 112 200 113 public function download_package($package) { 201 /** 202 * Download a package. 203 * 204 * @since 2.8.0 205 * 206 * @param string $package The URI of the package. If this is the full path to an 207 * existing local file, it will be returned untouched. 208 * @return string|WP_Error The full path to the downloaded package file, or a {@see WP_Error} object. 209 */ 210 public function download_package( $package ) { 114 211 115 212 /** … … 143 240 } 144 241 145 public function unpack_package($package, $delete_package = true) { 242 /** 243 * Unpack a compressed package file. 244 * 245 * @since 2.8.0 246 * 247 * @param string $package Full path to the package file. 248 * @param bool $delete_package Optional. Whether to delete the package file after attempting 249 * to unpack it. Default true. 250 * @return string|WP_Error The path to the unpacked contents, or a {@see WP_Error} on failure. 251 */ 252 public function unpack_package( $package, $delete_package = true ) { 146 253 global $wp_filesystem; 147 254 … … 182 289 } 183 290 291 /** 292 * Install a package. 293 * 294 * Copies the contents of a package form a source directory, and installs them in 295 * a destination directory. Optionally removes the source. It can also optionally 296 * clear out the destination folder if it already exists. 297 * 298 * @since 2.8.0 299 * 300 * @param array|string $args { 301 * Optional. Array or string of arguments for installing a package. Default empty array. 302 * 303 * @type string $source Required path to the package source. Default empty. 304 * @type string $destination Required path to a folder to install the package in. 305 * Default empty. 306 * @type bool $clear_destination Whether to delete any files already in the destination 307 * folder. Default false. 308 * @type bool $clear_working Whether to delete the files form the working directory 309 * after copying to the destination. Default false. 310 * @type bool $abort_if_destination_exists Whether to abort the installation if 311 * the destination folder already exists. Default true. 312 * @type array $hook_extra Extra arguments to pass to the filter hooks called by 313 * {@see WP_Upgrader::install_package()}. Default empty array. 314 * } 315 * 316 * @return array|WP_Error The result (also stored in `WP_Upgrader:$result`), or a {@see WP_Error} on failure. 317 */ 184 318 public function install_package( $args = array() ) { 185 319 global $wp_filesystem, $wp_theme_directories; … … 358 492 } 359 493 494 /** 495 * Run an upgrade/install. 496 * 497 * Attempts to download the package (if it is not a local file), unpack it, and 498 * install it in the destination folder. 499 * 500 * @since 2.8.0 501 * 502 * @param array $options { 503 * Array or string of arguments for upgrading/installing a package. 504 * 505 * @type string $package The full path or URI of the package to install. 506 * Default empty. 507 * @type string $destination The full path to the destination folder. 508 * Default empty. 509 * @type bool $clear_destination Whether to delete any files already in the 510 * destination folder. Default false. 511 * @type bool $clear_working Whether to delete the files form the working 512 * directory after copying to the destination. 513 * Default false. 514 * @type bool $abort_if_destination_exists Whether to abort the installation if the destination 515 * folder already exists. When true, `$clear_destination` 516 * should be false. Default true. 517 * @type bool $is_multi Whether this run is one of multiple upgrade/install 518 * actions being performed in bulk. When true, the skin 519 * {@see WP_Upgrader::header()} and {@see WP_Upgrader::footer()} 520 * aren't called. Default false. 521 * @type array $hook_extra Extra arguments to pass to the filter hooks called by 522 * {@see WP_Upgrader::run()}. 523 * } 524 * 525 * @return array|false|WP_error The result from self::install_package() on success, otherwise a WP_Error, 526 * or false if unable to connect to the filesystem. 527 */ 360 528 public function run( $options ) { 361 529 … … 452 620 } 453 621 454 public function maintenance_mode($enable = false) { 622 /** 623 * Toggle maintenance mode for the site. 624 * 625 * Creates/deletes the maintenance file to enable/disable maintenance mode. 626 * 627 * @since 2.8.0 628 * 629 * @param bool $enable True to enable maintenance mode, false to disable. 630 */ 631 public function maintenance_mode( $enable = false ) { 455 632 global $wp_filesystem; 456 633 $file = $wp_filesystem->abspath() . '.maintenance'; … … 478 655 class Plugin_Upgrader extends WP_Upgrader { 479 656 657 /** 658 * Plugin upgrade result. 659 * 660 * @since 2.8.0 661 * @var array|WP_Error $result 662 * @see WP_Upgrader::$result 663 */ 480 664 public $result; 665 666 /** 667 * Whether a bulk upgrade/install is being performed. 668 * 669 * @since 2.9.0 670 * @var bool $bulk 671 */ 481 672 public $bulk = false; 482 673 674 /** 675 * Initialize the upgrade strings. 676 * 677 * @since 2.8.0 678 */ 483 679 public function upgrade_strings() { 484 680 $this->strings['up_to_date'] = __('The plugin is at the latest version.'); … … 492 688 } 493 689 690 /** 691 * Initialize the install strings. 692 * 693 * @since 2.8.0 694 */ 494 695 public function install_strings() { 495 696 $this->strings['no_package'] = __('Install package not available.'); … … 502 703 } 503 704 705 /** 706 * Install a plugin package. 707 * 708 * @since 2.8.0 709 * @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional. 710 * 711 * @param string $package The full local path or URI of the package. 712 * @param array $args { 713 * Optional. Other arguments for installing a plugin package. Default empty array. 714 * 715 * @type bool $clear_update_cache Whether to clear the plugin updates cache if successful. 716 * Default true. 717 * } 718 * 719 * @return bool|WP_Error True if the install was successful, false or a WP_Error otherwise. 720 */ 504 721 public function install( $package, $args = array() ) { 505 722 … … 536 753 } 537 754 755 /** 756 * Upgrade a plugin. 757 * 758 * @since 2.8.0 759 * @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional. 760 * 761 * @param string $plugin The basename path to the main plugin file. 762 * @param array $args { 763 * Optional. Other arguments for upgrading a plugin package. Defualt empty array. 764 * 765 * @type bool $clear_update_cache Whether to clear the plugin updates cache if successful. 766 * Default true. 767 * } 768 * @return bool|WP_Error True if the upgrade was successful, false or a {@see WP_Error} object otherwise. 769 */ 538 770 public function upgrade( $plugin, $args = array() ) { 539 771 … … 587 819 } 588 820 821 /** 822 * Bulk upgrade several plugins at once. 823 * 824 * @since 2.8.0 825 * @since 3.7.0 The `$args` parameter was added, making clearing the plugin update cache optional. 826 * 827 * @param string $plugins Array of the basename paths of the plugins' main files. 828 * @param array $args { 829 * Optional. Other arguments for upgrading several plugins at once. Default empty array. 830 * 831 * @type bool $clear_update_cache Whether to clear the plugin updates cache if successful. 832 * Default true. 833 * } 834 * 835 * @return array|false An array of results indexed by plugin file, or false if unable to connect to the filesystem. 836 */ 589 837 public function bulk_upgrade( $plugins, $args = array() ) { 590 838 … … 701 949 } 702 950 951 /** 952 * Check a source package to be sure it contains a plugin. 953 * 954 * This function is added to the {@see 'upgrader_source_selection'} filter by 955 * {@see Plugin_Upgrader::install()}. 956 * 957 * @since 3.3.0 958 * 959 * @param string $source The path to the downloaded package source. 960 * @return string|WP_Error The source as passed, or a {@see WP_Error} object if no plugins were found. 961 */ 703 962 public function check_package($source) { 704 963 global $wp_filesystem; … … 727 986 } 728 987 729 // Return plugin info. 988 /** 989 * Retrieve the path to the file that contains the plugin info. 990 * 991 * This isn't used internally in the class, but is called by the skins. 992 * 993 * @since 2.8.0 994 * 995 * @return string|false The full path to the main plugin file, or false. 996 */ 730 997 public function plugin_info() { 731 998 if ( ! is_array($this->result) ) … … 743 1010 } 744 1011 745 //Hooked to pre_install 1012 /** 1013 * Deactivates a plugin before it is upgraded. 1014 * 1015 * Hooked to the {@see 'upgrader_pre_install'} filter by {@see Plugin_Upgrader::upgrade()}. 1016 * 1017 * @since 2.8.0 1018 * 1019 * @param bool|WP_Error $return Upgrade offer return. 1020 * @param array $plugin Plugin package arguments. 1021 */ 746 1022 public function deactivate_plugin_before_upgrade($return, $plugin) { 747 1023 … … 763 1039 } 764 1040 765 //Hooked to upgrade_clear_destination 1041 /** 1042 * Delete the old plugin during an upgrade. 1043 * 1044 * Hooked to the {@see 'upgrader_clear_destination'} filter by 1045 * {@see Plugin_Upgrader::upgrade()} and {@see Plugin_Upgrader::bulk_upgrade()}. 1046 * 1047 * @since 2.8.0 1048 */ 766 1049 public function delete_old_plugin($removed, $local_destination, $remote_destination, $plugin) { 767 1050 global $wp_filesystem; … … 802 1085 class Theme_Upgrader extends WP_Upgrader { 803 1086 1087 /** 1088 * Result of the theme upgrade offer. 1089 * 1090 * @since 2.8.0 1091 * @var array|WP_Erorr $result 1092 * @see WP_Upgrader::$result 1093 */ 804 1094 public $result; 1095 1096 /** 1097 * Whether multiple plugins are being upgraded/installed in bulk. 1098 * 1099 * @since 2.9.0 1100 * @var bool $bulk 1101 */ 805 1102 public $bulk = false; 806 1103 1104 /** 1105 * Initialize the upgrade strings. 1106 * 1107 * @since 2.8.0 1108 */ 807 1109 public function upgrade_strings() { 808 1110 $this->strings['up_to_date'] = __('The theme is at the latest version.'); … … 816 1118 } 817 1119 1120 /** 1121 * Initialize the install strings. 1122 * 1123 * @since 2.8.0 1124 */ 818 1125 public function install_strings() { 819 1126 $this->strings['no_package'] = __('Install package not available.'); … … 836 1143 } 837 1144 838 public function check_parent_theme_filter($install_result, $hook_extra, $child_result) { 1145 /** 1146 * Check if a child theme is being installed and we need to install its parent. 1147 * 1148 * Hooked to the {@see 'upgrader_post_install'} filter by {@see Theme_Upgrader::install()}. 1149 * 1150 * @since 3.4.0 1151 */ 1152 public function check_parent_theme_filter( $install_result, $hook_extra, $child_result ) { 839 1153 // Check to see if we need to install a parent theme 840 1154 $theme_info = $this->theme_info(); … … 895 1209 } 896 1210 897 public function hide_activate_preview_actions($actions) { 1211 /** 1212 * Don't display the activate and preview actions to the user. 1213 * 1214 * Hooked to the {@see 'install_theme_complete_actions'} filter by 1215 * {@see Theme_Upgrader::check_parent_theme_filter()} when installing 1216 * a child theme and installing the parent theme fails. 1217 * 1218 * @since 3.4.0 1219 * 1220 * @param array $actions Preview actions. 1221 */ 1222 public function hide_activate_preview_actions( $actions ) { 898 1223 unset($actions['activate'], $actions['preview']); 899 1224 return $actions; 900 1225 } 901 1226 1227 /** 1228 * Install a theme package. 1229 * 1230 * @since 2.8.0 1231 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional. 1232 * 1233 * @param string $package The full local path or URI of the package. 1234 * @param array $args { 1235 * Optional. Other arguments for installing a theme package. Default empty array. 1236 * 1237 * @type bool $clear_update_cache Whether to clear the updates cache if successful. 1238 * Default true. 1239 * } 1240 * 1241 * @return bool|WP_Error True if the install was successful, false or a {@see WP_Error} object otherwise. 1242 */ 902 1243 public function install( $package, $args = array() ) { 903 1244 … … 936 1277 } 937 1278 1279 /** 1280 * Upgrade a theme. 1281 * 1282 * @since 2.8.0 1283 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional. 1284 * 1285 * @param string $theme The theme slug. 1286 * @param array $args { 1287 * Optional. Other arguments for upgrading a theme. Default empty array. 1288 * 1289 * @type bool $clear_update_cache Whether to clear the update cache if successful. 1290 * Default true. 1291 * } 1292 * @return bool|WP_Error True if the upgrade was successful, false or a {@see WP_Error} object otherwise. 1293 */ 938 1294 public function upgrade( $theme, $args = array() ) { 939 1295 … … 986 1342 } 987 1343 1344 /** 1345 * Upgrade several themes at once. 1346 * 1347 * @since 3.0.0 1348 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional. 1349 * 1350 * @param string $themes The theme slugs. 1351 * @param array $args { 1352 * Optional. Other arguments for upgrading several themes at once. Default empty array. 1353 * 1354 * @type bool $clear_update_cache Whether to clear the update cache if successful. 1355 * Default true. 1356 * } 1357 * @return array[]|false An array of results, or false if unable to connect to the filesystem. 1358 */ 988 1359 public function bulk_upgrade( $themes, $args = array() ) { 989 1360 … … 1088 1459 } 1089 1460 1090 public function check_package($source) { 1461 /** 1462 * Check that the package source contains a valid theme. 1463 * 1464 * Hooked to the {@see 'upgrader_source_selection'} filter by {@see Theme_Upgrader::install()}. 1465 * It will return an error if the theme doesn't have style.css or index.php 1466 * files. 1467 * 1468 * @since 3.3.0 1469 * 1470 * @param string $source The full path to the package source. 1471 * @return string|WP_Error The source or a WP_Error. 1472 */ 1473 public function check_package( $source ) { 1091 1474 global $wp_filesystem; 1092 1475 … … 1115 1498 } 1116 1499 1500 /** 1501 * Turn on maintenance mode before attempting to upgrade the current theme. 1502 * 1503 * Hooked to the {@see 'upgrader_pre_install'} filter by {@see Theme_Upgrader::upgrade()} and 1504 * {@see Theme_Upgrader::bulk_upgrade()}. 1505 * 1506 * @since 2.8.0 1507 */ 1117 1508 public function current_before($return, $theme) { 1118 1509 … … 1131 1522 } 1132 1523 1524 /** 1525 * Turn off maintenance mode after upgrading the current theme. 1526 * 1527 * Hooked to the {@see 'upgrader_post_install'} filter by {@see Theme_Upgrader::upgrade()} 1528 * and {@see Theme_Upgrader::bulk_upgrade()}. 1529 * 1530 * @since 2.8.0 1531 */ 1133 1532 public function current_after($return, $theme) { 1134 1533 if ( is_wp_error($return) ) … … 1153 1552 } 1154 1553 1554 /** 1555 * Delete the old theme during an upgrade. 1556 * 1557 * Hooked to the {@see 'upgrader_clear_destination'} filter by {@see Theme_Upgrader::upgrade()} 1558 * and {@see Theme_Upgrader::bulk_upgrade()}. 1559 * 1560 * @since 2.8.0 1561 */ 1155 1562 public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) { 1156 1563 global $wp_filesystem; … … 1172 1579 } 1173 1580 1581 /** 1582 * Get the WP_Theme object for a theme. 1583 * 1584 * @since 2.8.0 1585 * @since 3.0.0 The `$theme` argument was added. 1586 * 1587 * @param string $theme The directory name of the theme. This is optional, and if not supplied, 1588 * the directory name from the last result will be used. 1589 * @return WP_Theme|false The theme's info object, or false `$theme` is not supplied 1590 * and the last result isn't set. 1591 */ 1174 1592 public function theme_info($theme = null) { 1175 1593 … … 1196 1614 class Language_Pack_Upgrader extends WP_Upgrader { 1197 1615 1616 /** 1617 * Result of the language pack upgrade. 1618 * 1619 * @since 3.7.0 1620 * @var array|WP_Error $result 1621 * @see WP_Upgrader::$result 1622 */ 1198 1623 public $result; 1624 1625 /** 1626 * Whether a bulk upgrade/install is being performed. 1627 * 1628 * @since 3.7.0 1629 * @var bool $bulk 1630 */ 1199 1631 public $bulk = true; 1200 1632 1633 /** 1634 * Asynchronously upgrade language packs after other upgrades have been made. 1635 * 1636 * Hooked to the {@see 'upgrader_process_complete'} action by default. 1637 * 1638 * @since 3.7.0 1639 */ 1201 1640 public static function async_upgrade( $upgrader = false ) { 1202 1641 // Avoid recursion. … … 1248 1687 } 1249 1688 1689 /** 1690 * Initialize the upgrade strings. 1691 * 1692 * @since 3.7.0 1693 */ 1250 1694 public function upgrade_strings() { 1251 1695 $this->strings['starting_upgrade'] = __( 'Some of your translations need updating. Sit tight for a few more seconds while we update them as well.' ); … … 1258 1702 } 1259 1703 1704 /** 1705 * Upgrade a language pack. 1706 * 1707 * @since 3.7.0 1708 * 1709 * @param string|false $update Optional. Whether an update offer is available. Default false. 1710 * @param array $args Optional. Other optional arguments, see 1711 * {@see Language_Pack_Upgrader::bulk_upgrade()}. Default empty array. 1712 * @return array|WP_Error The result of the upgrade, or a {@see wP_Error} object instead. 1713 */ 1260 1714 public function upgrade( $update = false, $args = array() ) { 1261 1715 if ( $update ) { … … 1272 1726 } 1273 1727 1728 /** 1729 * Bulk upgrade language packs. 1730 * 1731 * @since 3.7.0 1732 * 1733 * @param array $language_updates Optional. Language pack updates. Default empty array. 1734 * @param array $args { 1735 * Optional. Other arguments for upgrading multiple language packs. Default empty array 1736 * 1737 * @type bool $clear_update_cache Whether to clear the update cache when done. 1738 * Default true. 1739 * } 1740 * @return array|true|false|WP_Error Will return an array of results, or true if there are no updates, 1741 * false or WP_Error for initial errors. 1742 */ 1274 1743 public function bulk_upgrade( $language_updates = array(), $args = array() ) { 1275 1744 global $wp_filesystem; … … 1379 1848 } 1380 1849 1850 /** 1851 * Check the package source to make sure there are .mo and .po files. 1852 * 1853 * Hooked to the {@see 'upgrader_source_selection'} filter by 1854 * {@see Language_Pack_Upgrader::bulk_upgrade()}. 1855 * 1856 * @since 3.7.0 1857 */ 1381 1858 public function check_package( $source, $remote_source ) { 1382 1859 global $wp_filesystem; … … 1404 1881 } 1405 1882 1883 /** 1884 * Get the name of an item being updated. 1885 * 1886 * @since 3.7.0 1887 * 1888 * @param object The data for an update. 1889 * @return string The name of the item being updated. 1890 */ 1406 1891 public function get_name_for_update( $update ) { 1407 1892 switch ( $update->type ) { … … 1435 1920 class Core_Upgrader extends WP_Upgrader { 1436 1921 1922 /** 1923 * Initialize the upgrade strings. 1924 * 1925 * @since 2.8.0 1926 */ 1437 1927 public function upgrade_strings() { 1438 1928 $this->strings['up_to_date'] = __('WordPress is at the latest version.'); … … 1446 1936 } 1447 1937 1938 /** 1939 * Upgrade WordPress core. 1940 * 1941 * @since 2.8.0 1942 * 1943 * @param object $current Response object for whether WordPress is current. 1944 * @param array $args { 1945 * Optional. Arguments for upgrading WordPress core. Default empty array. 1946 * 1947 * @type bool $pre_check_md5 Whether to check the file checksums before 1948 * attempting the upgrade. Default true. 1949 * @type bool $attempt_rollback Whether to attempt to rollback the chances if 1950 * there is a problem. Default false. 1951 * @type bool $do_rollback Whether to perform this "upgrade" as a rollback. 1952 * Default false. 1953 * } 1954 * @return null|false|WP_Error False or WP_Error on failure, null on success. 1955 */ 1448 1956 public function upgrade( $current, $args = array() ) { 1449 1957 global $wp_filesystem; … … 1594 2102 } 1595 2103 1596 // Determines if this WordPress Core version should update to $offered_ver or not 1597 public static function should_update_to_version( $offered_ver /* x.y.z */ ) { 2104 /** 2105 * Determines if this WordPress Core version should update to an offered version or not. 2106 * 2107 * @since 3.7.0 2108 * 2109 * @param string $offered_ver The offered version, of the format x.y.z. 2110 * @return bool True if we should update to the offered version, otherwise false. 2111 */ 2112 public static function should_update_to_version( $offered_ver ) { 1598 2113 include( ABSPATH . WPINC . '/version.php' ); // $wp_version; // x.y.z 1599 2114 … … 1693 2208 } 1694 2209 2210 /** 2211 * Compare the disk file checksums agains the expected checksums. 2212 * 2213 * @since 3.7.0 2214 * 2215 * @return bool True if the checksums match, otherwise false. 2216 */ 1695 2217 public function check_files() { 1696 2218 global $wp_version, $wp_local_package; … … 1721 2243 */ 1722 2244 class File_Upload_Upgrader { 2245 2246 /** 2247 * The full path to the file package. 2248 * 2249 * @since 2.8.0 2250 * @var string $package 2251 */ 1723 2252 public $package; 2253 2254 /** 2255 * The name of the file. 2256 * 2257 * @since 2.8.0 2258 * @var string $filename 2259 */ 1724 2260 public $filename; 2261 2262 /** 2263 * The ID of the attachment post for this file. 2264 * 2265 * @since 3.3.0 2266 * @var int $id 2267 */ 1725 2268 public $id = 0; 1726 2269 1727 public function __construct($form, $urlholder) { 2270 /** 2271 * Construct the upgrader for a form. 2272 * 2273 * @since 2.8.0 2274 * 2275 * @param string $form The name of the form the file was uploaded from. 2276 * @param string $urlholder The name of the `GET` parameter that holds the filename. 2277 */ 2278 public function __construct( $form, $urlholder ) { 1728 2279 1729 2280 if ( empty($_FILES[$form]['name']) && empty($_GET[$urlholder]) ) … … 1776 2327 } 1777 2328 2329 /** 2330 * Delete the attachment/uploaded file. 2331 * 2332 * @since 3.2.2 2333 * 2334 * @return bool Whether the cleanup was successful. 2335 */ 1778 2336 public function cleanup() { 1779 2337 if ( $this->id ) … … 2094 2652 // Allow relaxed file ownership in some scenarios 2095 2653 'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership, 2096 2097 2654 ) ); 2098 2655
Note: See TracChangeset
for help on using the changeset viewer.