Closed Bug 342114 Opened 14 years ago Closed 14 years ago

Bugzilla.pm caches data in global variables

Categories

(Bugzilla :: Bugzilla-General, defect)

2.23
defect
Not set

Tracking

()

RESOLVED FIXED
Bugzilla 3.0

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

Attachments

(1 file, 2 obsolete files)

Right now Bugzilla.pm stores a lot of data in variables like "my $_cgi" and "my $_dbh". Under mod_perl, this will fail miserably.

Basically, what we need is a way to cache something just for the current request.

Since Bugzilla has to work in mod_perl and outside of mod_perl, we need a way to do this both inside of mod_perl and outside of mod_perl.

Basically, I'm thinking that we'll have a request_cache() function inside of Bugzilla.pm, that will return the correct type of per-request cache depending on whether we're in mod_perl or not.
Attached patch Create Bugzilla->request_cache (obsolete) — Splinter Review
Okay, here it is. Basically, at this point this consolidates all of the global variables into *one* global variable.

Why does this matter, you ask?

Basically, now, when mod_perl support hits, we can just add mod_perl support to Bugzilla->request_cache, and it will use some clever mod_perl stuff instead of the "our $_request_cache" that's in Bugzilla.pm.

We can't actually write that code yet since we don't actually have mod_perl support yet, and I think it'd be pretty silly to try to work these things out before I even have a single page working under mod_perl.
Attachment #226293 - Flags: review?(LpSolit)
Blocks: 173629
Attached patch v2 (obsolete) — Splinter Review
Okay, this version actually works under mod_perl.
Attachment #226293 - Attachment is obsolete: true
Attachment #226450 - Flags: review?(LpSolit)
Attachment #226293 - Flags: review?(LpSolit)
Attached patch v2.1Splinter Review
I had left my die_with_dignity code in the previous patch.
Attachment #226450 - Attachment is obsolete: true
Attachment #226451 - Flags: review?
Attachment #226450 - Flags: review?(LpSolit)
Attachment #226451 - Flags: review? → review?(LpSolit)
Comment on attachment 226451 [details] [diff] [review]
v2.1

> sub _cleanup {
>
>+    undef $_request_cache;
> }

It's intentional that you only do it for $_request_cache, i.e when not using mod_perl, right? I cannot test the mod_perl part of the patch, but what I see matches what the docs say. so r=LpSolit
Attachment #226451 - Flags: review?(LpSolit) → review+
Status: NEW → ASSIGNED
Flags: approval?
(In reply to comment #4)
> It's intentional that you only do it for $_request_cache, i.e when not using
> mod_perl, right?

  Right. The END block won't get run correctly under mod_perl anyway, because it lives in a module (as I understand it). And the request object is automatically destroyed at the end of every request, meaning that all our variables are automatically cleaned up there.
Flags: approval? → approval+
Checking in Bugzilla.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla.pm,v  <--  Bugzilla.pm
new revision: 1.38; previous revision: 1.37
done
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Keywords: relnote
Added to the release notes on bug 255155.
Keywords: relnote
The correct bug number for those release notes is actually bug 349423.
You need to log in before you can comment on or make changes to this bug.