Gallery1:Upgrading - Gallery Codex
Personal tools

Gallery1:Upgrading

From Gallery Codex

Upgrading Gallery is extremely easy, and generally very painless. However, it is strongly recommended that you backup your albums directory (and gallery directory if you have made modifications) before attempting to upgrade

This page describes how to upgrade your Gallery from an old version to a new one. Upgrading is very easy, and you won't lose any data if you follow all the directions.


Upgrading with Shell Access

  1. Put your Gallery into configuration mode. This is very important. If you don't do this, then you won't be able to back up your existing setup directory or install the new setup code on top of it. Do this by chmodding .htaccess and config.php 0777 and by chmodding the setup/ directory 0755.

    cd gallery

  2. Make a backup of your old Gallery installation. The easiest way to do this is to use the tar command.

    tar -cz gallery > gallery-backup.tar.gz

    On Windows, use something like WinZip to create an archive of your Gallery directory.
  3. Download Gallery from the Gallery SF.net Download Page. Put the tarball in your gallery directory's parent directory.
  4. Untar the new Gallery version over the old one.

    tar -xvzf gallery-1.x.x.tar.gz
    [list of new files]


    Windows users: use WinZip to extract Gallery over the old installation

  5. Re-run the configuration wizard. Afterward, put Gallery back into secure mode, as described in that guide.
  6. Some upgrades include changes to the Gallery data formats and require you to upgrade all of your albums. You can either let this happen automatically the first time somebody views the album, or you can upgrade the albums yourself when logged in as an admin. If you want to upgrade them all, open

    http://www.example.com/gallery/upgrade_album.php

    in your web browser (use the real url to your Gallery, of course) and then follow the instructions you find there.
  7. Enjoy your upgraded Gallery!

Upgrading Gallery with FTP

  1. Put your Gallery into configuration mode. This is very important. If you don't do this, then you won't be able to back up your existing setup directory or install the new setup code on top of it. Do this by chmodding .htaccess and config.php 0777 and by chmodding the setup/ directory 0755.
  2. Make a backup copy of your Gallery directory. Use your FTP client to download the old Gallery directory, just in case
  3. Download Gallery from the Gallery SF.net Download Page. Untar it using tar or WinZip on your computer.
  4. Using your FTP client, upload the new Gallery files over the old Gallery files. Yes, this will override the old Gallery files, but this is OK!
  5. Re-run the configuration wizard. Afterward, put Gallery back into secure mode, as described in that guide.
  6. Some upgrades include changes to the Gallery data formats and require you to upgrade all of your albums. You can either let this happen automatically the first time somebody views the album, or you can upgrade the albums yourself when logged in as an admin. If you want to upgrade them all, open

    http://www.example.com/gallery/upgrade_album.php

    in your web browser (use the real url to your Gallery, of course) and then follow the instructions you find there.
  7. Enjoy your upgraded Gallery!

Note

If after you upgrade your Gallery, you get a blank screen or a PHP error (e.g. "function not found", etc...), don't panic. Your FTP client probably didn't override all the files. The solution is to delete all the Gallery files except config.php and your albums directory and re-upload Gallery (don't forget to re-run the configuration wizard).

Upgrading a modified Gallery

Upgrading a Gallery installation you have modified can be difficult. By modified, we mean modifying the actual PHP code Gallery runs on. If you just made changes in the html_wrap/ or css/ directories, you should have no worries (you should have removed the .default extension from the files before modifying them, so that they won't get overwritten when upgrading) and can proceed upgrading Gallery using one of the guides above.

If you indeed have modified some of the PHP code that Gallery uses, upgrading will be more difficult, but not totally impossible. It will be, however, extremely hard or impossible to upgrade a modified Gallery without shell access to the server. Keep this in mind. First, you'll need to download the original non-modified Gallery version that corresponds to the version you are currently using (i.e. if you modified Gallery 1.3.4, re-download an unmodified Gallery 1.3.4). Unpack it in the same directory that your modified Gallery is in, but name is something like orig_gallery/. You should now have two directories, gallery/ (or whatever your modified Gallery's directory name is) and orig_gallery/. Next, run this command:

   diff -r -C 3 orig_gallery gallery > changes.txt
  

You now have a patch file containing the changes you made. Next, download the newest version of Gallery (the one you want to upgrade to). "cd" to the parent directory of the new unpacked Gallery. Run this command:

   patch < changes.txt
  

Warning

The odds are that this won't completely work, because we may have made changes to the same line you changed, causing patch to get confused. However, it's worth a try.

Modified Galleries