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()


Top ↑

Return

(array|bool|WP_Error) The result of the upgrade, or a WP_Error object instead.


Top ↑

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];
	}


Top ↑

Changelog

Changelog
VersionDescription
3.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.