8000 Add `--actual` flag to show database version from options table in multisite by Copilot · Pull Request #306 · wp-cli/core-command · GitHub
[go: up one dir, main page]

Skip to content

Add --actual flag to show database version from options table in multisite#306

Open
Copilot wants to merge 11 commits intomainfrom
copilot/fix-multisite-db-version-reporting
Open

Add --actual flag to show database version from options table in multisite#306
Copilot wants to merge 11 commits intomainfrom
copilot/fix-multisite-db-version-reporting

Conversation

Copy link
Contributor
Copilot AI commented Feb 2, 2026

Plan: Fix wp core version --extra multisite database version reporting

Understanding the Issue

  • wp core version --extra shows the expected/target database version from wp-includes/version.php
  • In multisite, each site can have its own actual database version in wp_XX_options table
  • When running with --url for a specific site, users expect to see that site's actual database version
  • Currently, the command shows the expected version, not the actual version

Solution Approach (based on maintainer comment)

Per @danielbachhuber's comment: "I wouldn't change the existing behavior. We could solve this with documentation, or some special flag."

Proposed minimal change: Add a new flag --actual to show the actual database version from the database (requires WordPress to be loaded)

Implementation Approach

Following @swissspidy's feedback, use WP_CLI::get_runner()->load_wordpress() to conditionally load WordPress when the --actual flag is passed, similar to how the eval command works.

Checklist

  • Understand the current implementation of version command
  • Design the minimal change approach
  • Modify the version command to support --actual flag
  • Use load_wordpress() helper to conditionally load WordPress
  • Remove helper command delegation pattern
  • Update command documentation
  • Add Behat tests for the new functionality
  • Fix linting and phpstan issues
  • Address all code review feedback
  • Run security checks
  • Fix test expectations to use WordPress 6.6 database revision (57155)
  • Final validation complete

Summary

All changes have been implemented, tested, and reviewed. The implementation:

  • Preserves backward compatibility
  • Adds minimal, focused new functionality
  • Uses the standard WP-CLI pattern for conditional WordPress loading
  • Includes comprehensive tests with correct expectations for WordPress 6.6
  • Addresses all security and code quality concerns
  • No longer uses helper command delegation - directly loads WordPress when needed
Original prompt

This section details on the original issue you should resolve

<issue_title>wp core version --extra misreports multisite site db version</issue_title>
<issue_description>## Bug Report

Describe the current, buggy behavior

With a multisite install I wanted to confirm the database version of a site within the network.

I expected the wp core version --extra --url-example.com/site command to achieve this accurately, it did not.

Describe how other contributors can replicate this bug

To do so I ran the command:

wp core version --extra --url-example.com/site

The results of that command were:

WordPress version: 5.3
Database revision: 45805
TinyMCE version:   4.960 (4960-20190918)
Package language:  en_US

I then examined the wp_XX_options table related to the --url site listed in the previous command, the value of the db_version option was 37965

I then ran the command:

wp core update-db --url=url-example.com/site

The results of that command were:

Success: WordPress database upgraded successfully from db version 37965 to 45805.

Re-examining the wp_XX_options table related to the --url site listed in the previous command, the value of the db_version option is now 45805

Describe what you would expect as the correct outcome

When I run the command:

wp core version --extra --url-example.com/site

The results that I expect would be:

WordPress version: 5.3
Database revision: 37965
TinyMCE version:   4.960 (4960-20190918)
Package language:  en_US

Provide a possible solution

If you happen to have a suggestion on how to fix this bug, please tell us in here.

Just leave this section out if you don't know how to fix it.

Provide additional context/Screenshots

Add any other context about the problem here.

If applicable, add screenshots to help explain (you can just drag&drop images into the Github issue).
</issue_description>

Comments on the Issue (you are @copilot in this section)

@danielbachhuber Thanks for the report, @ntwb. This would be nice to get fixed. @ernilambar @danielbachhuber Currently we are fetching details from `wp-includes...

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 2, 2026 01:36
… reporting

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…bcommand

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix misreporting of multisite site db version Add --actual flag to show database version from options table in multisite Feb 2, 2026
Copilot AI requested a review from swissspidy February 2, 2026 01:45
@github-actions github-actions bot added bug command:core-version Related to 'core version' command scope:testing Related to testing labels Feb 2, 2026
@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@codecov
Copy link
codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Core_Command.php 94.44% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

This comment was marked as resolved.

@swissspidy swissspidy requested a review from Copilot February 18, 2026 15:35

This comment was marked as resolved.

@swissspidy swissspidy marked this pull request as ready for review March 13, 2026 10:34
@swissspidy swissspidy requested a review from a team as a code owner March 13, 2026 10:34
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI requested a review from swissspidy March 14, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:core-version Related to 'core version' command scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wp core version --extra misreports multisite site db version

3 participants

0