Skip to content

Commit

Permalink
Split theme update into update_single() and update_multiple() to matc…
Browse files Browse the repository at this point in the history
…h plugin update.
  • Loading branch information
getsource committed Mar 15, 2012
1 parent 799834e commit 7cf4678
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/php/wp-cli/commands/internals/theme.php
Expand Up @@ -131,16 +131,20 @@ function update( $args, $assoc_args ) {
// Force WordPress to update the theme list
wp_update_themes();

// If we have arguments and not updating all, update named theme
if ( ! empty( $args ) && ! isset( $assoc_args['all'] ) ) {
list( $theme, $name ) = $this->parse_name( $args, __FUNCTION__ );

$upgrader = WP_CLI::get_upgrader( 'Theme_Upgrader' );
$result = $upgrader->upgrade( $name );
return;
if ( !empty( $args ) && !isset( $assoc_args['all'] ) ) {
$this->update_single( $args, $assoc_args );
} else {
$this->update_multiple( $args, $assoc_args );
}
}

private function update_single( $args, $assoc_args ) {
list( $file, $name ) = $this->parse_name( $args, __FUNCTION__ );

WP_CLI::get_upgrader( 'Theme_Upgrader' )->upgrade( $name );
}

// If not, fall through and load theme info.
private function update_multiple( $args, $assoc_args ) {
$themes = get_themes();

// Grab all Themes that need Updates
Expand Down

0 comments on commit 7cf4678

Please sign in to comment.