]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 843457: PROJECT environment variable is not honored when mod_perl is enabled
authorFrédéric Buclin <LpSolit@gmail.com>
Wed, 13 Nov 2013 15:14:54 +0000 (16:14 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Wed, 13 Nov 2013 15:14:54 +0000 (16:14 +0100)
r/a=glob

Bugzilla/Constants.pm

index 9fa0c68182ce5ac0d0d3411b4639483ea4416865..60c7a34e04b6d78a34de26ca8cf784051627e343 100644 (file)
@@ -608,6 +608,13 @@ use constant AUDIT_CREATE => '__create__';
 use constant AUDIT_REMOVE => '__remove__';
 
 sub bz_locations {
+    # Force memoize() to re-compute data per project, to avoid
+    # sharing the same data across different installations.
+    return _bz_locations($ENV{'PROJECT'});
+}
+
+sub _bz_locations {
+    my $project = shift;
     # We know that Bugzilla/Constants.pm must be in %INC at this point.
     # So the only question is, what's the name of the directory
     # above it? This is the most reliable way to get our current working
@@ -624,12 +631,13 @@ sub bz_locations {
     $libpath =~ /(.*)/;
     $libpath = $1;
 
-    my ($project, $localconfig, $datadir);
-    if ($ENV{'PROJECT'} && $ENV{'PROJECT'} =~ /^(\w+)$/) {
+    my ($localconfig, $datadir);
+    if ($project && $project =~ /^(\w+)$/) {
         $project = $1;
         $localconfig = "localconfig.$project";
         $datadir = "data/$project";
     } else {
+        $project = undef;
         $localconfig = "localconfig";
         $datadir = "data";
     }
@@ -664,7 +672,7 @@ sub bz_locations {
 
 # This makes us not re-compute all the bz_locations data every time it's
 # called.
-BEGIN { memoize('bz_locations') };
+BEGIN { memoize('_bz_locations') };
 
 1;
 
@@ -676,4 +684,6 @@ BEGIN { memoize('bz_locations') };
 
 =item contenttypes
 
+=item bz_locations
+
 =back