Quick Guide on Manually Updating a Drupal 7 Website

There, now Drupal Mill is updated from Drupal 7.4 to 7.10 and all contribs likewise. Finally I can begin the real work on making the changes to the existing features as well as start adding the new ones.

The updating went very smooth, not one single hiccup, this is how I did it:

Create the Local Mirror Site

  1. Copied the whole sites folder to a local mirror installation.
  2. Used the Backup and Migrate module to take a snapshot of the database.
  3. Installed Drupal 7.4 on my local dev server
  4. Added
    $conf['file_temporary_path'] = '/tmp';
    to settings.php. This is important if the path on the live site is different, then there is a big risk the local test site wont work at all. See Configuration / Media / File system for the Temporary path value to use. In my case it was '/tmp'.
  5. Enabled the Backup and Migrate module.
  6. Restored the database.
  7. Cleaned the cache.

Now I had an as exact copy of the live site as possible that I could test the updating process to make sure nothing would go wrong.

I wanted to use drush to perform the updating, but unfortunately it doesn't seem to have an option that let you select which version to update to. It is update to what it recommends or do it manually. Reason I wanted to be able to select is that the site had quite a few dev versions of contribs and I wanted to update to stable releases. But if there is a dev version that is newer, then drush would recommend that and not the stable. So I had to do it the manual way instead. Maybe good I can't use drush on my hosting account..

Perform a Local Update

When I update Drupal sites, I always update the contribs first, so the test process went like this:

  1. Open the Available Updates page and download the versions to update to.
  2. Delete all module folders that will be updated.
  3. Unpack the new versions.
  4. Run update.php
  5. Double check the log to see if there are any errors.

Note: Make sure you check all new versions of the modules so they don't have any new special requirements. It is possible they for example have added a requirement for a certain version of Drupal, or other contrib module. If it does, you need to adjust your update strategy accordingly.

If everything goes well, then its Drupals turn:

  1. Delete all folders except sites and all root files except .htaccess
  2. Copy in the new version, except the above, install.php and all *.txt (except robots.txt of course)
  3. Run update.php

If you have made changes to robots.txt, then you might leave the old version intact as well.

Then again look in the log, check around the site to make sure everything seems to work. If so then:

Update the Live Site:

The procedure here is almost the same as when I do the test update, just a few extra steps to make sure I don't risk losing any content etc that has been added since I took the database dump. The process is like this:

  1. Put the site in maintenance mode.
  2. Make a new database backup.
  3. Perform step 2 - 8 above.

That's it. The site is now updated and working with the latest version of Drupal and all the contribs. If everything works, the only thing left to to is to take the site out of Maintenance mode so your visitors can enjoy it once again.

I have used the above updating procedure for a long time now, and it has worked very well for me.

Let the Fun Begin

Now when Drupal Mill is updated I can begin the work on adding all the new exiting features I plan for it. First though I need to get rid of some old stuff that hangs around, including the blog module.

First though, I am going to treat myself to watching a movie after the successful updating.

Comments

circuscowboy's picture

If you want to do an update with drush to a different version you can just do the following

drush dl name_of_module --select

It will give you options to choose from - after

drush updb

top update the database if it needs it

then

drush cc all

to clear the cache.

After you have updated the files that are exceptions you run drush up

I don't ever want to have to worry about updating manually again.

tsvenson's picture

Thanks for the tip. That will for sure come in handy. Yes, drush is a fantastic tool to use and learning to master it is very important if you want to become efficient on administrating Drupal site.

However, what's important to point out is that when you do a test update on a dev server, you should aim for emulating the environment on the live site as much as possible. In my case, I don't have shell/drush on the live site and therefor I need to do it manually when testing.

It is quite common for most affordable hosting providers not to allow shell access for security reasons.

circuscowboy's picture

Then you set up an alias.drushrc.php so you can do rsync and sql-sync. This is a little more work but well worth it IMHO. Then again I am deploying an upgrading a number of sites a week so it is well worth learning this work flow.

NancyDru's picture

You might want to rethink the contribs before core scenario. It seems that some contribs are now making changes before the core version they require is available (Admin_menu is that way right now). That blocks ALL updates until the required release of core is available.

circuscowboy's picture

I throw caution to the wind. I do have everything committed to git so I can get back to any moment and try again and I am run things on a dev environment. We sometimes don't have a choice where things are going either. I try desperately to have ssh access - even if it is a crappy jailed shell so I can rsync files. But even if I don't I still work on a server with drush and zip and deploy. Updates are done on the dev server and pushed live as well when I know things are working.

It is interesting what you are saying about modules beating core releases and causing problems - I haven't run into that - I haven't used admin_menu since going to 7. What do you mean by "Blocks ALL updates"?

tsvenson's picture

Thanks Nancy for pointing that out.  Reading the release notes is of course very important before going ahead and perform the update. Things like this is also another very good reason why you always should test the update before performing it on the real site.

I've updated the post with info about this now.

NancyDru's picture

Currently, admin_menu has a requirement for 7.11, which won't be out until Feb. 1. So update.php checks the requirements first, sees that one is not satisfied and quits.

I don't like Toolbar nearly as much as admin_menu. A large part of that is the "Flush Caches" feature.

gustav's picture

hi tsvenson..
i need to ask about the modules folder. Will it be replaced by 'the new version' of modules folder? Because i think the content of 'older' modules folder is different with the 'old' one. Should we keep the modules folder, same as sites folder and robot and .htaccess?
thans for the answer..

tsvenson's picture

If you mean the "sites/all/modules" folder, then it should be kept.

The module folders you delete are those with the same name as the module itself. For the Views module that would commonly be the "sites/all/modules/views" folder.

Add new comment