Skip to content

Commit 059fbe4

Browse files
authored
Merge branch 'main' into 165-show-boolean-literal
2 parents 39c02df + e7f0c34 commit 059fbe4

14 files changed

Lines changed: 876 additions & 33 deletions
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Check Branch Alias
2+
3+
on:
4+
release:
5+
types: [released]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
check-branch-alias:
14+
uses: wp-cli/.github/.github/workflows/reusable-check-branch-alias.yml@main

.github/workflows/code-quality.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
branches:
77
- main
88
- master
9+
schedule:
10+
- cron: '17 2 * * *' # Run every day on a seemly random time.
911

1012
jobs:
1113
code-quality:
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "Copilot Setup Steps"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
pull_request:
9+
paths:
10+
- .github/workflows/copilot-setup-steps.yml
11+
12+
jobs:
13+
copilot-setup-steps:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
21+
22+
- name: Check existence of composer.json file
23+
id: check_composer_file
24+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
25+
with:
26+
files: "composer.json"
27+
28+
- name: Set up PHP environment
29+
if: steps.check_composer_file.outputs.files_exists == 'true'
30+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
31+
with:
32+
php-version: 'latest'
33+
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
34+
coverage: 'none'
35+
tools: composer,cs2pr
36+
env:
37+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Install Composer dependencies & cache dependencies
40+
if: steps.check_composer_file.outputs.files_exists == 'true'
41+
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3
42+
env:
43+
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
44+
with:
45+
# Bust the cache at least once a month - output format: YYYY-MM.
46+
custom-cache-suffix: $(date -u "+%Y-%m")

.github/workflows/issue-triage.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Issue and PR Triage
3+
4+
'on':
5+
issues:
6+
types: [opened]
7+
pull_request_target:
8+
types: [opened]
9+
workflow_dispatch:
10+
inputs:
11+
issue_number:
12+
description: 'Issue/PR number to triage (leave empty to process all)'
13+
required: false
14+
type: string
15+
16+
permissions:
17+
issues: write
18+
pull-requests: write
19+
actions: write
20+
contents: read
21+
models: read
22+
23+
jobs:
24+
issue-triage:
25+
uses: wp-cli/.github/.github/workflows/reusable-issue-triage.yml@main
26+
with:
27+
issue_number: >-
28+
${{
29+
(github.event_name == 'workflow_dispatch' && inputs.issue_number) ||
30+
(github.event_name == 'pull_request_target' && github.event.pull_request.number) ||
31+
(github.event_name == 'issues' && github.event.issue.number) ||
32+
''
33+
}}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Manage Labels
3+
4+
'on':
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
- master
10+
paths:
11+
- 'composer.json'
12+
13+
permissions:
14+
issues: write
15+
contents: read
16+
17+
jobs:
18+
manage-labels:
19+
uses: wp-cli/.github/.github/workflows/reusable-manage-labels.yml@main

.github/workflows/regenerate-readme.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
- "features/**"
1111
- "README.md"
1212

13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
1317
jobs:
1418
regenerate-readme:
1519
uses: wp-cli/.github/.github/workflows/reusable-regenerate-readme.yml@main
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Welcome New Contributors
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
branches:
7+
- main
8+
- master
9+
10+
permissions:
11+
pull-requests: write
12+
13+
jobs:
14+
welcome:
15+
uses: wp-cli/.github/.github/workflows/reusable-welcome-new-contributors.yml@main

.typos.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[default]
2+
extend-ignore-re = [
3+
"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$",
4+
"(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on",
5+
"(#|//)\\s*spellchecker:ignore-next-line\\n.*"
6+
]
7+
8+
[files]
9+
extend-exclude = [
10+
"features/*.feature"
11+
]

README.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ wp config
4646
$ wp config get table_prefix
4747
wp_
4848

49+
# Add a new constant to the wp-config.php file.
50+
$ wp config add WP_DEBUG true --raw
51+
Success: Added the constant 'WP_DEBUG' to the 'wp-config.php' file with the raw value 'true'.
52+
53+
# Update or add a constant to the wp-config.php file.
54+
$ wp config update WP_DEBUG false --raw
55+
Success: Updated the constant 'WP_DEBUG' in the 'wp-config.php' file with the raw value 'false'.
56+
4957
# Set the WP_DEBUG constant to true.
5058
$ wp config set WP_DEBUG true --raw
5159
Success: Updated the constant 'WP_DEBUG' in the 'wp-config.php' file with the raw value 'true'.
@@ -73,6 +81,65 @@ wp config
7381

7482

7583

