Updating Drupal with FileZilla, WinMerge and 7-Zip on Windows in 10 steps

In a previous blog post I explained how to review and perform a Drupal update from the *NIX command-line.

Not always do you have access to the *NIX command-line, or you may feel more comfortable using off-the-shelf tools on your Windows computer for the job. Then this post is for you.

For me it takes about 10 minutes to process the 10 steps below. Writing up the post and providing screenshots took much longer.

In the following 10 step description, I will make use of the following free tools:

  • FileZilla, a simple, reliable and powerful FTP client
  • WinMerge, a visual file and directory comparison utility
  • 7-Zip, a lean and convenient multiple-format archive manipulator

All of these tools are available free of charge as installable applications or as Portable Apps on Windows.

Disclaimer: I can not be held responsible if anything fails when you apply the method described below. If any of the steps below looks odd or unfamiliar to you, it's better to ask expert advice from an experienced Drupal user.

So your Drupal installation is no longer up-to-date

If you specified a valid email address during installation of your Drupal site, then you will be reminded daily whenever your Drupal release (or a contributed Drupal module used on your site) is no longer up-to-date:

Subject: New release(s) available for <Your Site Name>

There are updates available for your version of Drupal. To ensure the proper functioning of your site, you should update as soon as possible.

There are updates available for one or more of your modules or themes. To ensure the proper functioning of your site, you should update as soon as possible.

See the available updates page for more information: http://your-site-address/admin/reports/updates

You will also be reminded of this situation when logging onto your Drupal site with administrator privileges.

Assumptions

  1. You will first read this 10-step approach until you understand how it works (and you feel confident that no magic is involved), before applying it.
  2. You have a running Drupal 6 site and are updating to the latest Drupal 6 release (so no Drupal upgrade).
  3. Your site runs with unmodified Drupal files, i.e., you did not change the Drupal code. If this is not true, then you will have to review your changes in the update process.
  4. You have FTP access to your site (and you know the FTP credentials).
  5. You know how to create a Drupal database backup and a Drupal file backup.

If any of these assumptions is invalid, the following steps can definitely not be taken for granted!

Step 0: Back up your Drupal environment

Needless to say that this essential step will allow you to revert a failed update to a working state (assuming that your current Drupal site is working, of course). You need to create a database backup (the Drupal nodes, users and configurations) and a file backup (the Drupal files, probably including file attachments you uploaded while using Drupal).

How to create those backups strongly depends on your hosting provider and environment, so I won't explain this step. Just make sure you have a recent back-up of your Drupal database and files.

Step 1: Identify current and latest Drupal release

Log onto your Drupal site with administrator privileges, and visit the available updates report (Administration » Reports » Available updates):

Drupal: available updates

In my case the current version is Drupal 6.24 and the latest version is Drupal 6.25. This color code is applied throughout the description in this post.

Step 2: Download and unpack old and new Drupal release

Step 1 identified the Drupal version currently in use (old) and the latest Drupal release (new).

Download old and new releases from the Drupal project (you can filter on the API version to narrow down the available releases).

Unpack both archives to a temporary location, e.g. C:\temp, with the 7-Zip tool. If extracting a .tar.gz file, open it in 7-Zip, then first double-click the .tar.gz archive to access the .tar file, finally double-click the .tar file to expose its contents (e.g. a directory named drupal-6.25). Drag this drupal-6.25 directory from the 7-Zip window to C:\temp in an Explorer window:

7-Zip: extract the Drupal installation tarball to C:\temp

You'll now have the following directories containing a Drupal installation:

  • C:\temp\drupal-6.24 (release currently used)
  • C:\temp\drupal-6.25 (latest release)

Make a copy of the unpacked old Drupal directory and rename it to C:\temp\drupal-6.24-stale (it will be used for identifying retired files).

Make a copy of the unpacked new Drupal directory and rename it to C:\temp\drupal-6.25-patch (it will be used for creating the Drupal patch).

In the next steps we will manipulate the copies of the Drupal installation files by comparing them against the untouched originals, hence the need for each of the 4 unpacked Drupal installation directories. They can all be deleted once the update has been performed.

step 3: Create Drupal patch

In this step we will identify which files have been modified between old and new Drupal release. Here's where the WinMerge tools excels: this tool allows to compare directory trees and all files contained therein, in order to track changes and render changes side-by-side. Hence this tool refers to "left" and "right" views, where conventionally "left" represents the old version and "right" represents the new version.

Start WinMerge, and choose "File" » "Open" to display the following dialog:

WinMerge: choose directories to compare in step 3

