wp-cli / core-command

Downloads, installs, updates, and manages a WordPress installation.
MIT License
49 stars 50 forks source link

wp core version --extra option result in Error: Couldn't find versions.mustache #160

Closed evantill closed 1 year ago

evantill commented 4 years ago

Bug Report

Describe the current, buggy behavior

wp core version using the --extraoption complains about a missing file.

Describe how other contributors can replicate this bug

Let us know what environment you are running this on

❯ wp cli info                                                                                                                                               16:50:30
OS: Darwin 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64
Shell:  /usr/local/bin/fish
PHP binary: /usr/bin/php
PHP version:    7.1.23
php.ini used:   /etc/php.ini
WP-CLI root dir:    phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:  phar://wp-cli.phar/vendor
WP_CLI phar path:   /Users/ericvantillard/dev/owd
WP-CLI packages dir:    /Users/ericvantillard/.wp-cli/packages/
WP-CLI global config:   /Users/ericvantillard/.wp-cli/config.yml
WP-CLI project config:  /Users/ericvantillard/wp-cli.yml
WP-CLI version: 2.4.0
evantill commented 4 years ago

is this issue related to https://github.com/wp-cli/core-command/issues/72 ?

wojsmol commented 4 years ago

This is working for me on a dev server

user@devserver:~/web/example.com/public_html$ wp --info
OS:     Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.51-3 (2017-12-13) x86_64
Shell:  /bin/bash
PHP binary:     /usr/bin/php7.0
PHP version:    7.0.33-1~dotdeb+8.1
php.ini used:   /etc/php/7.0/cli/php.ini
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /home/user/web/example.com/public_html
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:  /home/user/web/example.com/public_html/wp-cli.yml
WP-CLI version: 2.4.0
user@devserver~/web/example.com/public_html$ wp core version --extra
WordPress version: 5.3.4
Database revision: 45805
TinyMCE version:   4.960 (4960-20190918)
Package language:  en_US
evantill commented 4 years ago

Trying to be closer to your wp --info the problem is still here :

