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

Gallery2:Upgrading to 2.0.x

From Gallery Codex

Gallery 2.0.4 comes with an important security patch that is recommended for all Gallery 2 installations. We advise that you upgrade to it as soon as possible.

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

In order to upgrade, you need to figure out what version of Gallery2 you're currently using. 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. If you're running an official release it will say 2.0, 2.0.1, 2.0.2 or 2.0.3. If it has a + in it, like 2.0+ or 2.0.1+ then you've installed from a nightly snapshot.

Next: Update_your_files_to_2.0.4

Download the Update File

Download the correct version of the upgrade file that matches the version of Gallery2 that you're using.

This file contains both the patch 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. Depending on which version you're upgrading from, the file will contain some or all of the following files:

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.

Update your files to 2.0.4

There are four different ways you can update to the 2.0.4 files. They're all relatively easy to do, but you should choose the method that works best for your situation.

  • If you're on a Unix system the Applying a patch approach is a quick and easy way to do it. We tell you exactly what to do so it's easy even if you haven't applied a patch before.
  • If you have not modified any files in your Gallery 2 installation, or if none of your modifications have been inside the modules/core directory then any of the techniques below will work for you.
  • If you've modified a few of the files yourself then you should consider using the Applying a patch approach because unless your changes directly conflict with our changes, the patch shouldn't break anything.
  • If you're running from a nightly snapshot then you should consider using the Replacing all files approach because we can't be sure that our patches apply cleanly to all the nightly snapshots.


Note: In general, if you've extensively modified your Gallery 2 then it's a very good idea to use Gallery 2 from CVS and take the Updating via CVS approach.

Option 1. Replacing 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 thesee file 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-zipcart.zip    (if it's in the update, and you use zipcart)
Next: Run_the_web_based_upgrader

Option 2. Replacing all files

If you're unsure, you can download a complete new copy of Gallery 2.0.4 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. If you're updating from 2.0.1 and you're using the zipcart module (look in your gallery2/modules directory or on Site Admin -> Modules) then you should download the either the full or the developer package.

Next: Run_the_web_based_upgrader

Option 3. Applying a patch

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.

The patch file is very small, but in order to use it 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. If you're updating from 2.0.1 or earlier the update will also contain patch-zipcart.txt. Copy them to your Gallery 2 directory and then do the following:

patch -p0 -s < patch-core.txt
patch -p0 -s < patch-zipcart.txt      (only if you have a modules/zipcart directory)

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

Option 4. Updating via CVS

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

cvs update -Pd

which will get you the latest code. This will also get you any new features that we've added since the 2.0 release. If you want to make sure that you stay close to 2.0, you can track the 2.0 branch by doing this:

cvs update -Pd -r BRANCH_2_0

That will get you only code that has changed since 2.0.

Note: Be very careful when you do this! If you've been updating from CVS regularly you may wind up downgrading if you go back to the 2.0 branch and that may cause you problems. Only do this if you know what you're doing.

Next: Run_the_web_based_upgrader

Run the web based upgrader

Once your files have been updated, open up your Gallery 2 in your web browser and it will take you right to the upgrader automatically. Follow the instructions there.

On step 2 of the upgrader, the Gallery file integrity check should show Success. If there are missing/deleted/modified files listed here, you should make sure that they are files that you yourself have modified in your own copy. If it reports over a hundred missing files from the modules/core/test directory then verify that you did not accidentally install the developer zip of changed files over an install that was originally from the minimal, typical or full version. If you did that's ok! Just go back and get the right zip file and try again.

Note: If you're updating from 2.0.1 or earlier you may get an integrity error warning that the docs/LOCALIZING file is obsolete. You can delete this file from your installation safely.

Upon successful completion it will drop you back into your Gallery 2 install with the latest version and you're done.

advertisements