Skip to content

wp core download unable to find if wordpress installation already exists in case of missing wp-load.php #164

@anirudhdggl

Description

@anirudhdggl

Bug Report

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 download

And there you have the warning.

Also try the other way.

cd ~
mkdir wp-demo
cd wp-demo
wp core download
rm wp-load.php

Now make whatever changes you want to make

wp core download

Although 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

wp bug

Note: If this is not intentional and you want to fix it, I would like to be assigned to fix this issue for you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions