summaryrefslogtreecommitdiffstats
path: root/Bugzilla.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2016-03-01 14:27:28 +0100
committerDylan William Hardison <dylan@hardison.net>2016-03-01 14:27:28 +0100
commit8ce105347fda12b58424f8fb21cfc7a9bd7e2431 (patch)
tree574a3df463983523239b2e9491dc16906a4c39a5 /Bugzilla.pm
parent085c24c80c6a79f21aba768bf16955685dcc47b7 (diff)
downloadbugzilla-8ce105347fda12b58424f8fb21cfc7a9bd7e2431.tar.gz
bugzilla-8ce105347fda12b58424f8fb21cfc7a9bd7e2431.tar.xz
Revert "Bug 1251208 - Bugzilla->request_cache() can be faster"
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r--Bugzilla.pm35
1 files changed, 29 insertions, 6 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index c50d22523..0ce152e48 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -736,6 +736,7 @@ sub local_timezone {
||= DateTime::TimeZone->new(name => 'local');
}
+# Send messages to syslog for the auditing systems (eg. mozdef) to pick up.
sub audit {
my ($class, $message) = @_;
openlog('apache', 'cons,pid', 'local4');
@@ -743,21 +744,43 @@ sub audit {
closelog();
}
-my $request_cache = {};
-
-sub request_cache { return $request_cache }
+# This creates the request cache for non-mod_perl installations.
+# This is identical to Install::Util::_cache so that things loaded
+# into Install::Util::_cache during installation can be read out
+# of request_cache later in installation.
+our $_request_cache = $Bugzilla::Install::Util::_cache;
+
+sub request_cache {
+ if ($ENV{MOD_PERL}) {
+ require Apache2::RequestUtil;
+ # Sometimes (for example, during mod_perl.pl), the request
+ # object isn't available, and we should use $_request_cache instead.
+ my $request = eval { Apache2::RequestUtil->request };
+ return $_request_cache if !$request;
+ return $request->pnotes();
+ }
+ return $_request_cache;
+}
sub clear_request_cache {
- %$request_cache = ();
+ $_request_cache = {};
+ if ($ENV{MOD_PERL}) {
+ require Apache2::RequestUtil;
+ my $request = eval { Apache2::RequestUtil->request };
+ if ($request) {
+ my $pnotes = $request->pnotes;
+ delete @$pnotes{(keys %$pnotes)};
+ }
+ }
}
# This is a per-process cache. Under mod_cgi it's identical to the
# request_cache. When using mod_perl, items in this cache live until the
# worker process is terminated.
-my $process_cache = {};
+our $_process_cache = {};
sub process_cache {
- return $process_cache;
+ return $_process_cache;
}
# BMO - Instrumentation