Skip to content

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

Draft
Copilot wants to merge 7 commits intomainfrom
copilot/fix-multisite-db-version-reporting
Draft

Add --actual flag to show database version from options table in multisite#306
Copilot wants to merge 7 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)

Checklist

  • Understand the current implementation of version command
  • Design the minimal change approach
  • Modify the version command to support --actual flag
  • Add helper command version-db-actual that loads WordPress to query database
  • Update command documentation
  • Add Behat tests for the new functionality
  • Fix linting and phpstan issues
  • Address all code review feedback:
    • Remove escapeshellarg initially (WP-CLI handles it)
    • Rename subcommand to follow conventions
    • Extract TinyMCE version formatting helper
    • Improve PHPDoc for better accuracy
    • Re-add escapeshellarg for security (prevent potential command injection)
    • Make PHPDoc more specific for type safety
  • 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
  • Follows WP-CLI conventions
  • Includes comprehensive tests with correct expectations for WordPress 6.6
  • Addresses all security and code quality concerns
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
@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 66.66667% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Core_Command.php 66.66% 12 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wp core version --extra misreports multisite site db version

2 participants