diff options
-rw-r--r-- | Bugzilla/Constants.pm | 14 | ||||
-rw-r--r-- | Bugzilla/DB/Sqlite.pm | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index e13a93388..b4262f8ab 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -614,6 +614,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 @@ -630,12 +637,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"; } @@ -670,6 +678,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; diff --git a/Bugzilla/DB/Sqlite.pm b/Bugzilla/DB/Sqlite.pm index e13fd18e1..ee92909e3 100644 --- a/Bugzilla/DB/Sqlite.pm +++ b/Bugzilla/DB/Sqlite.pm @@ -226,7 +226,7 @@ sub sql_to_days { sub sql_date_format { my ($self, $date, $format) = @_; - $format = "%Y.%m.%d %H:%M:%s" if !$format; + $format = "%Y.%m.%d %H:%M:%S" if !$format; $format =~ s/\%i/\%M/g; return "STRFTIME(" . $self->quote($format) . ", $date)"; } |