diff --git a/composer.json b/composer.json index 5e45a6f0..ced0d581 100644 --- a/composer.json +++ b/composer.json @@ -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, diff --git a/core-command.php b/core-command.php index 4c1278e2..70dfd880 100644 --- a/core-command.php +++ b/core-command.php @@ -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; } diff --git a/src/Core_Command.php b/src/Core_Command.php index fa51b053..1b82223a 100644 --- a/src/Core_Command.php +++ b/src/Core_Command.php @@ -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. @@ -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'] @@ -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"; @@ -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}" ); } @@ -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; } } @@ -1562,5 +1566,4 @@ function () use ( $new_zip_file ) { WP_CLI::error( 'ZipArchive failed to open ZIP file.' ); } } - } diff --git a/src/WP_CLI/Core/NonDestructiveCoreUpgrader.php b/src/WP_CLI/Core/NonDestructiveCoreUpgrader.php index dc9aac77..29d7abf3 100644 --- a/src/WP_CLI/Core/NonDestructiveCoreUpgrader.php +++ b/src/WP_CLI/Core/NonDestructiveCoreUpgrader.php @@ -13,4 +13,3 @@ public function unpack_package( $package, $delete_package = false ) { return parent::unpack_package( $package, $delete_package ); } } -