84+
### wp config add
85+
86+
Adds a new constant or variable to the wp-config.php file.
87+
88+
~~~
89+
wp config add <name> <value> [--raw] [--anchor=<anchor>] [--placement=<placement>] [--separator=<separator>] [--type=<type>] [--config-file=<path>]
90+
~~~
91+
92+
**OPTIONS**
93+
94+
<name>
95+
Name of the wp-config.php constant or variable.
96+
97+
<value>
98+
Value to set the wp-config.php constant or variable to.
99+
100+
[--raw]
101+
Place the value into the wp-config.php file as is, instead of as a quoted string.
102+
103+
[--anchor=<anchor>]
104+
Anchor string where additions of new values are anchored around.
105+
Defaults to "/* That's all, stop editing!".
106+
The special case "EOF" string uses the end of the file as the anchor.
107+
108+
[--placement=<placement>]
109+
Where to place the new values in relation to the anchor string.
110+
---
111+
default: 'before'
112+
options:
113+
- before
114+
- after
115+
---
116+
117+
[--separator=<separator>]
118+
Separator string to put between an added value and its anchor string.
119+
The following escape sequences will be recognized and properly interpreted: '\n' => newline, '\r' => carriage return, '\t' => tab.
120+
Defaults to a single EOL ("\n" on *nix and "\r\n" on Windows).
121+
122+
[--type=<type>]
123+
Type of the config value to add. Defaults to 'constant'.
124+
---
125+
default: constant
126+
options:
127+
- constant
128+
- variable
129+
---
130+
131+
[--config-file=<path>]
132+
Specify the file path to the config file to be modified. Defaults to the root of the
133+
WordPress installation and the filename "wp-config.php".
134+
135+
**EXAMPLES**
136+
137+
# Add the WP_DEBUG constant to the wp-config.php file.
138+
$ wp config add WP_DEBUG true --raw
139+
Success: Added the constant 'WP_DEBUG' to the 'wp-config.php' file with the raw value 'true'.
140+
141+
142+
76143
### wp config edit
77144

78145
Launches system editor to edit the wp-config.php file.
@@ -153,6 +220,9 @@ the database constants are correct.
153220

154221
[--dbpass=<dbpass>]
155222
Set the database user password.
223+
---
224+
sensitive: true
225+
---
156226

157227
[--dbhost=<dbhost>]
158228
Set the database host.
@@ -528,6 +598,68 @@ wp config shuffle-salts [<keys>...] [--force] [--config-file=<path>] [--insecure
528598
$ wp config shuffle-salts WP_CACHE_KEY_SALT --force
529599
Success: Shuffled the salt keys.
530600

601+
602+
603+
### wp config update
604+
605+
Updates or adds a constant or variable in the wp-config.php file.
606+
607+
~~~
608+
wp config update <name> <value> [--raw] [--anchor=<anchor>] [--placement=<placement>] [--separator=<separator>] [--type=<type>] [--config-file=<path>]
609+
~~~
610+
611+
This command will add the constant or variable if it doesn't exist, or update it if it does.
612+
613+
**OPTIONS**
614+
615+
<name>
616+
Name of the wp-config.php constant or variable.
617+
618+
<value>
619+
Value to set the wp-config.php constant or variable to.
620+
621+
[--raw]
622+
Place the value into the wp-config.php file as is, instead of as a quoted string.
623+
624+
[--anchor=<anchor>]
625+
Anchor string where additions of new values are anchored around.
626+
Defaults to "/* That's all, stop editing!".
627+
The special case "EOF" string uses the end of the file as the anchor.
628+
629+
[--placement=<placement>]
630+
Where to place the new values in relation to the anchor string.
631+
---
632+
default: 'before'
633+
options:
634+
- before
635+
- after
636+
---
637+
638+
[--separator=<separator>]
639+
Separator string to put between an added value and its anchor string.
640+
The following escape sequences will be recognized and properly interpreted: '\n' => newline, '\r' => carriage return, '\t' => tab.
641+
Defaults to a single EOL ("\n" on *nix and "\r\n" on Windows).
642+
643+
[--type=<type>]
644+
Type of the config value to update. Defaults to 'all'.
645+
---
646+
default: all
647+
options:
648+
- constant
649+
- variable
650+
- all
651+
---
652+
653+
[--config-file=<path>]
654+
Specify the file path to the config file to be modified. Defaults to the root of the
655+
WordPress installation and the filename "wp-config.php".
656+
657+
**EXAMPLES**
658+
659+
# Update or add the WP_DEBUG constant to the wp-config.php file.
660+
$ wp config update WP_DEBUG true --raw
661+
Success: Updated the constant 'WP_DEBUG' in the 'wp-config.php' file with the raw value 'true'.
662+
531663
## Installing
532664

533665
This package is included with WP-CLI itself, no additional installation necessary.

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"require": {
20-
"wp-cli/wp-cli": "^2.12",
20+
"wp-cli/wp-cli": "^2.13",
2121
"wp-cli/wp-config-transformer": "^1.4.0"
2222
},
2323
"require-dev": {
@@ -41,6 +41,7 @@
4141
"bundled": true,
4242
"commands": [
4343
"config",
44+
"config add",
4445
"config edit",
4546
"config delete",
4647
"config create",
@@ -50,7 +51,8 @@
5051
"config list",
5152
"config path",
5253
"config set",
53-
"config shuffle-salts"
54+
"config shuffle-salts",
55+
"config update"
5456
]
5557
},
5658
"autoload": {

0 commit comments

Comments
 (0)