Language_Pack_Upgrader::upgrade() WordPress Method
The Language_Pack_Upgrader::upgrade() method is used to upgrade a language pack. This method takes two arguments: the first is the language code to upgrade, and the second is an array of options. The default options are 'ignore_files' => false, 'backup' => false, and 'force_complete' => false. This method first checks if the given language code is valid. If not, it will return an error. Next, it will check if the given language code is already installed. If so, it will return an error. Finally, it will check if the given language code is compatible with the installed version of WordPress. If not, it will return an error. If all of the above checks pass, the method will then proceed to upgrade the language pack. First, it will download the new language pack from WordPress.org. Next, it will unpack the downloaded language pack. Finally, it will install the new language pack.
Language_Pack_Upgrader::upgrade( string|false $update = false, array $args = array() ) #
Upgrade a language pack.
Parameters
- $update
(string|false)(Optional) Whether an update offer is available.
Default value: false
- $args
(array)(Optional) Other optional arguments, see Language_Pack_Upgrader::bulk_upgrade().
Default value: array()
Return
(array|bool|WP_Error) The result of the upgrade, or a WP_Error object instead.
Source
File: wp-admin/includes/class-language-pack-upgrader.php
public function upgrade( $update = false, $args = array() ) { if ( $update ) { $update = array( $update ); } $results = $this->bulk_upgrade( $update, $args ); if ( ! is_array( $results ) ) { return $results; } return $results[0]; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
3.7.0 | Introduced. |