Skip to content

Commit 61695c9

Browse files
swissspidyclaude
andcommitted
Merge branch 'main' into fix/687-set-autoload-cache
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UWTd5pwpi2xQfDA6mUYkkx
2 parents c659e1e + a5bcc96 commit 61695c9

17 files changed

Lines changed: 563 additions & 51 deletions

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ jobs:
4646
id: check_behat_file
4747
run: echo "files_exists=$(test -f behat.yml && echo true || echo false)" >> "$GITHUB_OUTPUT"
4848

49-
# Downloading and starting the database server is the slowest part of the
50-
# setup and it is independent of PHP and Composer, so it runs in the
51-
# background and is waited for right before the test database is prepared.
49+
# Not run in the background: Copilot code review builds its workflow from
50+
# these steps and failed validation while they used `background` and
51+
# `wait-all`. Also, the action unpacks its binaries with the system `tar`,
52+
# which fails to load libpcre2 while setup-php upgrades it with apt.
5253
- name: Setup MySQL Server
5354
if: steps.check_behat_file.outputs.files_exists == 'true'
54-
background: true
55-
uses: shogo82148/actions-setup-mysql@fb8ae72ad9f2f8244e594d6d48a981e975aee78e # v1
55+
uses: shogo82148/actions-setup-mysql@13a38f2af408e58a0c80168fc620a63a15357339 # v1
5656
with:
5757
mysql-version: '8.0' # Standard MySQL version for these tests
5858
auto-start: true
@@ -77,9 +77,6 @@ jobs:
7777
env:
7878
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
7979

