Skip to content

Commit fcd81d0

Browse files
authored
Merge branch 'main' into copilot/fix-multinetwork-update-db
2 parents cbfb90e + 0971545 commit fcd81d0

File tree

7 files changed

+425
-24
lines changed

7 files changed

+425
-24
lines changed

.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/.actrc export-ignore
2+
/.distignore export-ignore
3+
/.editorconfig export-ignore
4+
/.github export-ignore
5+
/.gitignore export-ignore
6+
/.typos.toml export-ignore
7+
/AGENTS.md export-ignore
8+
/behat.yml export-ignore
9+
/features export-ignore
10+
/phpcs.xml.dist export-ignore
11+
/phpstan.neon.dist export-ignore
12+
/phpunit.xml.dist export-ignore
13+
/tests export-ignore
14+
/wp-cli.yml export-ignore

.github/workflows/copilot-setup-steps.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ jobs:
2121

2222
- name: Check existence of composer.json file
2323
id: check_composer_file
24-
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
25-
with:
26-
files: "composer.json"
24+
run: echo "files_exists=$(test -f composer.json && echo true || echo false)" >> "$GITHUB_OUTPUT"
2725

2826
- name: Set up PHP environment
2927
if: steps.check_composer_file.outputs.files_exists == 'true'
30-
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
28+
uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2
3129
with:
3230
php-version: 'latest'
3331
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
@@ -38,7 +36,7 @@ jobs:
3836

3937
- name: Install Composer dependencies & cache dependencies
4038
if: steps.check_composer_file.outputs.files_exists == 'true'
41-
uses: ramsey/composer-install@a35c6ebd3d08125aaf8852dff361e686a1a67947 # v3
39+
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # v3
4240
env:
4341
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
4442
with:

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ update isn't actually running.
419419
Downloading update from https://downloads.wordpress.org/release/wordpress-4.5.2-no-content.zip...
420420
Unpacking the update...
421421
Cleaning up files...
422-
No files found that need cleaning up
422+
No old files were removed.
423423
Success: WordPress updated successfully.
424424

425425
# Update WordPress using zip file.
@@ -433,7 +433,9 @@ update isn't actually running.
433433
Updating to version 3.1 (en_US)...
434434
Downloading update from https://wordpress.org/wordpress-3.1.zip...
435435
Unpacking the update...
436-
Warning: Checksums not available for WordPress 3.1/en_US. Please cleanup files manually.
436+
Cleaning up files...
437+
No old files were removed.
438+
Warning: Could not retrieve WordPress core checksums; skipping checksum-based cleanup. Files listed in $_old_files were still cleaned up.
437439
Success: WordPress updated successfully.
438440

439441

