diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2013-11-22 17:42:24 +0100 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2013-11-22 17:42:24 +0100 |
commit | b2cbd18450de1ff8fc74f0283bc20f2bbcdf7462 (patch) | |
tree | 3c06b3dbadea8b38e557784b95ffc9d7871b0624 | |
parent | 48f1c7dd3b0dbec024b973f590759178b7a42d0c (diff) | |
parent | c6528d5819e6503c6772a3a8a17029cb892519b0 (diff) | |
download | bugzilla-b2cbd18450de1ff8fc74f0283bc20f2bbcdf7462.tar.gz bugzilla-b2cbd18450de1ff8fc74f0283bc20f2bbcdf7462.tar.xz |
merged with bugzilla/4.2
-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)"; } |