Skip to content

Commit 956e11d

Browse files
authored
Merge pull request #44 from wp-cli/43-skip-cache-http
Skip cache also when ZIP URL is 'http://' to nightly build
2 parents c1c23c4 + 4b673d6 commit 956e11d

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

features/core-update.feature

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,26 @@ Feature: Update WordPress core
260260
| version |
261261
| trunk |
262262
| nightly |
263+
264+
Scenario: Installing latest nightly build should skip cache
265+
Given a WP install
266+
267+
When I run `wp core upgrade --force http://wordpress.org/nightly-builds/wordpress-4.9-latest.zip`
268+
Then STDOUT should contain:
269+
"""
270+
Success:
271+
"""
272+
And STDOUT should not contain:
273+
"""
274+
Using cached
275+
"""
276+
277+
When I run `wp core upgrade --force http://wordpress.org/nightly-builds/wordpress-4.9-latest.zip`
278+
Then STDOUT should contain:
279+
"""
280+
Success:
281+
"""
282+
And STDOUT should not contain:
283+
"""
284+
Using cached
285+
"""

src/WP_CLI/CoreUpgrader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public function download_package( $package ) {
5555
$cache_key = "core/{$filename}-{$update->locale}.{$ext}";
5656
$cache_file = $cache->has( $cache_key );
5757

58-
if ( $cache_file && false === stripos( $package, 'https://wordpress.org/nightly-builds/' ) ) {
58+
if ( $cache_file && false === stripos( $package, 'https://wordpress.org/nightly-builds/' )
59+
&& false === stripos( $package, 'http://wordpress.org/nightly-builds/' ) ) {
5960
WP_CLI::log( "Using cached file '$cache_file'..." );
6061
copy( $cache_file, $temp );
6162
return $temp;

0 commit comments

Comments
 (0)