Let's add a checkbox to the import form with the label:

Overwrite existing site?

...and the description:

Checking this option will delete the site with the same name (if it exists) before importing the new site,

If the option is checked (it would be off by default), we would simply add a "Delete site" task to the queue before doing anything else. A backup would get taken automatically as part of that task. This would technically be doing more work than a pure DB + files sync, but it would be really easy to implement.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

colan created an issue. See original summary.

colan’s picture

Here's as far as I could get without taking the time to understand the Batch API.

The existing site gets deleted if the box is checked, but then the process hangs at 60%:

Completed 1 of 2.
Import is queued, waiting for dispatcher to run.

I'll leave this as-is for now. Feel free to take over.

helmo’s picture

Couldn't this be done easier by overwriting the site instead of adding a delete step? (I agree that It does sound safer/cleaner to first do the delete...)

Internally provision-deploy is used, which we also use when a site is migrated between platforms. In that case we also don't delete the site first.

--
just my 2 cents

colan’s picture

So it might just work if we loosen the form validation, which checks if the site exists? Sounds like it's worth trying.

colan’s picture

Status: Needs work » Needs review
FileSize
1.7 KB

This seemed to work for me, but could use more testing. I changed the site name, imported over it, and then the site name went back to what is was before.

@helmo: If we can get this in, what do you think about deprecating hosting_sync? The UI/UX for this is better.

  • colan committed f8f1a43 on 7.x-3.x
    Issue #2961508 by colan, helmo: Overwrite existing site if requested.
    
colan’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.