From: Frédéric Buclin Date: Wed, 13 Nov 2013 15:17:12 +0000 (+0100) Subject: Bug 843457: PROJECT environment variable is not honored when mod_perl is enabled X-Git-Tag: bugzilla-4.4.2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5d288458658b7fde5b8ef2fb03a8701e01828fc;p=thirdparty%2Fbugzilla.git Bug 843457: PROJECT environment variable is not honored when mod_perl is enabled r/a=glob --- diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index da12e03672..191133768b 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -592,6 +592,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 @@ -608,12 +615,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"; } @@ -648,6 +656,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;