Moving a WordPress site: Changing URL and/or sub-folder from the command line

When maintaining a WordPress site, you might find it challenging to find the settings to update to properly convert your site from one URL to another, or from a root directory to a sub-directory.

For example, you might want to update the site of an event that happens every year, where previous years will be relocated to /year/ while the current event occupies the main domain...

This is a short reminder list of what should be updated. This covers sites with multi-site configured.

Why so many settings in Chamilo's configuration.php?

If you install Chamilo 1.11.6, for example, and dive into the details of its configuration, you might get confused by the fact that we have a "settings_current" table in the database at the same time as we have a (large) number of settings to be enabled through the app/config/configuration.php file. This boils down to one rule that we have established in Chamilo: minor versions do not contain database changes.

Major versus Minor versions

So the first question is: what is a "minor" version.

Change the URL of a Chamilo portal copy

There is a surprising number of cases where you'd want to change the URL of a Chamilo portal, but the more common we see is when you take a backup copy of a portal and want to use that copy to build a new test portal. Obviously, if you keep the same URL, you're going to have difficulties having them both running at the same time. Chamilo is not good at managing several URLs (although another article on this blog will help you do that), and even less good at managing a dynamic URL, so there are 3 necessary steps to change the URL (this is valid at least until version 1.11 of Chamilo).

Upgrade Chamilo 1.9 to 1.11 through Git

If you are a developer or system administrator and you (wisely) manage some Chamilo portals through Git, you might want to upgrade, at some point, from Chamilo 1.9(.x) to Chamilo 1.11(.x). This is a complex process, for many reasons, so let me drive you through it.

Precautions

Before doing this, please take a backup of your files and database!

Branching

To avoid terminally breaking your current Chamilo portal, a good precaution is to start a new branch.
git checkout -b 1.11.x

Pulling the new code

Now, the biggest issue with pulling the code from 1.11.x is

Change SVG icons to grayscale with Inkscape

If you design your icons in SVG with Inkscape and wonder how to quickly make an "inactive" icon in grayscale, here's a quick fix (at least for Linux users):

inkscape -f teacher_na.svg --verb EditSelectAll --verb org.inkscape.color.desaturate.noprefs --verb FileSave --verb FileQuit

This will edit your file in-place (so you need to take a copy first) and will require Inkscape to be launched, but all in all, this will make you save a lot of time.