Gallery 2.2–Multisite and Multiroot

Recently I tried to use the Gallery Multiroot module/plugin to setup a new site based upon an existing Album in our gallery. Since we started sorting albums chronologically, we wanted to sort out the Dachshund photos separately. To do this, I used the Multiroot feature. Unfortunately, I couldn’t get this to work as I’m already using the Multisite plugin to host several Galleries off of my web server. The magic touch was to use the following file, the first line is key and had to be added to make things work in the Multisite configuration.

[sourcecode language=’php’]
define(‘GALLERY_CONFIG_DIR’, “/var/virtualwww/gallery.raschnet.com”); //I had to add this line

require(‘/usr/local/share/gallery2/embed.php’);
$ret = GalleryEmbed::init(
array(’embedUri’ => ‘/’,
‘g2Uri’ => ‘http://gallery.raschnet.com/’,
‘apiVersion’ => array(1, 2)
));

if ($ret) {
print ‘‘ . $ret->getAsHtml() . ‘‘;
return;
}

$gallery->setConfig(‘login’, true);
$gallery->setConfig(‘defaultAlbumId’, 28426);
$gallery->setConfig(‘breadcrumbRootId’, 28426);

GalleryMain();
[/sourcecode]

Now live: DRNA Gallery

stopgaps

In high-school, the teacher who taught a programming class and worked to write a Java-based voting system insisted they build in logging functionality, in spite of the iron-clad storage of data into text files. This discussion made an impression upon me because the best and worst thing about programming and computers is they do exactly what they’re told to do. Unfortunately, this means that the error of lowly humans can easily seep into what the code or program asks the computer to do.

We were reminded of this lesson at iContact. Just because your software ‘should’ never do something, doesn’t mean you shouldn’t make these rules explicit. An emergency bugfix to our queues at iContact had a trojan horse to allow messages from Client A to be matched with subscribers from Client B. Clearly this is bad, and now we’re putting a patch in to detect and throw exceptions if any situation like this occurs. This is, however, a great example of where things that should never happen are still worthy of writing software to prevent. It’s not shameful, it’s insightful to admit that as a programmer we are human and don’t understand as much as we might like.