wp/wp-admin/includes/class-theme-upgrader.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
   369 	 * Upgrades several themes at once.
   369 	 * Upgrades several themes at once.
   370 	 *
   370 	 *
   371 	 * @since 3.0.0
   371 	 * @since 3.0.0
   372 	 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
   372 	 * @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
   373 	 *
   373 	 *
   374 	 * @global string $wp_version The WordPress version string.
       
   375 	 *
       
   376 	 * @param string[] $themes Array of the theme slugs.
   374 	 * @param string[] $themes Array of the theme slugs.
   377 	 * @param array    $args {
   375 	 * @param array    $args {
   378 	 *     Optional. Other arguments for upgrading several themes at once. Default empty array.
   376 	 *     Optional. Other arguments for upgrading several themes at once. Default empty array.
   379 	 *
   377 	 *
   380 	 *     @type bool $clear_update_cache Whether to clear the update cache if successful.
   378 	 *     @type bool $clear_update_cache Whether to clear the update cache if successful.
   381 	 *                                    Default true.
   379 	 *                                    Default true.
   382 	 * }
   380 	 * }
   383 	 * @return array[]|false An array of results, or false if unable to connect to the filesystem.
   381 	 * @return array[]|false An array of results, or false if unable to connect to the filesystem.
   384 	 */
   382 	 */
   385 	public function bulk_upgrade( $themes, $args = array() ) {
   383 	public function bulk_upgrade( $themes, $args = array() ) {
   386 		global $wp_version;
   384 		$wp_version  = wp_get_wp_version();
   387 
       
   388 		$defaults    = array(
   385 		$defaults    = array(
   389 			'clear_update_cache' => true,
   386 			'clear_update_cache' => true,
   390 		);
   387 		);
   391 		$parsed_args = wp_parse_args( $args, $defaults );
   388 		$parsed_args = wp_parse_args( $args, $defaults );
   392 
   389 
   556 	 * Hooked to the {@see 'upgrader_source_selection'} filter by Theme_Upgrader::install().
   553 	 * Hooked to the {@see 'upgrader_source_selection'} filter by Theme_Upgrader::install().
   557 	 *
   554 	 *
   558 	 * @since 3.3.0
   555 	 * @since 3.3.0
   559 	 *
   556 	 *
   560 	 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
   557 	 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
   561 	 * @global string             $wp_version    The WordPress version string.
       
   562 	 *
   558 	 *
   563 	 * @param string $source The path to the downloaded package source.
   559 	 * @param string $source The path to the downloaded package source.
   564 	 * @return string|WP_Error The source as passed, or a WP_Error object on failure.
   560 	 * @return string|WP_Error The source as passed, or a WP_Error object on failure.
   565 	 */
   561 	 */
   566 	public function check_package( $source ) {
   562 	public function check_package( $source ) {
   567 		global $wp_filesystem, $wp_version;
   563 		global $wp_filesystem;
   568 
   564 
       
   565 		$wp_version           = wp_get_wp_version();
   569 		$this->new_theme_data = array();
   566 		$this->new_theme_data = array();
   570 
   567 
   571 		if ( is_wp_error( $source ) ) {
   568 		if ( is_wp_error( $source ) ) {
   572 			return $source;
   569 			return $source;
   573 		}
   570 		}