]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1319503 - Backport request_cache optimizations from upstream
authorDylan William Hardison <dylan@hardison.net>
Wed, 23 Nov 2016 16:41:44 +0000 (11:41 -0500)
committerDylan William Hardison <dylan@hardison.net>
Thu, 1 Dec 2016 15:18:58 +0000 (10:18 -0500)
Bugzilla.pm
Bugzilla/Install/Util.pm

index 72192d41a13a280b539e2b9c7224c55af9a98b4e..f563ba9e37f65dfedd2bb4f10b6bb697e58c5c9d 100644 (file)
@@ -731,30 +731,10 @@ sub audit {
 # 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;
-}
+use constant request_cache => Bugzilla::Install::Util::_cache();
 
 sub clear_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)};
-        }
-    }
+    %{ request_cache() } = ();
 }
 
 # This is a per-process cache.  Under mod_cgi it's identical to the
index 231ef8efc7138a9145acedd17434d2244e05de49..c65c0e061f8eb79ffa451d813e587a25216b3b7b 100644 (file)
@@ -699,15 +699,7 @@ sub prevent_windows_dialog_boxes {
 
 # This is like request_cache, but it's used only by installation code
 # for checksetup.pl and things like that.
-our $_cache = {};
-sub _cache {
-    # If the normal request_cache is available (which happens any time
-    # after the requirements phase) then we should use that.
-    if (eval { Bugzilla->request_cache; }) {
-        return Bugzilla->request_cache;
-    }
-    return $_cache;
-}
+use constant _cache => {};
 
 ###############################
 # Copied from Bugzilla::Util #