Skip to content

Commit

Permalink
Work around Travis CI issue with _s download certificate
Browse files Browse the repository at this point in the history
When the request fails on HTTPS, we switch to HTTP instead, which should work within Travis.

Fixes #181
  • Loading branch information
schlessera committed Oct 25, 2018
1 parent e28b27e commit 7d43c0e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Scaffold_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,21 @@ public function _s( $args, $assoc_args ) {
'filename' => $tmpfname,
) );

// Workaround to get scaffolding to work within Travis CI.
// See https://github.com/wp-cli/scaffold-command/issues/181
if ( is_wp_error( $response )
&& false !== strpos( $response->get_error_message(), 'gnutls_handshake() failed' ) ) {
// Try again with HTTP instead of HTTPS.
$url = str_replace( 'https://', 'http://', $url );

$response = wp_remote_post( $url, array(
'timeout' => $timeout,
'body' => $body,
'stream' => true,
'filename' => $tmpfname,
) );
}

if ( is_wp_error( $response ) ) {
WP_CLI::error( $response );
}
Expand Down

0 comments on commit 7d43c0e

Please sign in to comment.