Skip to content

Commit

Permalink
Merge pull request #105 from wp-cli/fix/missing-requests-import
Browse files Browse the repository at this point in the history
Add missing import for `Requests`
  • Loading branch information
schlessera authored Mar 3, 2021
2 parents a64219e + 7658e91 commit 7c1e9ad
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Context/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Testwork\Hook\Scope\AfterSuiteScope;
use Behat\Testwork\Hook\Scope\BeforeSuiteScope;
use Requests;
use RuntimeException;
use WP_CLI\Process;
use WP_CLI\Utils;

Expand Down Expand Up @@ -827,10 +829,10 @@ public function create_config( $subdir = '', $extra_php = false ) {
$params['extra-php'] = $extra_php;
}

$run_dir = '' !== $subdir ? ( $this->variables['RUN_DIR'] . "/$subdir" ) : $this->variables['RUN_DIR'];
$config_cache_path = '';
if ( self::$install_cache_dir ) {
$config_cache_path = self::$install_cache_dir . '/config_' . md5( implode( ':', $params ) . ':subdir=' . $subdir );
$run_dir = '' !== $subdir ? ( $this->variables['RUN_DIR'] . "/$subdir" ) : $this->variables['RUN_DIR'];
}

if ( $config_cache_path && file_exists( $config_cache_path ) ) {
Expand Down Expand Up @@ -1041,7 +1043,7 @@ private static function dir_diff_copy( $upd_dir, $src_dir, $cop_dir ) {
$files = scandir( $upd_dir );
if ( false === $files ) {
$error = error_get_last();
throw new \RuntimeException( sprintf( "Failed to open updated directory '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_dir, $error['message'] ) );
throw new RuntimeException( sprintf( "Failed to open updated directory '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_dir, $error['message'] ) );
}
foreach ( array_diff( $files, array( '.', '..' ) ) as $file ) {
$upd_file = $upd_dir . '/' . $file;
Expand All @@ -1051,13 +1053,13 @@ private static function dir_diff_copy( $upd_dir, $src_dir, $cop_dir ) {
if ( is_dir( $upd_file ) ) {
if ( ! file_exists( $cop_file ) && ! mkdir( $cop_file, 0777, true /*recursive*/ ) ) {
$error = error_get_last();
throw new \RuntimeException( sprintf( "Failed to create copy directory '%s': %s. " . __FILE__ . ':' . __LINE__, $cop_file, $error['message'] ) );
throw new RuntimeException( sprintf( "Failed to create copy directory '%s': %s. " . __FILE__ . ':' . __LINE__, $cop_file, $error['message'] ) );
}
self::copy_dir( $upd_file, $cop_file );
} else {
if ( ! copy( $upd_file, $cop_file ) ) {
$error = error_get_last();
throw new \RuntimeException( sprintf( "Failed to copy '%s' to '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_file, $cop_file, $error['message'] ) );
throw new RuntimeException( sprintf( "Failed to copy '%s' to '%s': %s. " . __FILE__ . ':' . __LINE__, $upd_file, $cop_file, $error['message'] ) );
}
}
} elseif ( is_dir( $upd_file ) ) {
Expand Down

0 comments on commit 7c1e9ad

Please sign in to comment.