Gallery2:Upgrading to 2.1.x - Gallery Codex
Personal tools

Gallery2:Upgrading to 2.1.x

From Gallery Codex

Make a backup

The upgrade process should be very safe. But just in case, it's a very good idea for you to make a backup. So before you perform this upgrade you should backup the database just in case. If something goes wrong you can always restore the database and try again. If you've made modifications to your copy of the Gallery 2 code, you should back up your changes also in case the update overwrites some of them.

Next: Identify your_Gallery_2_version

Identify your Gallery 2 version

Browse to your Gallery2 installation in your web browser, log in as an administrator, click the "Site Admin" link then click the "Maintenance" link. You'll be presented with a list of maintenance tasks. Next to the task marked System Information click the run now link then look for a line marked Gallery version.

Next: Upgrade

Upgrade

There are three ways to upgrade:

  1. Replace all files: Download a complete replacement for your Gallery2. This is slower, but very reliable.
  2. Use an update file: Replace only what's changed since the 2.1 / 2.1.x release. This only works if you're using the 2.1 or a later 2.1.x release. If you've modified your Gallery2 code, this technique can preserve your changes. It's faster than a complete replacement, but takes a little more know-how.
  3. Update from Subversion: This is the best approach if you've made changes to your Gallery2 code. It's relatively fast and won't step on any changes you've made, but it requires a lot of know-how.

Use an update file

First determine your exact Gallery 2.1.x version.

This file contains both the patch files and all the changed files so that once you have it you can upgrade using either approach. Copy this file to your webserver and unpack it in your gallery2 directory. Once unpacked, you will have the following files:

(We don't list all the changed-xxx and patch-xxx files here)

Remember that when you're done with the update, you should delete these files! Leaving them around won't hurt you, and won't be a security risk but they don't help either. Also remember that you don't need all these files. You only need to patch the modules that you have installed. Now there are two different approaches you can try.

  1. Replace only changed files: This approach will overwrite any files you have with the latest 2.1.2 versions. If you've changed any of those files you will lose your changes. This is a reliable approach.
  2. Apply patches: This approach will update your existing files to add in any changes in the latest release. If you've changed your files, this approach is likely not to affect any changes you've made and your changes will be preserved.

Replace only changed files

Inside the zipfile are more zipfiles with names like "changed-files-xxx.zip". Each of these contains the changes for a specific module. Simply unzip these files inside your Gallery 2 directory and then run the upgrader and follow the instructions. This is reasonably fast because there are very few changed files however if you've modified any of the files that are replaced, your modifications will be lost. On Unix you'd do this:

cd gallery2
unzip changed-files-core.zip
unzip changed-files-archiveupload.zip    (if you use the archiveupload module)
unzip changed-files-comment.zip          (if you use the comment module)
...

Repeat this for all changed-files-xxx.zip files.

Next: Run_the_web_based_upgrader

Apply patches

The advantage to this approach is that it will preserve any modifications that you've made except in the highly unlikely event of a conflict between your modifications and the changes that we've made as part of this patch.

In order to do this, you must be on a system that has the "patch" utility. This is a pretty standard utility on Unix systems, and if you're on Windows you can get it as part of the Cygwin package. Solaris users should use gpatch (GNU patch, /usr/bin/gpatch on Solaris 10).

There are .txt files included in the upgrade file named something like "patch-xxx.txt" . All updates contain patch-core.txt. Copy them to your Gallery 2 directory and then do the following:

patch -p0 -s < patch-core.txt
patch -p0 -s < patch-archiveupload.txt  (if you have modules/archiveupload)
patch -p0 -s < patch-comment.txt        (if you have modules/comment)
...

Repeat this for all patch files. You should expect to see no output. Anything that is returned is an error. If you get an error you should contact us in the Gallery 2 forums and ask for help.

Next: Run_the_web_based_upgrader

Replace all files

Download a complete new copy of Gallery 2.1.2 and simply unpack it on top of your existing Gallery 2 install and then run the upgrader. This is a simple and thorough but slow method. Also, any modifications that you've made to Gallery 2 will be lost when you replace the files, with the exception of template changes made in local directories.

Note: Gallery 2 packages come in 4 flavors (typical, minimal, full, and developer). You should try to make sure you download the same package as you did before.

Next: Run_the_web_based_upgrader

Update from Subversion

If you have Gallery 2 installed from Subversion you can simply run:

svn update

which will get you the latest code from the area you originally checked out. If you checked out BRANCH_2_1 then this will retrieve the latest 2.1.x version; if you checked out the trunk this will get the latest development code.

Next: Run_the_web_based_upgrader