Drupal is a comprehensive content management framework which offers a number of modules to extend its functionalities with day-to-day updates. If you want to know about ‘Drupal Maintenance’, then you need to know the following things:
- Upgrade from Drupal 6 to Drupal 7 or Drupal 8
- Migration from legacy system
Updating refers to taking your site from one 'minor' version to another minor version. Lets consider an example if a site is in Drupal 7 version D7.1 and latest version is released as D7.2 or from Drupal 8 version D8.1.0 to D8.1.3 then its an update.
Upgrading refers to taking your site from one 'Major' version to another major version.Switching from Drupal 6 to Drupal 7, or from Drupal 6 to Drupal 8, or from Drupal 7 to Drupal 8 is an 'upgrade'.
You may want to 'migrate' your site from running locally on your computer to an online webhost. Or you may want to 'migrate' your site from one webhost to another. If that is what you want, head to: Backing up and migrating a site.
Steps to Drupal 7 upgrade
- Log-in as an user with administrator privileges who can perform "Administer software updates".
- Turn your site into maintenance mode. Ie. If we are updating a live/production site then go to Administration > Configuration > Development > Maintenance mode. Enable the "Put site into maintenance mode" checkbox and save the configuration.
- Backup your files and database. Clear the performance cache and delete all the watchdog logs, if any, before taking the database backup.
- Remove all old core files and directories, except for the 'sites' directory, the original install profile in the 'profiles' directory and any custom files (like htaccess, gitignore or other files) you added elsewhere.
- To be more specific, in your Drupal root directory, delete all files and the following directories: includes, misc, modules, scripts, and themes. If you made a normal installation, then also delete the profiles folder, but if you used a custom profile, then in the profiles folder, delete the subfolders minimal, standard, and testing.
- Modifications to the files like .htaccess or robots.txt, needs to be applied from your backup, after the new files are kept in place.
- Read the release announcement carefully before proceeding the upgrade as the updates may also include changes in settings.php. If you have to use the new settings.php file, then replace the settings.php with the default.settings.php, and apply the site-specific entries like database name, user, and password from the backup file.
- Any custom files and directories outside the sites directories has to be placed manually. However, it is recommended not to have any custom files or directories outside the sites directory.
- Download the latest Drupal 7.x core release from http://drupal.org/project/drupal to a directory outside of your web root. Extract the archive and copy the files into your Drupal directory.
- After copying the new core files, run update url by visiting http://YOURSITENAME/update.php. This will update the core database tables if any alteration to the database table structures is there.
- In order to access the update.php file please login as administrator. Before you start doing the upgrade process, we have logged in as admin user, get access to the update.php file automatically. In case you had logged out or closed the browser by mistake, you can do the following to access the update.php file.
Open settings.php with a text editor.
Look for $update_free_access variable.
$update_free_access = FALSE;
Change the access to true:
$update_free_access = TRUE;
Now run update.php.
- Once the update is completed, check for errors if any. $update_free_access must be changed back to FALSE for security reasons.
- Clear the sites performance cache after the upgrade. You can do it by navigating to Configuration => Development => Performance and "Clear all Cache".
- Check for the status report and report log to verify that everything is working as expected.
- Once you are error free, make the site online to change the "Put site into maintenance mode" checkbox and save the configuration.
Tips for Drupal site maintenance
- Keep the Drupal core up-to-date
- Keep the contributed Drupal modules up-to-date.
- Check for the security updates. Install update manager to know the latest available and recommended releases for Drupal core and its contributed modules
- Configure cron scheduler so that periodic site maintenance will take care of regular checkup and updates
- Keep the admin user password secure
- Ensure using check_plain method while assigning or computing values from form post fields to avoid cross-site scripting
- Write protect the setting.php file.