tags 309236 + patch
thanks

I found an easy way to achieve this, with a small change to Config.pm
involving an environment variable to be set by apache.
I now have several bugzilla bases, with their configuration in
/etc/bugzilla-<id> and data in .../web/data-<id>.

Here is the dpatch patch.  Note that I have not used the change to
$templatedir yet, so this one may not be adequate.

To use it, just add "SetEnv X_BUGZILLA_SITE some-id" to each of the
virtual hosts.  I did not implement support for these alternate sites in
the debian scripts, but at least the db creation part can be done by using
the standard /etc/bugzilla/ as a scratch area, and running
"dpkg-reconfigure bugzilla" for db "foo", copying localconfig into
bugzilla-foo, then re-running "dpkg-reconfigure bugzilla" for db "bar",
and copying into bugzilla-bar.  You surely know better how that part could
be done more properly :)

bugzilla/work$ cat debian/patches/yd02_multisite.dpatch
#! /bin/sh /usr/share/dpatch/dpatch-run
## yd02_multisite.dpatch by  <[EMAIL PROTECTED]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: support for multi-site installs (/etc/bugzilla-$X_BUGZILLA_SITE,
web/data-$X_BUGZILLA_SITE)

@DPATCH@
diff -urNad work/Bugzilla/Config.pm /tmp/dpep.C1F6Jf/work/Bugzilla/Config.pm
--- work/Bugzilla/Config.pm     2005-05-19 17:35:17.000000000 +0200
+++ /tmp/dpep.C1F6Jf/work/Bugzilla/Config.pm    2005-05-19
17:35:44.000000000 +0200
@@ -51,12 +51,25 @@
 # graphs (since the path will be wrong in the HTML). This will be fixed at
 # some point.

+# support for multi-site installation through X_BUGZILLA_SITE variable to
+# be passed by Apache.
+our $xsite = '';
+if (defined $ENV{X_BUGZILLA_SITE}) {
+    $xsite = "$ENV{X_BUGZILLA_SITE}";
+    # untaint (make sure it has no '/' and is overall something sane)
+    if ($xsite =~ m/^(\w[\w\-.]*)$/) {
+        $xsite ="-$1";
+    } else {
+        die "invalid X_BUGZILLA_SITE: $xsite";
+    }
+}
+
 our $libpath = '/usr/share/bugzilla';
-our $localconfig = "/etc/bugzilla/localconfig";
-our $datadir = "$libpath/web/data";
-our $templatedir = "$libpath/template";
+our $localconfig = "/etc/bugzilla${xsite}/localconfig";
+our $datadir = "$libpath/web/data${xsite}";
+our $templatedir = (-d "$libpath/template${xsite}") ?
"$libpath/template${xsite}" : "$libpath/template";
 our $webdotdir = "$datadir/webdot";
-our $params_file = "/etc/bugzilla/params";
+our $params_file = "/etc/bugzilla${xsite}/params";

 # Module stuff
 @Bugzilla::Config::EXPORT = qw(Param);




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to