Closed Bug 307688 Opened 20 years ago Closed 14 years ago

Move the OS and platform detection routines out of enter_bug.cgi

Categories

(Bugzilla :: Creating/Changing Bugs, enhancement)

2.21
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: LpSolit, Assigned: glob)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 3 obsolete files)

pickplatform and pickos should really be in their own .pm module instead of being in enter_bug.cgi.
Blocks: 360650
Depends on: 449161
Attached patch patch v1 (obsolete) — Splinter Review
this extracts the user agent detection methods out of enter_bug into their own module. i also refactored it to make it sane.
Assignee: create-and-change → glob
Status: NEW → ASSIGNED
Attachment #547404 - Flags: review?(LpSolit)
Blocks: 449161, 672191
No longer blocks: 360650
No longer depends on: 449161
Attached patch patch v2 (obsolete) — Splinter Review
this revision uses List::MoreUtils instead of Tie::IxHash to avoid introducing a new dependency.
Attachment #547404 - Attachment is obsolete: true
Attachment #547425 - Flags: review?(LpSolit)
Attachment #547404 - Flags: review?(LpSolit)
Comment on attachment 547425 [details] [diff] [review] patch v2 oops; this patch has a copy+paste problem.
Attachment #547425 - Attachment is obsolete: true
Attachment #547425 - Flags: review?(LpSolit)
Attached patch patch v3 (obsolete) — Splinter Review
Attachment #547427 - Flags: review?(LpSolit)
Comment on attachment 547427 [details] [diff] [review] patch v3 Review of attachment 547427 [details] [diff] [review]: ----------------------------------------------------------------- Thank you so much for doing this; this is a huge improvement. ::: Bugzilla/UserAgent.pm @@ +27,5 @@ > + > +package Bugzilla::UserAgent; > + > +use strict; > +use base 'Exporter'; It'd be nice to do qw(Exporter) for consistency with other modules. @@ +28,5 @@ > +package Bugzilla::UserAgent; > + > +use strict; > +use base 'Exporter'; > +@Bugzilla::UserAgent::EXPORT = qw(detect_platform detect_op_sys); That should be "our @EXPORT" @@ +32,5 @@ > +@Bugzilla::UserAgent::EXPORT = qw(detect_platform detect_op_sys); > + > +use List::MoreUtils qw(natatime); > + > +# Using Tie::IxHash to keep the keys in order I actually don't see a Tie::IxHash usage here. @@ +33,5 @@ > + > +use List::MoreUtils qw(natatime); > + > +# Using Tie::IxHash to keep the keys in order > +my @platforms_map = ( You can't use "my" on a package level in mod_perl; the variable will disappear. (You have to use "our.") Anyhow, shouldn't this be a constant? @@ +203,5 @@ > + my $dbh = Bugzilla->dbh; > + foreach my $value (@values) { > + return $value if $dbh->selectrow_array( > + "SELECT 1 FROM $field WHERE value = ?", undef, $value); > + } I think you're going to be better off, performance-wise, doing Bugzilla->fields and asking for legal_values (which will probably get pulled in at some point anyway, and so saves us extra DB trips). @@ +204,5 @@ > + foreach my $value (@values) { > + return $value if $dbh->selectrow_array( > + "SELECT 1 FROM $field WHERE value = ?", undef, $value); > + } > + return 'Other'; That should be a constant.
Attachment #547427 - Flags: review?(LpSolit) → review-
Attached patch patch v4Splinter Review
Attachment #547427 - Attachment is obsolete: true
Attachment #547621 - Flags: review?(mkanat)
Comment on attachment 547621 [details] [diff] [review] patch v4 Review of attachment 547621 [details] [diff] [review]: ----------------------------------------------------------------- This is so awesome. :-) ::: Bugzilla/UserAgent.pm @@ +22,5 @@ > +# Joe Robins <jmrobins@tgix.com> > +# Gervase Markham <gerv@gerv.net> > +# Shane H. W. Travis <travis@sedsystems.ca> > +# Nitish Bezzala <nbezzala@yahoo.com> > +# Byron Jones <glob@mozilla.com> timeless actually wrote quite a bit of this code; he should probably be credited.
Attachment #547621 - Flags: review?(mkanat) → review+
Flags: approval?
Target Milestone: --- → Bugzilla 5.0
(In reply to comment #7) > timeless actually wrote quite a bit of this code; he should probably be > credited. agreed, however timeless hasn't been credited in any file in bugzilla, so i suspect he's made a conscious decision to be excluded. of course i'm happy to include him if he desires.
Flags: approval? → approval+
Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bugzilla/trunk/ modified enter_bug.cgi added Bugzilla/UserAgent.pm Committed revision 7901.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Blocks: 706443
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: