Skip to content

Commit 7dd1285

Browse files
authored
Merge branch 'main' into copilot/fix-multinetwork-update-db
2 parents 778d7bc + 778d5ce commit 7dd1285

File tree

8 files changed

+94
-10
lines changed

8 files changed

+94
-10
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@v6
20+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
2121

2222
- name: Check existence of composer.json file
2323
id: check_composer_file
24-
uses: andstor/file-existence-action@v3
24+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3
2525
with:
2626
files: "composer.json"
2727

2828
- name: Set up PHP environment
2929
if: steps.check_composer_file.outputs.files_exists == 'true'
30-
uses: shivammathur/setup-php@v2
30+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
3131
with:
3232
php-version: 'latest'
3333
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
@@ -38,7 +38,7 @@ jobs:
3838

3939
- name: Install Composer dependencies & cache dependencies
4040
if: steps.check_composer_file.outputs.files_exists == 'true'
41-
uses: ramsey/composer-install@v3
41+
uses: ramsey/composer-install@3cf229dc2919194e9e36783941438d17239e8520 # v3
4242
env:
4343
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }}
4444
with:

.github/workflows/issue-triage.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
11
---
2-
name: Issue Triage
2+
name: Issue and PR Triage
33

44
'on':
55
issues:
66
types: [opened]
7+
pull_request_target:
8+
types: [opened]
79
workflow_dispatch:
810
inputs:
911
issue_number:
10-
description: 'Issue number to triage (leave empty to process all)'
12+
description: 'Issue/PR number to triage (leave empty to process all)'
1113
required: false
1214
type: string
1315

16+
permissions:
17+
issues: write
18+
pull-requests: write
19+
actions: write
20+
contents: read
21+
models: read
22+
1423
jobs:
1524
issue-triage:
1625
uses: wp-cli/.github/.github/workflows/reusable-issue-triage.yml@main
1726
with:
18-
issue_number: ${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }}
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+
}}

.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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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+
]

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ Transforms an existing single-site installation into a multisite installation.
239239
wp core multisite-convert [--title=<network-title>] [--base=<url-path>] [--subdomains] [--skip-config]
240240
~~~
241241

242+
**Alias:** `install-network`
243+
242244
Creates the multisite database tables, and adds the multisite constants
243245
to wp-config.php.
244246

@@ -344,6 +346,8 @@ Updates WordPress to a newer version.
344346
wp core update [<zip>] [--minor] [--version=<version>] [--force] [--locale=<locale>] [--format=<format>] [--insecure]
345347
~~~
346348

349+
**Alias:** `upgrade`
350+
347351
Defaults to updating WordPress to the latest version.
348352

349353
If you see "Error: Another update is currently in progress.", you may

features/core-update.feature

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ Feature: Update WordPress core
330330
When I run `wp post create --post_title='Test post' --porcelain`
331331
Then STDOUT should be a number
332332

333-
@require-php-7.2
333+
@require-php-7.4
334334
Scenario Outline: Use `--version=(nightly|trunk)` to update to the latest nightly version
335335
Given a WP install
336336

@@ -350,7 +350,7 @@ Feature: Update WordPress core
350350
| trunk |
351351
| nightly |
352352

353-
@require-php-7.2
353+
@require-php-7.4
354354
Scenario: Installing latest nightly build should skip cache
355355
Given a WP install
356356

@@ -419,3 +419,21 @@ Feature: Update WordPress core
419419
"""
420420
</div>
421421
"""
422+
423+
Scenario: Show helpful tip when update is locked
424+
Given a WP install
425+
426+
When I run `wp option update core_updater.lock 100000000000000`
427+
And I try `wp core update --version=trunk`
428+
Then STDERR should contain:
429+
"""
430+
Another update is currently in progress. You may need to run `wp option delete core_updater.lock` after verifying another update isn't actually running.
431+
"""
432+
And the return code should be 1
433+
434+
# Clean up the lock
435+
When I run `wp option delete core_updater.lock`
436+
Then STDOUT should contain:
437+
"""
438+
Success:
439+
"""

src/Core_Command.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,12 @@ static function () {
12431243
if ( is_wp_error( $result ) ) {
12441244
$message = WP_CLI::error_to_string( $result );
12451245
if ( 'up_to_date' !== $result->get_error_code() ) {
1246-
WP_CLI::error( $message );
1246+
// Check if the error is related to the core_updater.lock
1247+
if ( self::is_lock_error( $result ) ) {
1248+
WP_CLI::error( rtrim( $message, '.' ) . '. You may need to run `wp option delete core_updater.lock` after verifying another update isn\'t actually running.' );
1249+
} else {
1250+
WP_CLI::error( $message );
1251+
}
12471252
} else {
12481253
WP_CLI::success( $message );
12491254
}
@@ -1684,4 +1689,21 @@ function () use ( $new_zip_file ) {
16841689
WP_CLI::error( 'ZipArchive failed to open ZIP file.' );
16851690
}
16861691
}
1692+
1693+
/**
1694+
* Checks if a WP_Error is related to the core_updater.lock.
1695+
*
1696+
* @param \WP_Error $error The error object to check.
1697+
* @return bool True if the error is related to the lock, false otherwise.
1698+
*/
1699+
private static function is_lock_error( $error ) {
1700+
// Check for the 'locked' error code used by WordPress Core
1701+
if ( 'locked' === $error->get_error_code() ) {
1702+
return true;
1703+
}
1704+
1705+
// Also check if the error message contains the lock text as a fallback
1706+
$message = WP_CLI::error_to_string( $error );
1707+
return false !== stripos( $message, 'another update is currently in progress' );
1708+
}
16871709
}

0 commit comments

Comments
 (0)