Problems with album mirror + mod for selective mirroring

kilo

Joined: 2003-04-20
Posts: 1
Posted: Sun, 2003-04-20 18:42

firstly just thought i'd say great gallery...been using it for a while and its really excellent, can't wait for v2.

anyways, i couldn't seem to get the album mirroring working - after a quick look at the code in classesAlbum.php, in function getAlbumDirURL($type) i noticed the following:

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
if (!strcmp($serialContents, $this->tsilb)) {
// return mirror
}
</TD></TR></TABLE><!-- BBCode End -->

by removing the ! the mirroring seems to work ok.

the reason i was looking around in the mirror code is to add the ability to selectivly mirror depending upon whether the client is on the same subnet as the server. ie, if a user is viewing the gallery on our local subnet, the images are served by the local server (over the lan). clients from outside our subnet are served pictures from our isp webspace (hence not loading our adsl line).

for anyone interested, the code is as follows - added to the function getAlbumDirURL()

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
// get xxx.xxx.xxx. part of the client ip
$client=substr($_SERVER['REMOTE_ADDR'],0,10);

// only use mirror sites for clients outside our subnet (subnet 192.168.0)
if ($gallery->app->feature["mirror"] &amp;&amp;
strcmp($type, "highlight") &amp;&amp; $client!='192.168.0.') {
</TD></TR></TABLE><!-- BBCode End -->

 
alindeman
alindeman's picture

Joined: 2002-10-06
Posts: 8194
Posted: Sun, 2003-04-20 23:47

Try the latest CVS version. Tell us if that doesn't work (there was a fix for something similar checked into CVS)..

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Tue, 2003-06-10 08:42

thanks for that little tid bit, it would be a pretty good addition to the options somewhere for gallery. i have just finished setting up a fast mirror and an rsync cron job, but would like the couple of local clients to pull from the local server. this will do the trick nicely :)