Skip to content
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

Handle existing composer.json better #61

Closed
nylen opened this issue Sep 16, 2019 · 1 comment
Closed

Handle existing composer.json better #61

nylen opened this issue Sep 16, 2019 · 1 comment

Comments

@nylen
Copy link
Contributor

nylen commented Sep 16, 2019

Currently attempting a migration with an existing composer.json file will block the migration with an error that is not very clear (see #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:

function classicpress_check_conflicting_files() {
$files = array(
'composer.json',
);
$conflict = array();
foreach ( $files as $file ) {
if ( file_exists( ABSPATH . $file ) ) {
$conflict[] = $file;
}
}
return $conflict;
}

@nylen
Copy link
Contributor Author

nylen commented Oct 24, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant