Skip to content

Commit

Permalink
Update to WPCS v3 (#241)
Browse files Browse the repository at this point in the history
* Update to wp-cli-tests v4 (which requires WPCS v3)

* Fix all autofixable CS issues
  • Loading branch information
schlessera authored Aug 30, 2023
1 parent 0852e36 commit 7a81a86
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"wp-cli/db-command": "^1.3 || ^2",
"wp-cli/entity-command": "^1.3 || ^2",
"wp-cli/extension-command": "^1.2 || ^2",
"wp-cli/wp-cli-tests": "^3.2.7"
"wp-cli/wp-cli-tests": "^4"
},
"config": {
"process-timeout": 7200,
Expand Down
2 changes: 1 addition & 1 deletion core-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
return;
}

$wpcli_core_autoloader = dirname( __FILE__ ) . '/vendor/autoload.php';
$wpcli_core_autoloader = __DIR__ . '/vendor/autoload.php';
if ( file_exists( $wpcli_core_autoloader ) ) {
require_once $wpcli_core_autoloader;
}
Expand Down
21 changes: 12 additions & 9 deletions src/Core_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,14 @@ private function multisite_convert_( $assoc_args ) {
}

// copied from populate_network()
private static function create_initial_blog( $network_id, $blog_id, $domain, $path,
$subdomain_install, $site_user ) {
private static function create_initial_blog(
$network_id,
$blog_id,
$domain,
$path,
$subdomain_install,
$site_user
) {
global $wpdb, $current_site, $wp_rewrite;

// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- This is meant to replace Core functionality.
Expand Down Expand Up @@ -1138,10 +1144,8 @@ public function update( $args, $assoc_args ) {
WP_CLI::success( 'WordPress is at the latest minor release.' );
return;
}
} else {
if ( ! empty( $from_api->updates ) ) {
} elseif ( ! empty( $from_api->updates ) ) {
list( $update ) = $from_api->updates;
}
}
} elseif ( Utils\wp_version_compare( $assoc_args['version'], '<' )
|| 'nightly' === $assoc_args['version']
Expand Down Expand Up @@ -1262,7 +1266,7 @@ public function update_db( $args, $assoc_args ) {
$total = 0;
$site_ids = [];
foreach ( $it as $blog ) {
$total++;
++$total;
$site_ids[] = $blog->site_id;
$url = $blog->domain . $blog->path;
$cmd = "--url={$url} core update-db";
Expand All @@ -1285,7 +1289,7 @@ public function update_db( $args, $assoc_args ) {
$message = "Database upgraded successfully on {$url}";
}
WP_CLI::log( $message );
$success++;
++$success;
} else {
WP_CLI::warning( "Database failed to upgrade on {$url}" );
}
Expand Down Expand Up @@ -1506,7 +1510,7 @@ private function cleanup_extra_files( $version_from, $version_to, $locale, $inse
if ( file_exists( ABSPATH . $file ) ) {
unlink( ABSPATH . $file );
WP_CLI::log( "File removed: {$file}" );
$count++;
++$count;
}
}

Expand Down Expand Up @@ -1562,5 +1566,4 @@ function () use ( $new_zip_file ) {
WP_CLI::error( 'ZipArchive failed to open ZIP file.' );
}
}

}
1 change: 0 additions & 1 deletion src/WP_CLI/Core/NonDestructiveCoreUpgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ public function unpack_package( $package, $delete_package = false ) {
return parent::unpack_package( $package, $delete_package );
}
}

0 comments on commit 7a81a86

Please sign in to comment.