Jump to content
alan

Safely ignore which folders when copying a site?

Recommended Posts

Hi folks, I really hope this is not already answered somewhere obvious and I missed it or I'll feel silly...

Summary

What folders can I safely exclude when mirroring two sites files and DBs?

More detail

In other words is there a list of folders such as, perhaps

/site/assets/sessions/

that can be safely excluded when copying sites and DBs from one place to another that will not disrupt logging in etc?

I am not thinking in terms of what to watch out for such as config.php/config-dev.php etc but only trying to work out what "temporary" or ephemeral files can safely be not copied and will not cause problems such as logging in even though I will often

1. export a sites DB

2. import the DB to the other site

3. sync/copy all files (except some excluded folders?)

4. go to login (etc) on the remote site

Thanks for comments, cheers, -Alan

Share this post


Link to post
Share on other sites

Definitely the sessions. I don't think theres any use in copying those. Same goes for db stored sessions. Apart from that i can not really think of a lot of unnecessary stuff.

If you use caching you can safely omit the cache files as well (i think)

  • Like 1

Share this post


Link to post
Share on other sites

Thanks SiNNuT!

I've not yet noted down (in my summary below) your ref to 'db stored sessions' as I don't know where they are; are they a collection of files somewhere?

Exclude / Include list

So far I assume the following should usually be EXcluded in a site copy

  1. /site/assets/sessions/
  2. /site/assets/cache/

and everything else should be INcluded in a site copy (including these locations that one might have thought could be excluded)

  1. /*
    and that includes:
  2. /site/assets/cache/
Edited by alanfluff

Share this post


Link to post
Share on other sites

There is a SessionHandlerDB module, which when installed, stores session info in it's own table. I've not yet used this myself but when you do i think you shouldn't migrate the contents of this table.

Also, in your include list you mention /site/assets/cache/. I think you should exclude this from a site copy. No reason to migrate cached data, it could even lead to things not working correctly on the copy destination site.

Thanks SiNNuT!

I've not yet noted down (in my summary below) your ref to 'db stored sessions' as I don't know where they are; are they a collection of files somewhere?

Share this post


Link to post
Share on other sites

Thanks SiNNuT, list updated.

I assumed if CACHE was copied (although I agree it's name sounds like it is not needed) and a full DB export/import happened also then the copy would be 'perfect' and everything would match and so copying CACHE would be OK.

It's these not-quite-certainties of mine that I am trying to resolve together with looking for the cleanest set of files to copy when I copy a site the 'traditional' way (db export/import and FTP/rsync sync of files).

Share this post


Link to post
Share on other sites

Thanks SiNNuT, list updated.

I assumed if CACHE was copied (although I agree it's name sounds like it is not needed) and a full DB export/import happened also then the copy would be 'perfect' and everything would match and so copying CACHE would be OK.

If think you could be ok but if you ever want to move from location A, which is on root, to location B in a subdir or something, i'm guessing all links in the cached files will be off.

Also, ftp isn't that fast, and there can potentially be a lot cache files. I wouldn't include them in your copy routine, the will be regenerated fast enough.

For me however, it's also a matter of being not quite sure, so maybe others can share their routines.

  • Like 1

Share this post


Link to post
Share on other sites
For me however, it's also a matter of being not quite sure, so maybe others can share their routines.

Exactly my problem too.

In fact to make it even simpler what I was looking for was, given the 'traditional' and simple scenario of copying all files a site from a dev root setup to a production root setup, and exporting/importing the db too—what folders can (should) we safely exclude? There surely must be a 'definitely good to exclude' list so I too would be interested to learn what it is.

Share this post


Link to post
Share on other sites

I usually dont't exclude any folders and only clear the cache before uploading, but I think its save to exclude the contents of these folders:

/site/assets/cache/
/site/assets/logs/
/site/assets/sessions/

But the folders themselves should exist and be writeable on the server too.   

  • Like 1

Share this post


Link to post
Share on other sites

Thanks interrobang and I'm sure that's right about the folders having to exist and be the correct permissions.

When you say you clear the cache, do you do that just by manually deleting the content under ../cache/?

Share this post


Link to post
Share on other sites

When you say you clear the cache, do you do that just by manually deleting the content under ../cache/?

Either that, or I go to the settings of the PageRender module and click the "Clear the Page Render Disk Cache?" button. Most of the time I do it manually, as it clears the modules cache at once.

Share this post


Link to post
Share on other sites

Thanks (and I hadn't even seen that setting in that Module :))

Share this post


Link to post
Share on other sites

Without dis to interrobang, SiNNuT or myself; as SiNNuT said

For me however, it's also a matter of being not quite sure, so maybe others can share their routines.
it would be great if someone who knew for certain what the list of safe-to-exclude folders was were to comment here, not urgent for me, just one of those things that comes back every so often so I finally thought I'd ask—looking forward to finding a definitive answer* in due course :)
 
*Edit: The definitive answer to the narrow question "what files/folders can/should I exclude (when copy a sites files and it's DB from one place to another)?".
Edited by alanfluff

Share this post


Link to post
Share on other sites

I don't personally exclude anything when migrating a site from dev to live. While it might make sense to exclude things like /site/assets/cache/ and /site/assets/sessions/, it's also not entirely necessary as those things are already under automatic garbage collection/clearing. You do need to make sure that those directories exist though. So if you exclude them from the copy, double check that the directory still gets created. I see no problem with excluding those directories (and /site/assets/logs/ if you want to) as long as you make sure they get re-created in the destination and are writable to PW. 

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...