Closed Bug 328602 Opened 19 years ago Closed 19 years ago

Eliminate %::versions and @::legal_versions

Categories

(Bugzilla :: Bugzilla-General, enhancement)

2.23
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.0

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

Attachments

(1 file, 2 obsolete files)

These two variables are related together in the creation of versioncache, so we're going to eliminate them together.
Attached patch v1 (obsolete) (deleted) β€” β€” Splinter Review
As you can see, this allowed a huge cleanup, particularly in query.cgi.

There were a few places where I also changed the use of %::components and %::milestones, because it was necessary to change the way the script worked.

I tested every single change, they all work.
Attachment #213203 - Flags: review?(LpSolit)
Comment on attachment 213203 [details] [diff] [review]
v1

>Index: buglist.cgi

You forgot to remove @versions from 'use vars'.



>Index: post_bug.cgi

>@@ -79,6 +79,7 @@
> # is allowed to enter bugs into this product.
> my $product = $cgi->param('product');
> $user->can_enter_product($product, 1);
>+my $prod_obj = new Bugzilla::Product({name => $product});
> 
> my $product_id = get_product_id($product);

Please write $product_id = $prod_obj->id. This avoid a useless SQL query.


>@@ -203,7 +204,8 @@
>-check_form_field($cgi, 'version',          $::versions{$product});
>+check_form_field($cgi, 'version',      
>+                 [map($_->name, @{$prod_obj->versions})]);

check_form_field() no longer exists. It has been replaced by check_field() and doesn't take a CGI object anymore.



>Index: process_bug.cgi

>-    check_form_field($cgi, 'version', \@{$::versions{$cgi->param('product')}});
>+    check_form_field($cgi, 'version', [map($_->name, @{$prod_obj->versions})]);

Same remark here.


Your patch *looks* good. I haven't tested it yet though, due to bitrot.
Attachment #213203 - Flags: review?(LpSolit) → review-
Attached patch v2 (obsolete) (deleted) β€” β€” Splinter Review
Good comments. :-) I fixed them all.
Attachment #213203 - Attachment is obsolete: true
Attachment #213551 - Flags: review?(LpSolit)
Comment on attachment 213551 [details] [diff] [review]
v2

I cannot correctly test your patch, because you forgot to fix Bug.pm:

line 25: %versions appears in 'use vars'

line 689: 'version' => $::versions{$self->{product}},


And you still forgot to remove %versions from 'use vars' in process_bug.cgi.

Same about $zz = @main::legal_versions; in globals.pl.
Attachment #213551 - Flags: review?(LpSolit) → review-
Attached patch v3 (deleted) β€” β€” Splinter Review
Ah, you are correct. Fixed and tested.
Attachment #213551 - Attachment is obsolete: true
Attachment #213636 - Flags: review?(LpSolit)
Status: NEW → ASSIGNED
Comment on attachment 213636 [details] [diff] [review]
v3

>Index: Bugzilla/Bug.pm

>+    $self->{prod_obj} ||= new Bugzilla::Product({name => $self->{product}});

>+       'version' => [map($_->name, @{$self->{prod_obj}->versions})],

Nit: personally, I prefer enclosing things in quotes, for instance $self->{'prod_obj'}.

r=LpSolit
Attachment #213636 - Flags: review?(LpSolit) → review+
Flags: approval?
Flags: approval? → approval+
Checking in buglist.cgi;
/cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v  <--  buglist.cgi
new revision: 1.326; previous revision: 1.325
done
Checking in config.cgi;
/cvsroot/mozilla/webtools/bugzilla/config.cgi,v  <--  config.cgi
new revision: 1.15; previous revision: 1.14
done
Checking in enter_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/enter_bug.cgi,v  <--  enter_bug.cgi
new revision: 1.129; previous revision: 1.128
done
Checking in globals.pl;
/cvsroot/mozilla/webtools/bugzilla/globals.pl,v  <--  globals.pl
new revision: 1.355; previous revision: 1.354
done
Checking in post_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/post_bug.cgi,v  <--  post_bug.cgi
new revision: 1.138; previous revision: 1.137
done
Checking in process_bug.cgi;
/cvsroot/mozilla/webtools/bugzilla/process_bug.cgi,v  <--  process_bug.cgi
new revision: 1.307; previous revision: 1.306
done
Checking in query.cgi;
/cvsroot/mozilla/webtools/bugzilla/query.cgi,v  <--  query.cgi
new revision: 1.156; previous revision: 1.155
done
Checking in Bugzilla/Bug.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v  <--  Bug.pm
new revision: 1.111; previous revision: 1.110
done
Checking in Bugzilla/Version.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Version.pm,v  <--  Version.pm
new revision: 1.8; previous revision: 1.7
done
Checking in template/en/default/search/form.html.tmpl;
/cvsroot/mozilla/webtools/bugzilla/template/en/default/search/form.html.tmpl,v <--  form.html.tmpl
new revision: 1.36; previous revision: 1.35
done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Blocks: 329177
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: