Skip to content

Commit 5f2d680

Browse files
committed
Remove unused code
1 parent 3d36d83 commit 5f2d680

File tree

9 files changed

+13
-23
lines changed

9 files changed

+13
-23
lines changed

src/Comment_Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public function get( $args, $assoc_args ) {
334334
*
335335
* @subcommand list
336336
*/
337-
public function list_( $_, $assoc_args ) {
337+
public function list_( $args, $assoc_args ) {
338338
$formatter = $this->get_formatter( $assoc_args );
339339

340340
if ( 'ids' === $formatter->format ) {

src/Menu_Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function create( $args, $assoc_args ) {
9191
* $ wp menu delete "My Menu"
9292
* Success: 1 menu deleted.
9393
*/
94-
public function delete( $args, $_ ) {
94+
public function delete( $args, $assoc_args ) {
9595

9696
$count = 0;
9797
$errors = 0;
@@ -160,7 +160,7 @@ public function delete( $args, $_ ) {
160160
*
161161
* @subcommand list
162162
*/
163-
public function list_( $_, $assoc_args ) {
163+
public function list_( $args, $assoc_args ) {
164164

165165
$menus = wp_get_nav_menus();
166166

src/Menu_Item_Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function list_( $args, $assoc_args ) {
9999
// Correct position inconsistency and
100100
// protected `url` param in WP-CLI
101101
$items = array_map(
102-
function( $item ) use ( $assoc_args ) {
102+
function( $item ) {
103103
$item->position = $item->menu_order;
104104
$item->link = $item->url;
105105
return $item;
@@ -361,7 +361,7 @@ public function update( $args, $assoc_args ) {
361361
*
362362
* @subcommand delete
363363
*/
364-
public function delete( $args, $_ ) {
364+
public function delete( $args, $assoc_args ) {
365365
global $wpdb;
366366

367367
$count = 0;

src/Menu_Location_Command.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Menu_Location_Command extends WP_CLI_Command {
6464
*
6565
* @subcommand list
6666
*/
67-
public function list_( $_, $assoc_args ) {
67+
public function list_( $args, $assoc_args ) {
6868

6969
$locations = get_registered_nav_menus();
7070
$location_objs = [];
@@ -108,7 +108,7 @@ function( $o ) {
108108
*
109109
* @subcommand assign
110110
*/
111-
public function assign( $args, $_ ) {
111+
public function assign( $args, $assoc_args ) {
112112

113113
list( $menu, $location ) = $args;
114114

@@ -148,7 +148,7 @@ public function assign( $args, $_ ) {
148148
*
149149
* @subcommand remove
150150
*/
151-
public function remove( $args, $_ ) {
151+
public function remove( $args, $assoc_args ) {
152152

153153
list( $menu, $location ) = $args;
154154

src/Option_Command.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ public function list_( $args, $assoc_args ) {
248248
$fields = array( 'option_name', 'option_value' );
249249
$size_query = ',LENGTH(option_value) AS `size_bytes`';
250250
$autoload_query = '';
251-
$sort = Utils\get_flag_value( $assoc_args, 'order' );
252251

253252
if ( isset( $assoc_args['search'] ) ) {
254253
$pattern = self::esc_like( $assoc_args['search'] );
@@ -285,7 +284,6 @@ public function list_( $args, $assoc_args ) {
285284
// By default we don't want to display transients.
286285
$show_transients = Utils\get_flag_value( $assoc_args, 'transients', false );
287286

288-
$transients_query = '';
289287
if ( $show_transients ) {
290288
$transients_query = " AND option_name LIKE '\_transient\_%'
291289
OR option_name LIKE '\_site\_transient\_%'";

src/Post_Command.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ function ( $params ) {
370370
* # Launch system editor to edit post
371371
* $ wp post edit 123
372372
*/
373-
public function edit( $args, $_ ) {
373+
public function edit( $args, $assoc_args ) {
374374
$post = $this->fetcher->get_check( $args[0] );
375375

376376
$result = $this->_edit( $post->post_content, "WP-CLI post {$post->ID}" );
@@ -600,7 +600,7 @@ protected function delete_callback( $post_id, $assoc_args ) {
600600
*
601601
* @subcommand list
602602
*/
603-
public function list_( $_, $assoc_args ) {
603+
public function list_( $args, $assoc_args ) {
604604
$formatter = $this->get_formatter( $assoc_args );
605605

606606
$defaults = [

src/Site_Command.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,9 @@ private function empty_taxonomies() {
8989

9090
// Empty taxonomies and terms
9191
$terms = $wpdb->get_results( "SELECT term_id, taxonomy FROM $wpdb->term_taxonomy" );
92-
$ids = [];
9392
$taxonomies = [];
9493
foreach ( (array) $terms as $term ) {
9594
$taxonomies[] = $term->taxonomy;
96-
$ids[] = $term->term_id;
9795
wp_cache_delete( $term->term_id, $term->taxonomy );
9896
}
9997

@@ -354,7 +352,7 @@ public function delete( $args, $assoc_args ) {
354352
* $ wp site create --slug=example
355353
* Success: Site 3 created: http://www.example.com/example/
356354
*/
357-
public function create( $_, $assoc_args ) {
355+
public function create( $args, $assoc_args ) {
358356
if ( ! is_multisite() ) {
359357
WP_CLI::error( 'This is not a multisite installation.' );
360358
}
@@ -412,11 +410,9 @@ public function create( $_, $assoc_args ) {
412410
if ( is_subdomain_install() ) {
413411
$newdomain = $base . '.' . preg_replace( '|^www\.|', '', $current_site->domain );
414412
$path = $current_site->path;
415-
$url = $newdomain;
416413
} else {
417414
$newdomain = $current_site->domain;
418415
$path = $current_site->path . $base . '/';
419-
$url = $newdomain . $path;
420416
}
421417

422418
$user_id = email_exists( $email );
@@ -539,7 +535,7 @@ private function get_network( $network_id ) {
539535
*
540536
* @subcommand list
541537
*/
542-
public function list_( $_, $assoc_args ) {
538+
public function list_( $args, $assoc_args ) {
543539
if ( ! is_multisite() ) {
544540
WP_CLI::error( 'This is not a multisite installation.' );
545541
}

src/Term_Command.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,6 @@ public function update( $args, $assoc_args ) {
365365

366366
$assoc_args = wp_slash( $assoc_args );
367367

368-
list( $taxonomy, $term ) = $args;
369-
370368
$term = get_term_by( Utils\get_flag_value( $assoc_args, 'by' ), $term, $taxonomy );
371369

372370
if ( ! $term ) {
@@ -677,8 +675,6 @@ public function recount( $args ) {
677675
* Success: Migrated the term '9190' from taxonomy 'category' to taxonomy 'post_tag' for 1 posts
678676
*/
679677
public function migrate( $args, $assoc_args ) {
680-
$clean_term_cache = [];
681-
$values = [];
682678
$term_reference = $args[0];
683679
$original_taxonomy = Utils\get_flag_value( $assoc_args, 'from' );
684680
$destination_taxonomy = Utils\get_flag_value( $assoc_args, 'to' );

src/WP_CLI/CommandWithDBObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ abstract class CommandWithDBObject extends WP_CLI_Command {
2727
/**
2828
* @var array $obj_fields Default fields to display for each object.
2929
*/
30-
protected $obj_fields = null;
30+
protected $obj_fields;
3131

3232
/**
3333
* Create a given database object.

0 commit comments

Comments
 (0)