@@ -523,6 +525,10 @@ Want to contribute a new feature? Please first [open a new issue](https://github
523525

524526
Once you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See "[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)" for details specific to working on this package locally.
525527

528+
### License
529+
530+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
531+
526532
## Support
527533

528534
GitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support

features/core-download.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ Feature: Download WordPress
180180
"""
181181
Failed to find WordPress version
182182
"""
183-
And STDERR should contain:
183+
And STDERR should not contain:
184184
"""
185185
Warning: Checksums not available for WordPress nightly/en_US. Please cleanup files manually.
186186
"""

features/core-install.feature

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,78 @@ Feature: Install WordPress core
177177
"""
178178
And the return code should be 0
179179
180+
Scenario: Verify correct siteurl and home when URL has no path
181+
Given an empty directory
182+
And WP files
183+
And wp-config.php
184+
And a database
185+
186+
When I run `wp core install --url=example.com --title=Test --admin_user=wpcli --admin_email=wpcli@example.org --admin_password=password --skip-email`
187+
Then STDOUT should contain:
188+
"""
189+
Success: WordPress installed successfully.
190+
"""
191+
192+
When I run `wp option get home`
193+
Then STDOUT should be:
194+
"""
195+
http://example.com
196+
"""
197+
198+
When I run `wp option get siteurl`
199+
Then STDOUT should be:
200+
"""
201+
http://example.com
202+
"""
203+
204+
Scenario: Verify correct siteurl and home when URL has a path
205+
Given an empty directory
206+
And WP files
207+
And wp-config.php
208+
And a database
209+
210+
When I run `wp core install --url=example.com/subdir --title=Test --admin_user=wpcli --admin_email=wpcli@example.org --admin_password=password --skip-email`
211+
Then STDOUT should contain:
212+
"""
213+
Success: WordPress installed successfully.
214+
"""
215+
216+
When I run `wp option get home`
217+
Then STDOUT should be:
218+
"""
219+
http://example.com/subdir
220+
"""
221+
222+
When I run `wp option get siteurl`
223+
Then STDOUT should be:
224+
"""
225+
http://example.com/subdir
226+
"""
227+
228+
Scenario: Install ensures correct siteurl and home regardless of PHP_SELF
229+
Given an empty directory
230+
And WP files
231+
And wp-config.php
232+
And a database
233+
234+
When I run `wp core install --url=https://example.com --title=Test --admin_user=wpcli --admin_email=wpcli@example.org --admin_password=password --skip-email`
235+
Then STDOUT should contain:
236+
"""
237+
Success: WordPress installed successfully.
238+
"""
239+
240+
When I run `wp option get home`
241+
Then STDOUT should be:
242+
"""
243+
https://example.com
244+
"""
245+
246+
When I run `wp option get siteurl`
247+
Then STDOUT should be:
248+
"""
249+
https://example.com
250+
"""
251+
180252
Scenario: Install WordPress with special characters in the admin password
181253
Given an empty directory
182254
And WP files

features/core-update.feature

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Feature: Update WordPress core
2121
"""
2222
Starting update...
2323
Unpacking the update...
24+
Cleaning up files...
25+
No old files were removed.
2426
Success: WordPress updated successfully.
2527
"""
2628

@@ -420,6 +422,90 @@ Feature: Update WordPress core
420422
</div>
421423
"""
422424

425+
Scenario: Old files from $_old_files are cleaned up when upgrading
426+
Given a WP install
427+
428+
When I run `wp core download --version=6.8 --force`
429+
430+
# Create files that should be removed according to 6.9 old_files list
431+
Given a wp-includes/blocks/post-author/editor.css file:
432+
"""
433+
/* Old CSS file */
434+
"""
435+
And a wp-includes/blocks/post-author/editor.min.css file:
436+
"""
437+
/* Old minified CSS */
438+
"""
439+
And a wp-includes/blocks/post-author/editor-rtl.css file:
440+
"""
441+
/* Old RTL CSS */
442+
"""
443+
And a wp-includes/blocks/post-author/editor-rtl.min.css file:
444+
"""
445+
/* Old RTL minified CSS */
446+
"""
447+
And a wp-includes/SimplePie/src/Core.php file:
448+
"""
449+
<?php
450+
// Old SimplePie Core file
451+
"""
452+
And an empty wp-includes/SimplePie/src/Decode directory
453+
454+
When I run `wp core update --version=6.9 --force`
455+
Then STDOUT should contain:
456+
"""
457+
Success: WordPress updated successfully.
458+
"""
459+
And the wp-includes/blocks/post-author/editor.css file should not exist
460+
And the wp-includes/blocks/post-author/editor.min.css file should not exist
461+
And the wp-includes/blocks/post-author/editor-rtl.css file should not exist
462+
And the wp-includes/blocks/post-author/editor-rtl.min.css file should not exist
463+
And the wp-includes/SimplePie/src/Core.php file should not exist
464+
And the wp-includes/SimplePie/src/Decode directory should not exist
465+
466+
@require-php-7.2
467+
Scenario: Old files cleanup works when checksums unavailable
468+
Given a WP install
469+
470+
When I run `wp core download --version=6.8 --force`
471+
Then STDOUT should contain:
472+
"""
473+
Success: WordPress downloaded.
474+
"""
475+
476+
# Create files that exist in the $_old_files list from WordPress 6.9
477+
Given a wp-includes/blocks/post-author/editor.css file:
478+
"""
479+
/* Old CSS file */
480+
"""
481+
And a wp-includes/blocks/post-author/editor.min.css file:
482+
"""
483+
/* Old minified CSS */
484+
"""
485+
486+
# Mock checksum API to return empty response so checksums are unavailable
487+
And that HTTP requests to https://api.wordpress.org/core/checksums/1.0/ will respond with:
488+
"""
489+
HTTP/1.1 200
490+
Content-Type: application/json
491+
492+
{}
493+
"""
494+
495+
When I try `wp core update --version=6.9 --force`
496+
Then STDOUT should contain:
497+
"""
498+
Cleaning up files...
499+
"""
500+
And STDOUT should contain:
501+
"""
502+
Success: WordPress updated successfully.
503+
"""
504+
505+
# Verify files from $_old_files were removed
506+
And the wp-includes/blocks/post-author/editor.css file should not exist
507+
And the wp-includes/blocks/post-author/editor.min.css file should not exist
508+
423509
Scenario: Update WordPress locale without --force when version is the same
424510
Given a WP install
425511
And an empty cache
@@ -485,7 +571,7 @@ Feature: Update WordPress core
485571
"""
486572
Package language: en_US
487573
"""
488-
@require-php-7.0 @require-wp-6.1
574+
@require-wp-6.1
489575
Scenario: Attempting to downgrade without --force shows helpful message
490576
Given a WP install
491577

0 commit comments

Comments
 (0)