I run a local Linux server in my room at home for testing purposes, and I prefer to develop with MODx and other PHP-related things because it’s much quicker than working off my Hostmonster server. What I do with most things is keep the files in sync between the local and live versions, and then I just export my MySQL database from the local server and import it to the live one.
With MODx (or any CMS, really), this becomes much more difficult. Is it possible to feasibly do this?
I spent a few hours yesterday trying to recover a broken MODx installation (turns out it wasn’t exactly broken, but that’s irrelevant) and trying to get my local copy to match the live copy. I managed to get a fresh copy on the live server updated with my previous database and what not so it was all back to normal. Getting my local one back to normal isn’t working out so well. I installed a fresh copy from SVN as well and installed the exact same packages as the live one has. I set up the configuration files and let MODx install with it’s normal setup process. Then I exported my live database and imported it on the local server, overwriting the entire thing. Unfortunately, the login is not completely messed up in both appearance nad functionality, as in I can’t log in because I just get errors.
I’m thinking I need to only export/import certain tables from the database and just sync the rest by hand in the manager. Things like components won’t change often, so as long as I keep them the same in both installations, I should be able to just get the tables for my content, meaning resources and content elements. I’d leave tables along that contain any session data, and I would probably need to leave the system settings table alone.
Theoretically, it shouldn’t be impossible to sync two copies. Has anybody had more experience/success with this? I don’t mind if it takes a bit of work to figure out, but I’d like to get to where I know how to do it and can sync them pretty quickly when I need to.
It would be really, really nice if MODx had a built in export function that gave you exactly what you need to get another installation to match, but I realize that would be difficult to make.
Thanks for any help.
I'm learning more about MODx all the time and loving it.
Shaun, thanks for the very quick reply. I’m feeling a little more encouraged about this now.
Regarding the login error, I’m not going to worry about it. This has happened before when I tried to do a similar thing, and it was probably just because I copied over too many tables and things and basically just messed things up. I’m going to start over again using your advice, and I doubt it will happen.
I’m looking forward to the things you and others have been working on that would make this easier. Until those arrive, I’ll just have to figure out a process to make it work every time.
I have one question. You said to make sure the cache directory is cleared. Does that I mean I should delete every file/folder from core/cache? When I was messing around with it yesterday, I moved config.cache.php out of the cache folder to see if it would rebuild it, and it wouldn’t. MODx completely failed to load until I put it back. So I’m a little hesitant to clear the entire cache.
Thanks!
I'm learning more about MODx all the time and loving it.