How to fix your Modx Revolution core install and plugin/extra installations after a server move.
The Gallery and other modx extras stopped working after moving the files and database from on one server to another. All research into the issue yeilded no results, but after much deeper digging into the CMS and the gallery extra, we have found how the fix this issue... Not being able to add albums being one of the problems.
What causes modules to stop working after a server move? Modx seems to store file path references all over the place. It can make a migration relatively difficult in comparison to other content management systema. The challenge is changing all of these references easily so that that everything starts working again. There are quite a few steps to doing this, so here is what to do:
Step 1: Correct all database references.
Whether you do it through PhpMyAdmin or via another method, you need to update all of the file references in the database. Once in, open up your modx database. look for the "_workspaces" table and edit the "Default MODX workspace" row to point at the right place.
you will see something like "/home/altoedmq/public_html/core/" or "C:/Program files/Apache ...... htdocs/core/" the important thing to change is the file path before "core/" so that it is correct. Unsure what this value should be? If you have CPanel installed then log in and look on the left hand side for the "home directory" value. Add public_html to the end of this if you are on a linux server for the correct file location.
Next go into the "_system_settings" table. Look through every row. You are trying to identify any of the old references to fix them as with above. Just bare in mind that you will want to preserve the modx references such as "/assets" in the same way that you did with "/core".
Step 2: Correct the config file
Within your ftp client, navigate to "Your Modx directory/core/config/config.inc.php" and edit the file. You will notice within it many references to folder paths relative to the server file system. You will also notice references relative to a domain name. Correct all of these according to the correct server details. This is a similar process to above except you are editing lines of a file rather than database rows.
Step 3: Fix broken modules.
Some modules have file references within their installed php files. The easiest way to fix them is to uninstall them and reinstall them. You would think that it would be as simple as this, but is isn't. Here are the steps to take in order to actually perform a clean re-install.
- Fully uninstall the package from with the package library,
- Delete the "Your Modx directory/core/cache/" and replace it with an empty folder of the same name.
- Go into "Your Modx directory/core/packages/" and delete the folder that corresponds to your module. Leave the zip file where it is.
- Go into "Your Modx directory/core/components/" and delete the folder for the module if it exists.
- (Optional) delete any _modulename_ tables from within the database using php my admin. I say optional as it may not be essential to do this. It wasn't needed to be done to fix the gallery plugin.
- Reinstall the module as you would normally.
And there you have it, everything should now be working correctly, as should any other packages/extras.