Skip to content

Commit 30dfbe5

Browse files
authored
Merge pull request #212 from wp-cli/fix/remove-only-plugins-themes-folders
2 parents 8a950d6 + c48baad commit 30dfbe5

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

features/core-download.feature

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ Feature: Download WordPress
340340
"""
341341
And the return code should be 1
342342

343-
Scenario: Core download without the wp-content dir
343+
Scenario: Core download without the wp-content/plugins dir
344344
Given an empty directory
345345

346346
When I run `wp core download --skip-content`
@@ -349,9 +349,31 @@ Feature: Download WordPress
349349
Success: WordPress downloaded.
350350
"""
351351
And the wp-includes directory should exist
352-
And the wp-content directory should not exist
352+
And the wp-content/plugins directory should not exist
353353

354-
Scenario: Core download without the wp-content dir should work non US locale
354+
Scenario: Core download without the wp-content/themes dir
355+
Given an empty directory
356+
357+
When I run `wp core download --skip-content`
358+
Then STDOUT should contain:
359+
"""
360+
Success: WordPress downloaded.
361+
"""
362+
And the wp-includes directory should exist
363+
And the wp-content/themes directory should not exist
364+
365+
Scenario: Core download without the wp-content/plugins dir should work non US locale
366+
Given an empty directory
367+
368+
When I run `wp core download --skip-content --version=4.9.11 --locale=nl_NL`
369+
Then STDOUT should contain:
370+
"""
371+
Success: WordPress downloaded.
372+
"""
373+
And the wp-includes directory should exist
374+
And the wp-content/plugins directory should not exist
375+
376+
Scenario: Core download without the wp-content/themes dir should work non US locale
355377
Given an empty directory
356378

357379
When I run `wp core download --skip-content --version=4.9.11 --locale=nl_NL`
@@ -360,9 +382,9 @@ Feature: Download WordPress
360382
Success: WordPress downloaded.
361383
"""
362384
And the wp-includes directory should exist
363-
And the wp-content directory should not exist
385+
And the wp-content/themes directory should not exist
364386

365-
Scenario: Core download without the wp-content dir should work if a version is set
387+
Scenario: Core download without the wp-content/plugins dir should work if a version is set
366388
Given an empty directory
367389

368390
When I try `wp core download --skip-content --version=4.7`
@@ -371,7 +393,8 @@ Feature: Download WordPress
371393
Success: WordPress downloaded.
372394
"""
373395
And the wp-includes directory should exist
374-
And the wp-content directory should not exist
396+
And the wp-content/plugins directory should not exist
397+
And the wp-content/themes directory should not exist
375398

376399
Scenario: Core download with extract parameter should unzip the download file
377400
Given an empty directory

src/Core_Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ function () use ( $new_zip_file ) {
15171517
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
15181518
for ( $i = 0; $i < $zip->numFiles; $i++ ) {
15191519
$info = $zip->statIndex( $i );
1520-
if ( false !== stripos( $info['name'], 'wp-content/' ) ) {
1520+
if ( false !== stripos( $info['name'], 'themes/' ) || false !== stripos( $info['name'], 'plugins/' ) ) {
15211521
$zip->deleteIndex( $i );
15221522
}
15231523
}

0 commit comments

Comments
 (0)