Maintenance is about keeping your site healthy. The two main issues are backups, and updating your software. That's Drupal, and its modules.

There are other software updates, like operating system updates. Your web hoster will usually make those updates for you.

Backup

You want to get a copy of your server data onto another computer, or remote storage device. So if your server is hacked, or destroyed in an alien attack, you can restore your data.

What do you need to backup? Here's that mental model again.

Technology mental model

You need to backup:

  • The database

  • The program files

  • Student data

Backing up the database

cPanel makes it easy to backup a database.

cPanel backup icon
Choose database to backup

You'll get a compressed copy of your database, that you can store on your PC. I usually create a backup folder, and in that a folder for the current date, like 6-7-22.

Backing up the files

There are several ways to do this. The same cPanel backup program you used for the DB can backup files as well.

File backups with cpanel

You can also backup the files manually, using cPanel's File Manager. Go to the folder with the files you want to backup, click Select all, and then Compress. Choose the compression type. I usually choose Zip, but you can make it whatever you want.

Manual file backup
Compression type

cPanel choose the name for the zip file, using one of the names in the files you're backing up.

cPanel chooses the file name

When the backup program is done, you'll see the zip file in the File Manager.

Backup file

You can rename the file if you want, with a name that better reflects the contents of the file.

Renaming the file

You can download it to your PC.

Download backup

Once you've downloaded the file, you can delete it from the server. Or not. You choose.

The backup wizard

cPanel has a wizard that will backup files and databases in one hit.

Backup wizard icon
Backup wizard

I've never tried it. If you have, let me know what you think.

Updating modules

Composer makes updating modules easy.

BTW, I recommend you backup your database and files before you do a module update. Just in case.

Start the terminal, and switch to the folder containing your course website.

Switch to course folder

Then check that you're in the right folder. Use ls or ll. There should be a file called composer.json.

Check we're in the right folder

OK, we're in the right place. Now to update the module. Let's update... Skilling.

composer update drupal/skilling --with-dependencies

Here's what I got. You can see the change in the version.

Module updated

Updating Drupal core

You can also update Drupal core with Composer. Here's there's a core update available. I usually don't do core updates unless there's a security issue, but let's do this one anyway. BTW, I recommend you backup your database and files before you do a core update. Just in case.

Start the terminal, then switch into the folder where you installed Drupal. It has the file composer.json in it. Then run:

composer update drupal/core-recommended --with-dependencies
Updating core

When I tried this just now, I got an error.

Error upating core

Hey, Adela. Any ideas?

Adela

Hmm... we messed with the default folder when we were configuring Drupal. Could it have to do with that?

Good thinking! Composer wants to delete default/default.settings.php, probably to replace it with a new one. Let's use the File Manager to check the permissions of that folder.

Permissions for the default folder

Nobody has write permission to the folder, not even the user (that's us, and we own the account!). We locked Drupal down so much, Composer can't do its job.

Oh no! I mean, yay for security, but oh no!

Let's give ourselves write permission to the folder.

Grant write permissions to User

Composer ran just fine. It updated Drupal core to the new version.

Drupal reports new version of core

DB updates

Most updates only affect files. Occasionally, though, an update will change the database as well. If Drupal asks you whether you want to run DB updates, you do.

You might see this on the status report.

Database updates available

Click that link! Here's the page that runs DB updates.

Database update page

Notice the URL, /update.php. If you see that, let it do it's thing.

Clearing the cache

Drupal is complex, with many thousands of lines of code. If all the code ran every time someone asked for a page, your site would be s-l-o-w.

So, when Drupal works out what a page or part of a page should look like, it stores that in a special place called the cache. When someone else asks for the same thing, Drupal doesn't recompute it. Instead, it grabs the thing from the cache. Much faster.

It works well... most of the time. However, detecting when a cached item needs to be refreshed is a difficult problem, and Drupal doesn't always get it right. If Strange Things are happening on your site, your first step should be to the clear the cache. We're talking about Drupal's cache here, not your browser's cache, but clearing that too is a good idea.

If you installed the admin toolbar module, there'll be this menu entry:

Clear the cache

Don't try to work out which cache to clear. Clear them all.

You call also use Configuration | Development | Performance, and click the Clear all caches button. There's also Skilling | Configuration | Clear caches.

Section contents

Configuring Skilling
Installation