Fill the dialog as described:

  1. The "Left" field must point to the old Drupal directory, i.e., C:\temp\drupal-6.24\.
  2. The "Right" field must point to the copy of the new Drupal directory, i.e., C:\temp\drupal-6.25-patch\.
  3. Check "Include Subfolders"
  4. Click OK

To see all changed files without having to expand directories, make sure to tick all 6 "View" items and to untick "Tree mode":

WinMerge: set the view options

Now you will see a flat list containing all files, including the file comparison result. Sort the results by comparison result by clicking on that column header. Now the "comparison result" column header is highlighted and features a sort arrow:

WinMerge: sort by comparison result

You should now see files with one of the following comparison results:

  1. Binary files are identical: unmodified non-text file.
  2. Text files are identical: unmodified text file.
  3. Binary files are different: modified non-text file.
  4. Text files are different: modified text file.
  5. Left only: files that have been retired since your old Drupal version
  6. Right only: new files introduced since your old Drupal version

Note: Only in case there are files flagged as "Left only", you will have to run steps 4 and 7.

We will now create the Drupal patch, by deleting all files in the copy of the new Drupal directory, i.e., C:\temp\drupal-6.25-patch\, that are identical in the old Drupal directory. To do so, we sorted the file list on the "Comparison result" column.

  • Select all files that are flagged as identical (i.e., flagged as "Binary files are identical" or "Text files are identical")
  • Right-click any selected file to display the context menu
  • Select "Delete" » "Right" to eliminate all unmodified files from the "patch" copy of the new Drupal directory.

WinMerge: delete identical files

After deletion of identical files, you should only see files flagged as "Left only", "Right only", "Binary files are different" or "Text files are different". The directory C:\temp\drupal-6.25-patch now contains the patch to apply to Drupal. Now close WinMerge.

Step 4: Identify stale files

If the note in step 3 instructs you to run this step (there were "Left only" files before you started deleting identical files), we will first identify those files that are no longer shipped with the new Drupal release, so we can delete those stale files afterwards in step 7.

To identify the stale files, we will again use WinMerge, but this time we will purge files from the copy of the old Drupal files, i.e., C:\temp\drupal-6.24-stale.

Start WinMerge once again, and choose "File" » "Open" to display the Open dialog once again (see step 3):

WinMerge: choose directories to compare in step 4

