Can't "import" site after deleting it (BUT leaving the files there)

Issue Summary

Can’t ‘import’ (revive, restore, whatever word you want) a Local Site, even though all the files exist.

Troubleshooting Questions

I have tried creating a zip file of the entire directory, and the usual steps, however each time I drag the file onto the Local window, I get a popup that says Local doesn’t know what to do with the file.

  • Does this happen for all sites in Local, or just one in particular?
    ALL SITES

  • Are you able to create a new, plain WordPress site in Local and access it in a Browser?
    Yes

Replication

Open Local (ver 6.4.2+6012).
Select a Local site.
Right Click Site Name, select Delete, Uncheck “Move site files to Trash”, Click Delete Site.
Even though all the files were left in place, there is seemingly no way to ‘restore’ the site.

System Details

  • Which version of Local is being used?
    ver 6.4.2+6012

  • What Operating System (OS) and OS version is being used?
    Mac Monterey v 12.5

** If you try to create a ‘new’ site with the same name, Local gives an error that there’s already a local site there. You’d think the software could just re-import it.

Hi @rangerdth - welcome to the Local community! :wave:

Thank you for your question.

Can you explain a little more about how you’re creating a zip file of the entire directory?

I’m not quite sure I understand why you are deleting and keeping the files there.

Also, can you explain the context of what you are trying to do just a little more so I can help provide some guidance and steps?

Thank you!

Sam

I followed some of the posts on the site about importing a zip file.

The real problem is this: I had some clients who wanted development done, so I started building a site. Then they decided not to move forward. So, I deleted the site from Local, but left the files on my hard drive (as they existed). Now the clients are back, and I would like to import the site that I had been building.

I figured this should be easy since all the data is still there (and hasn’t changed), but apparently it’s not.

I can’t create a new site with the same name, as Local says the file exists already. However, I can’t even “import” the old site as Local apparently doesn’t recognize it.

Hi @rangerdth - thanks for explaining that.

If you look inside of the following places, does the site show up?

Local sites

Shared with CloudApp

sites.json

location: /Library/Application Support/Local/sites.json

Let me know, and let’s see if we can find it!

Sam

Yes, they are all there. That’s why I’m confused by not just being able to import/reactivate, etc.

Hi @rangerdth -

Okay, good to know, thank you.

If you open up the file for the site you’re looking to work on, what is inside of the app > sql file?

It should look like this - I wonder if for some reason the sql file is missing.

Shared with CloudApp

Let me know if that’s there!

Sam :woman_technologist:t3:

This is what I have. It’s quite different.

Do you have any input?

Hi @rangerdth - hmm, that’s interesting. Thank you for sharing that context.

Have you tried this method?

I would recommend making a backup of the folder just in case before trying this,

Sam

Yes, that is the first method I tried.
I get this error:
Screen Shot 2022-08-22 at 1.07.14 PM

  • FIXED -

The issue is a database change in the older sites that I have been trying to import.

  1. Create a new site in Local - called whatever you’d like.
  2. Once the site is created, “Stop” it.
  3. Navigate to the new site folder and delete the “app” folder.
  4. Navigate to the old site folder and COPY the app folder to the new site folder (and make sure you keep the “app” folder name).
  5. Start the site.
  6. Click the “WP Admin” button, which opens the admin page, which will require a ‘database upgrade’.
  7. Do the upgrade and you’ll get the site back.
  8. Check to make sure your previous ‘theme’ is active and not a generic theme.

*** NOTE ***

I seem to be missing the database content (posts, comments, etc) as of now.
But at least I can see the site and theme, etc.

Hi @rangerdth :wave: -

So glad you were able to solve this (although a bummer about the posts, comments, etc) - I presume that is living in a sql file somewhere - do you want to keep looking for that together?

Thank you for sharing what worked for you!

Sam

I have finally restored the whole site.

The sql directory holds a “pair” of each file:

  • local.wp_comments-schema.sql
  • local.wp_comments.sql
    The “schema” file is the actual table schema. The non-schema file is the data.
    One issue that you have to correct by hand is that the default datetime that’s used in the files (0000-00-00 00:00:00) is not allowed by mysql. The minimum datetime is ‘1000-01-01 00:00:00’ - so you have to find/replace that in each file before you can continue.

You can then remove all the tables from the “new site” database file, but keep the database.

You can then restore all the ‘shcema’ files, which will create the tables.

You can then import all the non-schema sql files which contains the data.

When you log in to the admin panel, you’ll likely get a notice about upgrading the database (as I did, because of the changes from WP5 to WP6). The upgrade ran without issue and the site is back.

1 Like

One thing to note: there may be schema/data for plugins. So be sure to address those as needed.

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.