summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Constants.pm
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2013-11-13 16:18:48 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2013-11-13 16:18:48 +0100
commit1ffac1f1de466b1339f9b7b32efcd1210dc5cb89 (patch)
tree18c0b2ca1ceacfb6d06e072e53e4dc9644d66db3 /Bugzilla/Constants.pm
parent5e4ff90ad1ae7b128de3355600e573daced863f2 (diff)
downloadbugzilla-1ffac1f1de466b1339f9b7b32efcd1210dc5cb89.tar.gz
bugzilla-1ffac1f1de466b1339f9b7b32efcd1210dc5cb89.tar.xz
Bug 843457: PROJECT environment variable is not honored when mod_perl is enabled
r/a=glob
Diffstat (limited to 'Bugzilla/Constants.pm')
-rw-r--r--Bugzilla/Constants.pm14
1 files changed, 11 insertions, 3 deletions
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index ecc45bf68..9ffb325df 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -591,6 +591,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
@@ -607,12 +614,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";
}
@@ -647,6 +655,6 @@ 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;