Fill the dialog as described:

  1. This time the "Left" field must point to the copy of the old Drupal directory, i.e., C:\temp\drupal-6.24-stale\.
  2. Now the "Right" field must point to the new (untouched) Drupal directory, i.e., C:\temp\drupal-6.25\. (Watch out: don't use the Drupal patch directory C:\temp\drupal-6.25-patch as it no longer contains the identical files!)
  3. Check "Include Subfolders"
  4. Click OK

Like in step 3, to see all changed files without having to expand directories, make sure to tick all 6 "View" items and to untick "Tree mode". Now you will see a flat list containing all files, including the file comparison result. Sort the results by comparison result by clicking on that column header. Now the "comparison result" column header is highlighted and features a sort arrow.

We will now create the list of stale Drupal files, by deleting all files in the copy of the old Drupal directory, i.e., C:\temp\drupal-6.24-stale\, that also exist in the new Drupal directory, be they identical or different. To do so, we again sort the file list on the "Comparison result" column. Then we do the following:

  1. Select all files that are flagged as identical (i.e., flagged as "Binary files are identical" or "Text files are identical")
  2. Right-click any selected file to display the context menu
  3. Select "Delete" » "Left" to eliminate all unmodified files from the "stale" copy of the old Drupal directory.
  4. Now select all files that are flagged as different (i.e., flagged as "Binary files are different" or "Text files are different")
  5. Once again, right-click any selected file to display the context menu
  6. Select "Delete" » "Left" to eliminate all modified files from the "stale" copy of the old Drupal directory.

After deletion of those files, you should only see files flagged as "Left only" or "Right only". The latter are irrelevant since they did not exist yet in the Drupal release you are currently running, so they can't be obsolete yet. You can now close WinMerge.

Most likely there will be only very few "stale" files. This means that you will have to explore potentially tens of empty directories in a deep tree to find the stale files. Fortunately, there is a simple way to know which directories contain those stale files, by creating an archive from C:\temp\drupal-6.24-stale-files with the 7-Zip tool. Indeed, when opening that archive in 7-zip, you will see how many files the archive contains, and in which (sub)directories those files are to be found (see the "Files" column). Since updating from Drupal 6.24 to Drupal 6.25 does not retire files, I created an archive of the Drupal patch folder instead, to illustrate what I mean:

7-Zip: create archive to identify directories containing files

From the fake example above it appears that stale files exist only at the top level directory (1 file: CHANGELOG.txt), as well as 1 file in includes/, 35 files in modules/ and 6 files in themes/. This archive view will be very useful in step 7.

We are now ready to perform the actual Drupal update.

Step 5: Enable maintenance mode

Log onto your Drupal site with administrator privileges, and visit the Site maintenance page (Administration » Site configuration » Site maintenance).

Tick "Off-line" and click "Save configuration". Your site now runs in maintenance mode (off-line):

Drupal: maintenance mode enabled

Step 6: Upload Drupal patch

The Drupal patch created in step 3 can now be applied to your Drupal site. I will explain how to do so with FileZilla. You will need the FTP access codes for your web space to update your Drupal files.

Enter the FTP web space account data in FileZilla and connect to your FTP access. You will now see your local file system in the left half of the screen, and the remote file system in the right half. Browse to the Drupal patch directory in the left pane (C:\temp\drupal-6.25-patch), and browse to the top directory on your web host where your Drupal is installed (in my case it's the FTP root):

FileZilla: prepare for uploading the Drupal patch

In the left file sub pane, select all files and directories. Right-click on the selection to open a context menu, and choose "Upload":

FileZilla: start upload

File upload will start, and eventually a dialog will ask you what to do with existing files:

FileZilla: confirm overwrite dialog

Choose "Overwrite" as action, and tick the 3 check boxes as shown in attached screenshot. Then click "Ok" to resume file upload. Upload will resume, and you will be able to monitor the upload progress by seeing the number of queued files decrease (at the bottom of the window):

FileZilla: upload progress

If all goes well, you will see no queued or failed transfers:

FileZilla: upload done without errors

If one or more file transfers failed, first check what is the reason why the upload failed (no more disk space on server, network errors, FTP error, file in use on server), correct the problem if possible and repeat this step.

Step 7: Delete stale files

If you were instructed to run step 4, we will proceed with removing the identified stale files. We will now use the 7-Zip archive explorer (see step 4) to progress through the stale files in a sparse yet directory laden archive.

To make life easier, we will use the "Synchronized browsing" feature from FileZilla. This feature will change the remote directory each time you change the local directory, and is hence very useful to navigate identical directory trees.

First connect to your FTP access (should still be the case, see step 6), Browse to the Drupal stale directory in the left pane (C:\temp\drupal-6.24-stale), and browse to the top directory on your web host where your Drupal is installed (in my case it's the FTP root). Now enable "Synchronized browsing" by clicking "View" » "Synchronized browsing":

FileZilla: enable synchronized browsing

For each of the stale files (identified in the 7_Zip archive explorer), open the corresponding local directory in the left hand pane of Filezilla, select the stale remote file in the right hand file pane, right-click that stale file to open the context menu in which you can delete the remote file.

Once all stale files have been deleted on the remote web space, the file level update is complete.

Step 8: Run update.php

New releases of Drupal, core and contributed modules may introduce changes that require manipulating the database scheme or create / alter specific configuration parameters in the database. To perform these updates we must run the update.php script with administrator privileges. You can access this update script via "Administration" » "Site building" » "Modules".

Drupal: run update.php

Click "Continue" to display the database and system configuration updates queued. I'm using the Update form enhancement module to cleanly show the modules with pending updates and hide those not requiring updating, so your list may be cluttered with all installed modules instead:

Drupal: review update.php update list

Review the updates (not really required) and click "Update" to launch the Drupal database update process:

Drupal: update.php progress

If the update script succeeded, no error messages should appear:

Drupal: update.php results

Since some updates depend on other updates (e.g., a database change in one module depending on another database change in another module), you may have to run update.php more than once. As a rule of thumb, run update.php until you see no more updates are required (No updates visible in the per module update list, and during the update when you see "Remaining 0 of 0"), and then once more.

Step 9: Verify installed Drupal release

Log onto your Drupal site with administrator privileges, and visit the available updates report (Administration » Reports » Available updates):

Drupal: check available updates after update

Since I updated from Drupal 6.24 to 6.25 I can confirm that the installed version is Drupal 6.25, and that it's up-to-date.

Step 10: Disable maintenance mode

Log onto your Drupal site with administrator privileges, and visit the Site maintenance page (Administration » Site configuration » Site maintenance):

Drupal: disable maintenance mode

Tick "Online" and click "Save configuration". Your updated site is now back online:

Drupal: maintenance mode disabled, back online

That's it!

ketone review's picture

Reply to comment | ShutterFreak!

Greetings I am so glad I found your site,
I really found you by error, while I was browsing on
Digg for something else, Anyways I am here now and would just like to say many thanks for a
remarkable post and a all round entertaining blog (I also love
the theme/design), I don’t have time to
read it all at the moment but I have bookmarked it and also added
your RSS feeds, so when I have time I will be back to read
much more, Please do keep up the awesome jo.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.