From 5c2bc1ec3755d937c90884382105f785f6582edb Mon Sep 17 00:00:00 2001 From: jtsternberg Date: Mon, 5 Aug 2013 11:57:10 -0400 Subject: [PATCH] Remove search=$key slug replacement method. :( --- php/WP_CLI/CommandWithUpgrade.php | 21 --------------------- php/commands/plugin.php | 25 +++++++------------------ php/commands/theme.php | 12 +----------- 3 files changed, 8 insertions(+), 50 deletions(-) diff --git a/php/WP_CLI/CommandWithUpgrade.php b/php/WP_CLI/CommandWithUpgrade.php index fb0867c2..e0d5a29c 100644 --- a/php/WP_CLI/CommandWithUpgrade.php +++ b/php/WP_CLI/CommandWithUpgrade.php @@ -346,25 +346,4 @@ abstract class CommandWithUpgrade extends \WP_CLI_Command { } - /** - * Parse the name of a plugin to check if 'search=' exists, and check search transient for the key - * - * @param string name - * @return string - */ - public function _parse_search_key( $name, $data_type = 'plugin' ) { - - // Sanitize to 1 of 2 types - $data_type = 'plugin' === $data_type ? 'plugin' : 'theme'; - - if ( false !== strpos( $name, 'search=' ) ) { - $search_key = (int) str_replace( 'search=', '', $name ); - if ( ( $trans = get_site_transient( 'wpcli-$data_type-search-data' ) ) && isset( $trans[$search_key] ) ) - $name = $trans[$search_key]->slug; - else - \WP_CLI::error( 'There is no recent search with that key.' ); - } - return $name; - } - } diff --git a/php/commands/plugin.php b/php/commands/plugin.php index 018e6ab9..ebb8d8a0 100644 --- a/php/commands/plugin.php +++ b/php/commands/plugin.php @@ -97,7 +97,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade { } protected function status_single( $args ) { - $name = $this->parse_search_key( $args[0] ); + $name = $args[0]; $file = $this->parse_name( $name ); $details = $this->get_details( $file ); @@ -147,7 +147,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade { * @synopsis [--network] */ function activate( $args, $assoc_args = array() ) { - $name = $this->parse_search_key( $args[0] ); + $name = $args[0]; $file = $this->parse_name( $name ); $network_wide = isset( $assoc_args['network'] ); @@ -178,7 +178,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade { * @synopsis [--network] */ function deactivate( $args, $assoc_args = array() ) { - $name = $this->parse_search_key( $args[0] ); + $name = $args[0]; $file = $this->parse_name( $name ); $network_wide = isset( $assoc_args['network'] ); @@ -209,7 +209,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade { * @synopsis [--network] */ function toggle( $args, $assoc_args = array() ) { - $name = $this->parse_search_key( $args[0] ); + $name = $args[0]; $file = $this->parse_name( $name ); $network_wide = isset( $assoc_args['network'] ); @@ -300,7 +300,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade { * @synopsis [--version=] */ function update( $args, $assoc_args ) { - $name = $this->parse_search_key( $args[0] ); + $name = $args[0]; $basename = $this->parse_name( $name ); if ( isset( $assoc_args['version'] ) && 'dev' == $assoc_args['version'] ) { @@ -397,7 +397,6 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade { * @synopsis [--version=] [--force] [--activate] */ function install( $args, $assoc_args ) { - $args[0] = $this->parse_search_key( $args[0] ); parent::install( $args, $assoc_args ); } @@ -420,7 +419,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade { * @synopsis [--no-delete] */ function uninstall( $args, $assoc_args = array() ) { - $name = $this->parse_search_key( $args[0] ); + $name = $args[0]; $file = $this->parse_name( $name ); if ( is_plugin_active( $file ) ) { @@ -452,7 +451,7 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade { * @synopsis */ function delete( $args, $assoc_args = array() ) { - $name = $this->parse_search_key( $args[0] ); + $name = $args[0]; $file = $this->parse_name( $name ); if ( $this->_delete( $file ) ) { @@ -538,16 +537,6 @@ class Plugin_Command extends \WP_CLI\CommandWithUpgrade { } /** - * Parse the name of a plugin to check if 'search=' exists, and check search transient for the key - * - * @param string name - * @return string - */ - public function parse_search_key( $name ) { - return parent::_parse_search_key( $name, 'plugin' ); - } - - /** * Converts a plugin basename back into a friendly slug. */ private function get_name( $file ) { diff --git a/php/commands/theme.php b/php/commands/theme.php index 7894afb4..8637b6b9 100644 --- a/php/commands/theme.php +++ b/php/commands/theme.php @@ -246,7 +246,6 @@ class Theme_Command extends \WP_CLI\CommandWithUpgrade { * @synopsis [--version=] [--force] [--activate] */ function install( $args, $assoc_args ) { - $args[0] = $this->parse_search_key( $args[0] ); parent::install( $args, $assoc_args ); } @@ -353,7 +352,7 @@ class Theme_Command extends \WP_CLI\CommandWithUpgrade { * @return object */ private function parse_name( $name ) { - $theme = wp_get_theme( $this->parse_search_key( $name ) ); + $theme = wp_get_theme( $name ); if ( !$theme->exists() ) { WP_CLI::error( "The theme '$name' could not be found." ); @@ -363,15 +362,6 @@ class Theme_Command extends \WP_CLI\CommandWithUpgrade { return $theme; } - /** - * Parse the name of a theme to check if 'search=' exists, and check search transient for the key - * - * @param string name - * @return string - */ - public function parse_search_key( $name ) { - return parent::_parse_search_key( $name, 'theme' ); - } } WP_CLI::add_command( 'theme', 'Theme_Command' ); -- 2.11.0