-
Notifications
You must be signed in to change notification settings - Fork 57
Description
Bug Report
- Yes, I reviewed the contribution guidelines.
- Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
So if there is an existing, or corrupt would be the right word, WordPress installation that has wp-load.php file, but no other files, the CLI script would not detect an old existing WordPress installation and as a result deviate from the normal behavior.
Describe how other contributors can replicate this bug
Now this is going to be hilarious. Just run the following commands
cd ~
mkdir wp-demo
cd wp-demo
touch wp-load.php
wp core downloadAnd there you have the warning.
Also try the other way.
cd ~
mkdir wp-demo
cd wp-demo
wp core download
rm wp-load.phpNow make whatever changes you want to make
wp core downloadAlthough the wordpress installation existed, but still despite of giving user any warning all of his files will be overwritten.
Describe what you would expect as the correct outcome
The part of the download function that looks out for existing WordPress installations has a single point of failure, the wp-load.php. The expected behavior should be to remove this point of failure
Let us know what environment you are running this on
OS: Linux 5.4.0-40-generic #44-Ubuntu SMP Tue Jun 23 00:01:04 UTC 2020 x86_64
Shell: /bin/bash
PHP binary: /usr/bin/php7.4
PHP version: 7.4.3
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/anirudh/Desktop/wp
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.4.0
Provide a possible solution
To fix it, you need to remove the single point of failure. Just make sure that the download function checks for any files and folders with wp-* prefix, and if any such file/folder exist, output a warning to the user and ask for his confirmation before proceeding.
This would ensure that neither we overwrite his file, nor do we prevent him from installing wordpress, just because he has an empty wp-load.php
Provide additional context/Screenshots
Note: If this is not intentional and you want to fix it, I would like to be assigned to fix this issue for you.
