ClassicPress / ClassicPress-Migration-Plugin

Switch your WordPress installation to ClassicPress.
Other
25 stars 19 forks source link

Handle existing composer.json better #61

Closed nylen closed 4 years ago

nylen commented 5 years ago

Currently attempting a migration with an existing composer.json file will block the migration with an error that is not very clear (see https://github.com/ClassicPress/ClassicPress-Migration-Plugin/pull/53), and this is fairly common.

Two example causes are when ClassicPress has previously been installed, and (potentially, clue from Slack discussion today) when WordPress was installed via Softaculous.

Another potential cause (and the reason we put this message in place) is that composer.json could be actually in use and valuable to the site, but it seems to be more common that this is a red herring.

We should change this "conflicting files" logic to do something like the following:

We detected an existing composer.json file, which will be overwritten during migration. A backup will be saved to composer.json.bak

switching to .bak2 etc if a previous backup already exists.

The current "conflicting files" logic only applies for composer.json, for reference:

https://github.com/ClassicPress/ClassicPress-Migration-Plugin/blob/50dbf0e73a71b4d8628bb7bf751101560ac2d36f/lib/check-core-files.php#L53-L65

nylen commented 4 years ago

This is fixed in 627a664 and the new plugin release 1.1.0. Responsibility for backing up composer.json (if needed) has been shifted to the user:

2019-10-24T20-35-19Z