Lock Gallery for upgrades

chopinhauer

Joined: 2004-06-21
Posts: 9
Posted: Wed, 2005-05-18 16:57

How do you lock your gallery during upgrades? The ideal solution would be to allow only your IP for the time being and redirect the other users to another page. So something like this in the .htaccess file should work:

Order Deny, Allow
Deny from all
Allow from <ip of my computer>
ErrorDocument 403 /work-in-progress.html

Where work-in-progress.html is big enough for IE not to show the default "Access Denied" page. Is there a better/more elegant solution. E.g. if the users receive a 302 code to the work-in-progress page it could be more RFC compliant.

What do you do when you upgrade a big software like gallery?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Thu, 2005-05-19 03:14

Here's my update process for G1:

1) Download G1 and decompress it to a separate directory than where G1 is currently installed.

2) I copy over the existing .htaccess info with this:

DirectoryIndex update.index.php

php_value post_max_size 20971520
php_value upload_max_filesize 20971520
php_value magic_quotes_gpc off
php_flag session.bug_compat_warn off


Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /gallery/
RewriteRule ^([^\.\?/]+)/([0-9]+)$      /gallery/update.index.php [QSA]
RewriteRule ^([^\.\?/]+)/([A-Za-z_0-9\-]+)$     /gallery/update.index.php [QSA]
RewriteRule ^([^\.\?/]+)/$      /gallery/update.index.php       [R]
RewriteRule ^([^\.\?/]+)$       /gallery/update.index.php [QSA]
</IfModule>

3) Copy an my update.index.php file into my G1 directory, it looks like this

<html>
<head>
<title>Upgrading gallery</title>
</head>

<body>
<p>Please wait while gallery is updated.<br>
<?php
  putenv("TZ=America/Los_Angeles");
  echo date( "F d, Y. H:i:s a", getlastmod() );
?>
</p>
</body>
</html>

4) chmod 777 .htaccess and config.php in my G1 directory

5) ensure .htaccess and config.php do not exist in the directory where I put the updates

6) move the updated files into my G1 directory

7) perform the update and chmod 644 .htaccess and config.php and run secure.sh when complete. My .htaccess file has now been overwritten so users can immediately start using it.

My process is much simpler for G2 as it's faster and easier. I don't worry about the "updating" splash page.

I just download the update (usually through CVS) straight over my existing files. chmod 777 .htaccess and config.php. Spend the 10 seconds going through the upgrader and backing up my DB and I'm done. Oh and chmod 644 .htaccess and config.php.