80-
- name: Wait for the MySQL server
81-
wait-all:
82-
8380
- name: Remove system MySQL binary
8481
if: steps.check_behat_file.outputs.files_exists == 'true'
8582
run: sudo rm -f /usr/bin/mysql /usr/bin/mysqldump
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Milestone Merged Pull Requests
3+
4+
'on':
5+
pull_request_target:
6+
types: [closed]
7+
branches:
8+
- main
9+
- master
10+
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
15+
jobs:
16+
milestone:
17+
uses: wp-cli/.github/.github/workflows/reusable-milestone-merged-prs.yml@main

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2880,7 +2880,7 @@ wp option list [--search=<pattern>] [--exclude=<pattern>] [--autoload=<value>] [
28802880
Pattern to exclude. Use wildcards ( * and ? ) to match option name.
28812881

28822882
[--autoload=<value>]
2883-
Match only autoload options when value is on, and only not-autoload option when off.
2883+
Match only autoload options when value is on, and only not-autoload option when off. On WordPress 6.6 and later, options with the `auto` and `auto-on` values count as autoload options.
28842884

28852885
[--transients]
28862886
List only transients. Use `--no-transients` to ignore all transients.

‎features/comment.feature‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,3 +477,24 @@ Feature: Manage WordPress comments
477477
And I run `wp comment unspam {COMMENT_ID} --url=www.example.com`
478478
And I run `wp comment trash {COMMENT_ID} --url=www.example.com`
479479
And I run `wp comment untrash {COMMENT_ID} --url=www.example.com`
480+
481+
Scenario: List more comments than are loaded from the database at a time
482+
Given a WP install
483+
And I run `wp comment generate --count=1200 --post_id=1`
484+
And I run `wp comment list --orderby=comment_ID --order=asc --format=ids`
485+
And save STDOUT as {IDS}
486+
487+
When I run `wp comment list --orderby=comment_ID --order=asc --field=comment_ID | tr '\n' ' ' | sed 's/ $//'`
488+
Then STDOUT should be:
489+
"""
490+
{IDS}
491+
"""
492+
493+
When I run `wp comment list --fields=comment_ID,comment_post_ID --format=csv | wc -l`
494+
Then STDOUT should contain:
495+
"""
496+
1202
497+
"""
498+
499+
When I run `wp comment list --orderby=comment_ID --order=asc --number=1 --fields=comment_ID,url --format=csv`
500+
Then STDOUT should match /^comment_ID,url\n(\d+),https?:\/\/example\.com\/\?p=1#comment-\1$/

‎features/option-list.feature‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,30 @@ Feature: List WordPress options
235235
"""
236236
sample_value_four
237237
"""
238+
239+
@require-wp-6.6
240+
Scenario: Using the `--autoload` flag with the values WordPress picks automatically
241+
Given a WP install
242+
And I run `wp option update sample_auto_option 'sample_value_auto'`
243+
And I run `wp eval 'add_filter( "wp_default_autoload_value", "__return_true" ); add_option( "sample_auto_on_option", "sample_value_auto_on" );'`
244+
And I run `wp eval 'add_filter( "wp_default_autoload_value", "__return_false" ); add_option( "sample_auto_off_option", "sample_value_auto_off" );'`
245+
246+
When I run `wp option list --search="sample_auto*" --fields=option_name,autoload --orderby=option_name`
247+
Then STDOUT should be a table containing rows:
248+
| option_name | autoload |
249+
| sample_auto_off_option | auto-off |
250+
| sample_auto_on_option | auto-on |
251+
| sample_auto_option | auto |
252+
253+
When I run `wp option list --autoload=on --search="sample_auto*" --field=option_name --orderby=option_name`
254+
Then STDOUT should be:
255+
"""
256+
sample_auto_on_option
257+
sample_auto_option
258+
"""
259+
260+
When I run `wp option list --autoload=off --search="sample_auto*" --field=option_name`
261+
Then STDOUT should be:
262+
"""
263+
sample_auto_off_option
264+
"""

‎features/post-revision.feature‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,40 @@ Feature: Manage WordPress post revisions
150150
When I run `wp post revision diff {REVISION_ID} --field=post_title`
151151
Then the return code should be 0
152152

153+
Scenario: Diff shows percent signs in the compared content as they are
154+
When I run `wp post create --post_title='Percent Test' --post_content='Start' --porcelain`
155+
Then STDOUT should be a number
156+
And save STDOUT as {POST_ID}
157+
158+
When I run `wp post update {POST_ID} --post_content='Progress: 100%'`
159+
Then STDOUT should contain:
160+
"""
161+
Success: Updated post {POST_ID}.
162+
"""
163+
164+
When I run `wp post update {POST_ID} --post_content='Progress: 100% of https://example.com/my%20file.pdf'`
165+
Then STDOUT should contain:
166+
"""
167+
Success: Updated post {POST_ID}.
168+
"""
169+
170+
When I run `wp post list --post_type=revision --post_parent={POST_ID} --fields=ID --format=ids --orderby=ID --order=ASC`
171+
Then STDOUT should not be empty
172+
And save STDOUT as {REVISION_IDS}
173+
174+
When I run `echo "{REVISION_IDS}" | awk '{print $1}'`
175+
Then save STDOUT as {REVISION_ID_1}
176+
177+
When I run `echo "{REVISION_IDS}" | awk '{print $2}'`
178+
Then save STDOUT as {REVISION_ID_2}
179+
180+
When I run `wp post revision diff {REVISION_ID_1} {REVISION_ID_2}`
181+
Then STDOUT should contain:
182+
"""
183+
- Progress: 100%
184+
+ Progress: 100% of https://example.com/my%20file.pdf
185+
"""
186+
153187
Scenario: Prune revisions keeping latest N
154188
When I run `wp post create --post_title='Prune Test' --post_content='Version 1' --porcelain`
155189
Then STDOUT should be a number

‎features/post-term.feature‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,62 @@ Feature: Manage post term
201201
| term_id | name | slug |
202202
| 3 | 4 | 4 |
203203

204+
Scenario: Set or add terms by a term id that does not exist
205+
Given a WP install
206+
207+
When I run `wp post term add 1 post_tag apple banana`
208+
Then STDOUT should be:
209+
"""
210+
Success: Added terms.
211+
"""
212+
213+
When I try `wp post term set 1 post_tag 9999 --by=id`
214+
Then STDERR should be:
215+
"""
216+
Error: Could not find any term with the given ID.
217+
"""
218+
And STDOUT should be empty
219+
And the return code should be 1
220+
221+
When I try `wp post term add 1 post_tag 9998 9999 --by=id`
222+
Then STDERR should be:
223+
"""
224+
Error: Could not find any term with the given IDs.
225+
"""
226+
And STDOUT should be empty
227+
And the return code should be 1
228+
229+
When I run `wp post term list 1 post_tag --field=slug`
230+
Then STDOUT should contain:
231+
"""
232+
apple
233+
"""
234+
And STDOUT should contain:
235+
"""
236+
banana
237+
"""
238+
239+
Scenario: Remove a term that is not assigned to the post
240+
Given a WP install
241+
242+
When I run `wp post term add 1 post_tag apple`
243+
And I run `wp term create post_tag banana`
244+
Then STDOUT should not be empty
245+
246+
When I try `wp post term remove 1 post_tag banana`
247+
Then STDERR should be:
248+
"""
249+
Error: Failed to remove term.
250+
"""
251+
And STDOUT should be empty
252+
And the return code should be 1
253+
254+
When I run `wp post term list 1 post_tag --field=slug`
255+
Then STDOUT should be:
256+
"""
257+
apple
258+
"""
259+
204260
Scenario: Remove all terms from post
205261
Given a WP install
206262

‎features/post.feature‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,3 +1157,99 @@ Feature: Manage WordPress posts
11571157
2021-02-02
11581158
"""
11591159
And STDOUT should not be empty
1160+
1161+
Scenario: List more posts than are loaded from the database at a time
1162+
Given a WP install
1163+
And I run `wp post generate --count=1200 --post_date="2020-01-01 00:00:00"`
1164+
And I run `wp post list --post_status=publish --orderby=ID --order=asc --format=ids`
1165+
And save STDOUT as {IDS}
1166+
1167+
When I run `wp post list --post_status=publish --orderby=ID --order=asc --field=ID | tr '\n' ' ' | sed 's/ $//'`
1168+
Then STDOUT should be:
1169+
"""
1170+
{IDS}
1171+
"""
1172+
1173+
When I run `wp post list --post_status=publish --orderby=ID --order=asc --fields=ID,post_title --format=csv | wc -l`
1174+
Then STDOUT should contain:
1175+
"""
1176+
1202
1177+
"""
1178+
1179+
When I run `wp post list --post_status=publish --orderby=ID --order=desc --posts_per_page=2 --fields=ID,url --format=csv`
1180+
Then STDOUT should match /^ID,url\n(\d+),https?:\/\/example\.com\/\?p=\1\n(\d+),https?:\/\/example\.com\/\?p=\2$/
1181+
1182+
# An offset that spans more than one chunk must only be applied once.
1183+
When I run `wp post list --post_status=publish --orderby=ID --order=asc --posts_per_page=600 --offset=450 --format=ids`
1184+
Then save STDOUT as {OFFSET_IDS}
1185+
1186+
When I run `wp post list --post_status=publish --orderby=ID --order=asc --posts_per_page=600 --offset=450 --field=ID | tr '\n' ' ' | sed 's/ $//'`
1187+
Then STDOUT should be:
1188+
"""
1189+
{OFFSET_IDS}
1190+
"""
1191+
1192+
When I run `wp post list --post_status=publish --orderby=ID --order=asc --posts_per_page=600 --offset=450 --field=ID | wc -l`
1193+
Then STDOUT should contain:
1194+
"""
1195+
600
1196+
"""
1197+
1198+
When I run `wp post list --post_status=publish --orderby=ID --order=asc --posts_per_page=600 --paged=2 --format=ids`
1199+
Then save STDOUT as {PAGED_IDS}
1200+
1201+
When I run `wp post list --post_status=publish --orderby=ID --order=asc --posts_per_page=600 --paged=2 --field=ID | tr '\n' ' ' | sed 's/ $//'`
1202+
Then STDOUT should be:
1203+
"""
1204+
{PAGED_IDS}
1205+
"""
1206+
1207+
When I run `wp post list --post_status=publish --orderby=ID --order=asc --posts_per_page=600 --paged=2 --field=ID | wc -l`
1208+
Then STDOUT should contain:
1209+
"""
1210+
600
1211+
"""
1212+
1213+
Scenario: Sticky posts are not prepended to the post list
1214+
Given a WP install
1215+
And I run `wp post create --post_title=Sticky --post_status=publish --post_date="2020-01-01 00:00:00" --porcelain`
1216+
And save STDOUT as {STICKY}
1217+
And I run `wp option update sticky_posts '[{STICKY}]' --format=json`
1218+
And I run `wp post create --post_title=Draft --post_status=draft --porcelain`
1219+
And save STDOUT as {DRAFT}
1220+
And I run `wp post create --post_title=Latest --post_status=publish --porcelain`
1221+
And save STDOUT as {LATEST}
1222+
1223+
When I run `wp post list --post_status=draft --field=ID`
1224+
Then STDOUT should be:
1225+
"""
1226+
{DRAFT}
1227+
"""
1228+
1229+
When I run `wp post list --post_status=publish --orderby=ID --order=desc --posts_per_page=1 --field=ID`
1230+
Then STDOUT should be:
1231+
"""
1232+
{LATEST}
1233+
"""
1234+
1235+
Scenario: List post meta as a field for some posts only
1236+
Given a WP install
1237+
And I run `wp post create --post_title=First --post_status=publish --porcelain`
1238+
And save STDOUT as {FIRST}
1239+
And I run `wp post create --post_title=Second --post_status=publish --porcelain`
1240+
And save STDOUT as {SECOND}
1241+
And I run `wp post meta add {SECOND} batch_meta second-value`
1242+
1243+
When I run `wp post list --post__in={FIRST},{SECOND} --orderby=ID --order=asc --fields=ID,batch_meta --format=csv`
1244+
Then STDOUT should be:
1245+
"""
1246+
ID,batch_meta
1247+
{FIRST},
1248+
{SECOND},second-value
1249+
"""
1250+
1251+
When I try `wp post list --post__in={FIRST},{SECOND} --fields=ID,missing_meta --format=csv`
1252+
Then STDERR should be:
1253+
"""
1254+
Warning: Field not found in any item: missing_meta.
1255+
"""

‎features/user.feature‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,3 +1035,42 @@ Feature: Manage WordPress users
10351035
"""
10361036
true
10371037
"""
1038+
1039+
Scenario: List more users than are loaded from the database at a time
1040+
Given a WP install
1041+
And I run `wp user generate --count=600`
1042+
And I run `wp user meta update 1 batch_meta admin-value`
1043+
And I run `wp user list --orderby=ID --order=asc --format=ids`
1044+
And save STDOUT as {IDS}
1045+
1046+
When I run `wp user list --orderby=ID --order=asc --field=ID | tr '\n' ' ' | sed 's/ $//'`
1047+
Then STDOUT should be:
1048+
"""
1049+
{IDS}
1050+
"""
1051+
1052+
When I run `wp user list --fields=ID,user_login,roles --format=csv | wc -l`
1053+
Then STDOUT should contain:
1054+
"""
1055+
602
1056+
"""
1057+
1058+
When I run `wp user list --orderby=ID --order=asc --number=2 --fields=ID,batch_meta,roles --format=csv`
1059+
Then STDOUT should be:
1060+
"""
1061+
ID,batch_meta,roles
1062+
1,admin-value,administrator
1063+
2,,subscriber
1064+
"""
1065+
1066+
Scenario: List a user once when it matches the query more than once
1067+
Given a WP install
1068+
And I run `wp user meta add 1 last_activity 5`
1069+
And I run `wp user meta add 1 last_activity 7`
1070+
1071+
When I run `wp user list --meta_key=last_activity --orderby=meta_value_num --fields=ID,roles --format=csv`
1072+
Then STDOUT should be:
1073+
"""
1074+
ID,roles
1075+
1,administrator
1076+
"""

0 commit comments

Comments
 (0)