xxx@xxx:~$ wp cli info
OS: Linux 4.9.0-0.bpo.9-amd64 #1 SMP Debian 4.9.168-1+deb9u3~deb8u1 (2019-06-17) x86_64
Shell:  /bin/bash
PHP binary: /opt/plesk/php/7.2/bin/php
PHP version:    7.2.31
php.ini used:   /opt/plesk/php/7.2/etc/php.ini
WP-CLI root dir:    phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:  phar://wp-cli.phar/vendor
WP_CLI phar path:   /var/www/vhosts/xxx
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:  /var/www/vhosts/xxx/wp-cli.yml
WP-CLI version: 2.4.0
xxx@xxx:~$ wp core version --debug --extra
Debug (bootstrap): Fallback autoloader paths: phar://wp-cli.phar/vendor/autoload.php (0.012s)
Debug (bootstrap): Loading detected autoloader: phar://wp-cli.phar/vendor/autoload.php (0.012s)
Debug (commands): Adding command: cache (0.017s)
Debug (commands): Adding command: transient (0.018s)
Debug (commands): Adding command: comment (0.019s)
Debug (commands): Adding command: meta in comment Namespace (0.02s)
Debug (commands): Adding command: menu (0.021s)
Debug (commands): Adding command: item in menu Namespace (0.021s)
Debug (commands): Adding command: location in menu Namespace (0.022s)
Debug (commands): Deferring command: network meta (0.022s)
Debug (commands): Adding command: option (0.023s)
Debug (commands): Adding command: post (0.024s)
Debug (commands): Adding command: meta in post Namespace (0.024s)
Debug (commands): Adding command: term in post Namespace (0.025s)
Debug (commands): Adding command: post-type (0.025s)
Debug (commands): Adding command: site (0.026s)
Debug (commands): Adding command: meta in site Namespace (0.027s)
Debug (commands): Adding command: option in site Namespace (0.028s)
Debug (commands): Adding command: taxonomy (0.028s)
Debug (commands): Adding command: term (0.029s)
Debug (commands): Adding command: meta in term Namespace (0.029s)
Debug (commands): Adding command: user (0.031s)
Debug (commands): Adding command: meta in user Namespace (0.032s)
Debug (commands): Adding command: session in user Namespace (0.032s)
Debug (commands): Adding command: term in user Namespace (0.032s)
Debug (commands): Adding command: network (0.032s)
Debug (hooks): Processing hook "after_add_command:network" with 1 callbacks (0.033s)
Debug (hooks): On hook "after_add_command:network": Closure in file phar:///var/www/vhosts/xxx/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 634 (0.033s)
Debug (commands): Adding command: meta in network Namespace (0.033s)
Debug (commands): Adding command: db (0.035s)
Debug (commands): Adding command: plugin (0.038s)
Debug (commands): Adding command: theme (0.04s)
Debug (commands): Adding command: mod in theme Namespace (0.04s)
Debug (commands): Adding command: scaffold (0.042s)
Debug (commands): Adding command: core (0.042s)
Debug (commands): Adding command: verify-checksums in core Namespace (0.043s)
Debug (commands): Adding command: verify-checksums in plugin Namespace (0.043s)
Debug (commands): Adding command: export (0.044s)
Debug (commands): Adding command: config (0.045s)
Debug (commands): Adding command: core (0.048s)
Debug (commands): Adding command: eval (0.048s)
Debug (commands): Adding command: eval-file (0.048s)
Debug (commands): Adding command: import (0.049s)
Debug (commands): Adding command: media (0.05s)
Debug (commands): Adding command: package (0.052s)
Debug (commands): Adding command: cron (0.053s)
Debug (commands): Adding command: event in cron Namespace (0.053s)
Debug (commands): Adding command: schedule in cron Namespace (0.054s)
Debug (commands): Adding command: embed (0.054s)
Debug (commands): Adding command: fetch in embed Namespace (0.054s)
Debug (commands): Adding command: provider in embed Namespace (0.055s)
Debug (commands): Adding command: handler in embed Namespace (0.055s)
Debug (commands): Adding command: cache in embed Namespace (0.055s)
Debug (commands): Adding command: i18n (0.056s)
Debug (commands): Adding command: make-pot in i18n Namespace (0.057s)
Debug (commands): Adding command: make-json in i18n Namespace (0.057s)
Debug (commands): Deferring command: language core (0.058s)
Debug (commands): Deferring command: language plugin (0.059s)
Debug (commands): Deferring command: language theme (0.059s)
Debug (hooks): Immediately invoking on passed hook "after_add_command:site": Closure in file phar:///var/www/vhosts/xxx/bin/wp/vendor/wp-cli/language-command/language-command.php at line 39 (0.059s)
Debug (commands): Adding command: switch-language in site Namespace (0.059s)
Debug (commands): Adding command: language (0.06s)
Debug (hooks): Processing hook "after_add_command:language" with 3 callbacks (0.06s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///var/www/vhosts/xxx/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 634 (0.06s)
Debug (commands): Adding command: core in language Namespace (0.06s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///var/www/vhosts/xxx/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 634 (0.06s)
Debug (commands): Adding command: plugin in language Namespace (0.06s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///var/www/vhosts/xxx/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 634 (0.06s)
Debug (commands): Adding command: theme in language Namespace (0.06s)
Debug (commands): Adding command: maintenance-mode (0.061s)
Debug (commands): Adding command: rewrite (0.061s)
Debug (commands): Adding command: rewrite (0.062s)
Debug (commands): Adding command: cap (0.062s)
Debug (commands): Adding command: role (0.063s)
Debug (commands): Adding command: search-replace (0.064s)
Debug (commands): Adding command: server (0.065s)
Debug (commands): Adding command: shell (0.065s)
Debug (commands): Adding command: super-admin (0.066s)
Debug (commands): Adding command: widget (0.066s)
Debug (commands): Adding command: sidebar (0.067s)
Debug (bootstrap): Adding framework command: phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/cli.php (0.067s)
Debug (commands): Adding command: cli (0.069s)
Debug (commands): Adding command: cache in cli Namespace (0.069s)
Debug (commands): Adding command: alias in cli Namespace (0.069s)
Debug (bootstrap): Adding framework command: phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/help.php (0.069s)
Debug (commands): Adding command: help (0.07s)
Debug (bootstrap): No readable global config found (0.07s)
Debug (bootstrap): Using project config: /var/www/vhosts/xxx/wp-cli.yml (0.07s)
Debug (bootstrap): argv: /var/www/vhosts/xxx/bin/wp core version --debug --extra (0.07s)
Debug (bootstrap): ABSPATH defined: /var/www/vhosts/xxx/httpdocs/ (0.07s)
Debug (hooks): Processing hook "before_run_command" with 1 callbacks (0.07s)
Debug (hooks): On hook "before_run_command": WP_CLI\Bootstrap\RegisterDeferredCommands->add_deferred_commands() (0.07s)
Debug (bootstrap): Running command: core version (0.07s)
Error: Couldn't find versions.mustache
evantill commented 4 years ago

same bug trying php version 7.0.33

evantill commented 4 years ago

@wojsmol how can I install the exact same version as yours ?

evantill commented 4 years ago

Note1: I have used sbaerlocher/ansible.wp-cli ansible role to install wp-cli. This plugins use https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar to download wp-cli phar. But using url https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar from wp-cli installation is working as expected.

Note2: Both url give the same file md5 dedd5a662b80cda66e9e25d44c23b25c

Note3: but the result is not the same :scream:

xxx@xxx:~/bin$ md5sum w*
dedd5a662b80cda66e9e25d44c23b25c  wp
dedd5a662b80cda66e9e25d44c23b25c  wp-cli.phar

xxx@xxx:~/bin$ ./wp core version --extra
Error: Couldn't find versions.mustache

xxx@xxx:~/bin$ ./wp-cli.phar core version --extra
WordPress version: 5.4.2
Database revision: 47018
TinyMCE version:   4.960 (4960-20190918)
Package language:  fr_FR
wojsmol commented 4 years ago

This plugin is usingt very old url - see this.

evantill commented 4 years ago

Ok one more test:

cd ~
mkdir bin
cd bin
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod a+x ./wp-cli.phar
./wp-cli.phar core version --extra
# result is as expected
mv ./wp-cli.phar ./wp
./wp core version --extra
#Error: Couldn't find versions.mustache

Note: old url https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar is a redirection to https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

evantill commented 4 years ago

Note: Opened https://github.com/sbaerlocher/ansible.wp-cli/issues/6 to update the url as defined in documentation.

evantill commented 4 years ago

using a link is working :

cd ~
mkdir bin
cd bin
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod a+x ./wp-cli.phar
./wp-cli.phar core version --extra
ln -s wp-cli.phar wp
./wp core version --extra
schlessera commented 4 years ago

You might have a package installed that does an override that breaks here. Can you show me what wp package list produces?

evantill commented 4 years ago

Here is the package list :

+----------------------------+---------------------------------+------------------------+-----------+------------------------+
| name                       | authors                         | version                | update    | update_version         |
+----------------------------+---------------------------------+------------------------+-----------+------------------------+
| eriktorsner/wp-checksum    | Erik Torsner                    | dev-master             | none      |                        |
| evantill/wp-cli-git-helper | Boone B Gorges, Eric Vantillard | dev-fix/autoload-error | available | dev-fix/autoload-error |
| markri/wp-sec              | Marco de Krijger                | dev-master             | none      |                        |
+----------------------------+---------------------------------+------------------------+-----------+------------------------+
evantill commented 4 years ago

Removing packages did not solve the problem :

xxx@xxx:~$ wp package uninstall evantill/wp-cli-git-helper
Removing require statement from /var/www/vhosts/xxx/.wp-cli/packages/composer.json
Removing repository details from /var/www/vhosts/xxx/.wp-cli/packages/composer.json
Removing package directories and regenerating autoloader...
Success: Uninstalled package.

xxx@xxx:~$ wp core version --extra
Error: Couldn't find versions.mustache

xxx@xxx:~$ wp package uninstall markri/wp-sec
Removing require statement from /var/www/vhosts/xxx/.wp-cli/packages/composer.json
Removing repository details from /var/www/vhosts/xxx/.wp-cli/packages/composer.json
Removing package directories and regenerating autoloader...
Success: Uninstalled package.

xxx@xxx:~$ wp core version --extra
Error: Couldn't find versions.mustache

xxx@xxx:~$ wp package uninstall eriktorsner/wp-checksum
Removing require statement from /var/www/vhosts/xxx/.wp-cli/packages/composer.json
Removing repository details from /var/www/vhosts/xxx/.wp-cli/packages/composer.json
Removing package directories and regenerating autoloader...
Success: Uninstalled package.

xxx@xxx:~$ wp core version --extra
Error: Couldn't find versions.mustache

xxx@xxx:~$ wp package list
+------+---------+---------+--------+----------------+
| name | authors | version | update | update_version |
+------+---------+---------+--------+----------------+
+------+---------+---------+--------+----------------+
danielbachhuber commented 1 year ago

Feel free to stop by the #cli channel on WordPress.org Slack if you'd like help debugging further.