Single PHP code for multiple Galleries (2.x)

posbis

Joined: 2004-02-01
Posts: 17
Posted: Sun, 2010-07-04 13:27

Hi

I have a Linux Server with four 2.x Galleries running. When a new version is released I always have to go through all four of them, copy the new PHP code over the old one and then step through the Updater. They are all identical, means same themes etc.

Question: Isn't there a possibility to install the PHP code of Gallery 2.x at a single location and link it into all my web roots ?

I know, the single point of problem is the config.php file which must be different for all four galleries,
so creating a symbolic link will not solve the problem.

I thought about the following possibilities:

1. Using a relative link for config.php

I would start in the document root of my webs

- ln -s /<my location of gallery code> gallery2
- cd gallery2
- mv config.php .. (Moving config.php into my web root)
- ln -s ../config.php config.php

This way I would have 4 individual config.php files with the correct configuration data (Album Dir, MySQL DB, ...) for my galleries. Unfortunatley the relative path ../config.php cannot be interpreted by Linux correctly. Don't know why.

2. Using a hard link for the directory

Same as approach but with a hard link. Unfortunately this doesn't work neither as Linux can only have the . and .. dirctory entries hard linked in a single directory. Only files can be hard linked.

3. Bind mount

In /etc/fstab I would mount /<my location of gallery code> to <web root>/gallery2

e.g. mount /<my location of gallery code> /<web root>/gallery2

Then I would use the relative config.php approach (../config.php)

I think this would work as I already did this with mediawiki and it worked there. But I hate to have all those rebind
mounts in my /etc/fstab as I already have lots of them.

4. Gallery would search for site specific config.php files

config-www.mydomain1.com.php
config-www.mydomain2.org.php

This way all the config files can stay inside the same PHP code directory and this one could easily be linked
into the different web roots (ln -s).

The domain name would be the one specified in Apaches virtual server config (ServerName).

Wouldn't that be a good idea ?

Could you implement this in Gallery 2.x and 3.x ? Please ...

OK.. You would have to run the upgrader for each gallery after upgrading the central PHP Gallery code but at least the file copying etc. would be less complicate.

Does anyone else have a good idea on this ?

Regards
Oliver

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2010-07-04 13:31

There is a multisite config option you must have missed during setup, but there will be no more releases of gallery 2.x as 3.x is where all the action is.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sun, 2010-07-04 23:20

Even with the multi-site config of G2, you still have to upgrade each site. The upgrade process is more than simply changing config.php. There are changes to the database and sometimes more than just the g2data/versions.dat file under g2data

But so long as you're on 2.3.1 of G2, the likelihood of ever having to upgrade G2 again is very, very low. As suprsidr pointed out, G2 is no longer in development. The only reason a new release would come out would be to fix some major unknown security issue. Even if that were the case, you'd most likely just have to patch the one or two files and not "upgrade"
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here