Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move variables back to top of version.php file to fix WPCLI #396

Merged
merged 1 commit into from Mar 6, 2019

Conversation

Projects
None yet
2 participants
@Pross
Copy link
Contributor

Pross commented Mar 5, 2019

Description

WPCLI only fetches the first 2048 bytes of the version file with file_get_contents and so is returning invalid versions.
See https://forums.classicpress.net/t/wp-cli-compatibility/891/
This is where the parse instead of include was merged into wpcli wp-cli/wp-cli#2459

Motivation and context

wp core version --extra
WordPress version: 
Database revision: 
TinyMCE version:
Package language: en_US

How has this been tested?

Tested against latest develop branch

WordPress version: 4.9.9
Database revision: 38590
TinyMCE version:   4.800 (4800-20180716)
Package language:  en_US

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
Move variables back to top of file.
WPCLI only fetches the first 2048 bytes of the version file with file_get_contents and so is returning invalid versions.
See https://forums.classicpress.net/t/wp-cli-compatibility/891/
This is where the parse instead of include was merged into wpcli wp-cli/wp-cli#2459

@Mte90 Mte90 requested a review from nylen Mar 5, 2019

@nylen nylen added this to the v1.0.1 milestone Mar 5, 2019

@nylen

This comment has been minimized.

Copy link
Member

nylen commented Mar 6, 2019

Thanks for the PR!

This fixes wp core version --extra, but not wp core check-update (the other issue reported in the forum thread).

I was curious about a few more details. I found that WP-CLI extracts the following variables from the version.php file:

https://github.com/wp-cli/core-command/blob/ffeaf3e3a801be99df78955bcb86670900f3415c/src/Core_Command.php#L845

Our explanatory comment for the $cp_version variable is pretty long, so I also checked where you get to in our version.php file if you read the first 2048 bytes:

https://github.com/ClassicPress/ClassicPress/pull/396/files#diff-cf3602dbbc7654a7f09aac1e6ec7456eR62

So, with this change, all variables that WP-CLI tries to read are successfully parsed.

@nylen

nylen approved these changes Mar 6, 2019

Copy link
Member

nylen left a comment

This will be in our next release (1.0.1, no date set yet) and also in tomorrow's nightly build (https://github.com/ClassyBot/ClassicPress-nightly/releases/tag/1.0.0+nightly.20190306, will appear at midnight UTC).

@nylen nylen merged commit b75ade7 into ClassicPress:develop Mar 6, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.