WordPress.org

Make WordPress Core

Changeset 30758


Ignore:
Timestamp:
12/07/2014 12:25:44 AM (7 years ago)
Author:
DrewAPicture
Message:

Add missing DocBlocks and parameter descriptions for a wide variety of properties and methods in WP_Upgrader, Plugin_Upgrader, Theme_Upgrader, Language_Pack_Upgrader, Core_Upgrader, and File_upload_Upgrader.

Props jdgrimes, DrewAPicture.

See #29086.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-upgrader.php

    r30703 r30758  
    2222 */
    2323class 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     */
    2431    public $strings = array();
     32
     33    /**
     34     * The upgrader skin being used.
     35     *
     36     * @since 2.8.0
     37     * @var WP_Upgrader_Skin $skin
     38     */
    2539    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     */
    2663    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     */
    2773    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     */
    2883    public $update_current = 0;
    2984
    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 ) {
    3194        if ( null == $skin )
    3295            $this->skin = new WP_Upgrader_Skin();
     
    3598    }
    3699
     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     */
    37108    public function init() {
    38109        $this->skin->set_upgrader($this);
     
    40111    }
    41112
     113    /**
     114     * Add the generic strings to WP_Upgrader::$strings.
     115     *
     116     * @since 2.8.0
     117     */
    42118    public function generic_strings() {
    43119        $this->strings['bad_request'] = __('Invalid Data provided.');
     
    62138    }
    63139
     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     */
    64152    public function fs_connect( $directories = array(), $allow_relaxed_file_ownership = false ) {
    65153        global $wp_filesystem;
     
    111199    } //end fs_connect();
    112200
    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 ) {
    114211
    115212        /**
     
    143240    }
    144241
    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 ) {
    146253        global $wp_filesystem;
    147254
     
    182289    }
    183290
     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     */
    184318    public function install_package( $args = array() ) {
    185319        global $wp_filesystem, $wp_theme_directories;
     
    358492    }
    359493
     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     */
    360528    public function run( $options ) {
    361529
     
    452620    }
    453621
    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 ) {
    455632        global $wp_filesystem;
    456633        $file = $wp_filesystem->abspath() . '.maintenance';
     
    478655class Plugin_Upgrader extends WP_Upgrader {
    479656
     657    /**
     658     * Plugin upgrade result.
     659     *
     660     * @since 2.8.0
     661     * @var array|WP_Error $result
     662     * @see WP_Upgrader::$result
     663     */
    480664    public $result;
     665
     666    /**
     667     * Whether a bulk upgrade/install is being performed.
     668     *
     669     * @since 2.9.0
     670     * @var bool $bulk
     671     */
    481672    public $bulk = false;
    482673
     674    /**
     675     * Initialize the upgrade strings.
     676     *
     677     * @since 2.8.0
     678     */
    483679    public function upgrade_strings() {
    484680        $this->strings['up_to_date'] = __('The plugin is at the latest version.');
     
    492688    }
    493689
     690    /**
     691     * Initialize the install strings.
     692     *
     693     * @since 2.8.0
     694     */
    494695    public function install_strings() {
    495696        $this->strings['no_package'] = __('Install package not available.');
     
    502703    }
    503704
     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     */
    504721    public function install( $package, $args = array() ) {
    505722
     
    536753    }
    537754
     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     */
    538770    public function upgrade( $plugin, $args = array() ) {
    539771
     
    587819    }
    588820
     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     */
    589837    public function bulk_upgrade( $plugins, $args = array() ) {
    590838
     
    701949    }
    702950
     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     */
    703962    public function check_package($source) {
    704963        global $wp_filesystem;
     
    727986    }
    728987
    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     */
    730997    public function plugin_info() {
    731998        if ( ! is_array($this->result) )
     
    7431010    }
    7441011
    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     */
    7461022    public function deactivate_plugin_before_upgrade($return, $plugin) {
    7471023
     
    7631039    }
    7641040
    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     */
    7661049    public function delete_old_plugin($removed, $local_destination, $remote_destination, $plugin) {
    7671050        global $wp_filesystem;
     
    8021085class Theme_Upgrader extends WP_Upgrader {
    8031086
     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     */
    8041094    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     */
    8051102    public $bulk = false;
    8061103
     1104    /**
     1105     * Initialize the upgrade strings.
     1106     *
     1107     * @since 2.8.0
     1108     */
    8071109    public function upgrade_strings() {
    8081110        $this->strings['up_to_date'] = __('The theme is at the latest version.');
     
    8161118    }
    8171119
     1120    /**
     1121     * Initialize the install strings.
     1122     *
     1123     * @since 2.8.0
     1124     */
    8181125    public function install_strings() {
    8191126        $this->strings['no_package'] = __('Install package not available.');
     
    8361143    }
    8371144
    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 ) {
    8391153        // Check to see if we need to install a parent theme
    8401154        $theme_info = $this->theme_info();
     
    8951209    }
    8961210
    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 ) {
    8981223        unset($actions['activate'], $actions['preview']);
    8991224        return $actions;
    9001225    }
    9011226
     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     */
    9021243    public function install( $package, $args = array() ) {
    9031244
     
    9361277    }
    9371278
     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     */
    9381294    public function upgrade( $theme, $args = array() ) {
    9391295
     
    9861342    }
    9871343
     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     */
    9881359    public function bulk_upgrade( $themes, $args = array() ) {
    9891360
     
    10881459    }
    10891460
    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 ) {
    10911474        global $wp_filesystem;
    10921475
     
    11151498    }
    11161499
     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     */
    11171508    public function current_before($return, $theme) {
    11181509
     
    11311522    }
    11321523
     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     */
    11331532    public function current_after($return, $theme) {
    11341533        if ( is_wp_error($return) )
     
    11531552    }
    11541553
     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     */
    11551562    public function delete_old_theme( $removed, $local_destination, $remote_destination, $theme ) {
    11561563        global $wp_filesystem;
     
    11721579    }
    11731580
     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     */
    11741592    public function theme_info($theme = null) {
    11751593
     
    11961614class Language_Pack_Upgrader extends WP_Upgrader {
    11971615
     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     */
    11981623    public $result;
     1624
     1625    /**
     1626     * Whether a bulk upgrade/install is being performed.
     1627     *
     1628     * @since 3.7.0
     1629     * @var bool $bulk
     1630     */
    11991631    public $bulk = true;
    12001632
     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     */
    12011640    public static function async_upgrade( $upgrader = false ) {
    12021641        // Avoid recursion.
     
    12481687    }
    12491688
     1689    /**
     1690     * Initialize the upgrade strings.
     1691     *
     1692     * @since 3.7.0
     1693     */
    12501694    public function upgrade_strings() {
    12511695        $this->strings['starting_upgrade'] = __( 'Some of your translations need updating. Sit tight for a few more seconds while we update them as well.' );
     
    12581702    }
    12591703
     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     */
    12601714    public function upgrade( $update = false, $args = array() ) {
    12611715        if ( $update ) {
     
    12721726    }
    12731727
     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     */
    12741743    public function bulk_upgrade( $language_updates = array(), $args = array() ) {
    12751744        global $wp_filesystem;
     
    13791848    }
    13801849
     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     */
    13811858    public function check_package( $source, $remote_source ) {
    13821859        global $wp_filesystem;
     
    14041881    }
    14051882
     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     */
    14061891    public function get_name_for_update( $update ) {
    14071892        switch ( $update->type ) {
     
    14351920class Core_Upgrader extends WP_Upgrader {
    14361921
     1922    /**
     1923     * Initialize the upgrade strings.
     1924     *
     1925     * @since 2.8.0
     1926     */
    14371927    public function upgrade_strings() {
    14381928        $this->strings['up_to_date'] = __('WordPress is at the latest version.');
     
    14461936    }
    14471937
     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     */
    14481956    public function upgrade( $current, $args = array() ) {
    14491957        global $wp_filesystem;
     
    15942102    }
    15952103
    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 ) {
    15982113        include( ABSPATH . WPINC . '/version.php' ); // $wp_version; // x.y.z
    15992114
     
    16932208    }
    16942209
     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     */
    16952217    public function check_files() {
    16962218        global $wp_version, $wp_local_package;
     
    17212243 */
    17222244class File_Upload_Upgrader {
     2245
     2246    /**
     2247     * The full path to the file package.
     2248     *
     2249     * @since 2.8.0
     2250     * @var string $package
     2251     */
    17232252    public $package;
     2253
     2254    /**
     2255     * The name of the file.
     2256     *
     2257     * @since 2.8.0
     2258     * @var string $filename
     2259     */
    17242260    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     */
    17252268    public $id = 0;
    17262269
    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 ) {
    17282279
    17292280        if ( empty($_FILES[$form]['name']) && empty($_GET[$urlholder]) )
     
    17762327    }
    17772328
     2329    /**
     2330     * Delete the attachment/uploaded file.
     2331     *
     2332     * @since 3.2.2
     2333     *
     2334     * @return bool Whether the cleanup was successful.
     2335     */
    17782336    public function cleanup() {
    17792337        if ( $this->id )
     
    20942652            // Allow relaxed file ownership in some scenarios
    20952653            'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership,
    2096            
    20972654        ) );
    20982655
Note: See TracChangeset for help on using the changeset viewer.