-
Notifications
You must be signed in to change notification settings - Fork 51
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
wp core is-installed
returns 0
even if there are no tables
#184
Comments
wp core is-installed
returns 0
even if there are no tables
I can look into it 🙂 |
I think the issue might be on the chaining the Instead of: Try:
You can also test this with:
|
The issue is not in the output of the WP-CLI command, but more about the behavior of the command:
I 'solved' the issue by:
What I'd think that command would have to do is combine the table check as well. As that is the part that is kinda failing. |
@dingo-d I've replicated the behaviour. And then on this you can get the return code, as in
Will print :
As intended, the output is empty, the return code is 0. |
Bug Report
Describe the current, buggy behavior
I am working on automatic WP deploy using deployer and GH Actions. The first task in my deploy process is to setup the
wp-config.php
, then build the theme, upload it, symlink the current release, and at the end I'm making a check for plugin and core updates using WP-CLI.In the last part of the deployer task that checks the core and plugins, I added
This will set the variable
$isInstalled
to 0 if the core is installed, and 1 if not. In the case it's 1 I doThen after that, I have
This will check the current core version, and compare it to the version I have set during my deployment process (
$coreVersion
variable). In my case, the$coreVersion
was set to 5.7, and the$currentCoreVersion
was 5.6, so the conditional was true and I tried to update my WP core. But I got the error that WP is not installed, because the tables weren't set yet in the DB.So in the end the command
wp core is-installed
doesn't do a good job really. Not sure why tho, because theis_blog_installed()
function should return false (or maybe it doesn't because of all the error suppressions 🤷🏼♂️ ).Describe how other contributors can replicate this bug
wp core download --version=5.6
)wp-config.php
that will point to empty DB (wp config create
)wp core update
and see the errorMore so, even after just downloading the core the command
Will return
So it says that it's installed but the config is missing, after creating the config it returns 0, but there are still no DB tables.
Describe what you would expect as the correct outcome
It would be good to throw 1 as long as there are no DB tables present. The command should be more robust. That way it will be easier to use them in CI/CD pipelines.
Let us know what environment you are running this on
Local:
Ubuntu:
OS: Linux 5.4.0-1037-aws #39-Ubuntu SMP Thu Jan 14 02:56:06 UTC 2021 x86_64 Shell: /bin/bash PHP binary: /usr/bin/php7.4 PHP version: 7.4.13 php.ini used: /etc/php/7.4/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/denisjezakon WP-CLI packages dir: WP-CLI global config: WP-CLI project config: WP-CLI version: 2.4.0
The text was updated successfully, but these errors were encountered: