Closed Bug 678970 Opened 14 years ago Closed 14 years ago

Use $user and $cgi instead of Bugzilla->user and Bugzilla->cgi

Categories

(Bugzilla :: Bugzilla-General, enhancement)

4.1.3
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: LpSolit, Assigned: LpSolit)

Details

Attachments

(1 file)

Attached patch patch, v1Splinter Review
This is part of a code cleanup process I started to remove very old code. Before Bugzilla 2.22, Bugzilla->login didn't return anything. Since 2.22, it returns the user object. As all *.cgi scripts call Bugzilla->login, we already have the current user object in hands. No need to call Bugzilla->user anymore within the whole script. I also fixed places which still uses Bugzilla->cgi instead of the already defined $cgi object.
Attachment #553155 - Flags: review?(timello)
Cool. Just to check, does any of this touch code that is inside of subroutines in .cgi files? Because "my $user" and "my $cgi" from outside of the subroutines can't be safely used inside of subroutines under mod_perl.
I checked them all one by one, don't worry. :)
(In reply to Frédéric Buclin from comment #2) > I checked them all one by one, don't worry. :) Okay, sounds good to me, then. :-)
Comment on attachment 553155 [details] [diff] [review] patch, v1 Review of attachment 553155 [details] [diff] [review]: ----------------------------------------------------------------- Bug.add_comment is also using Bugzilla->user instead of $user. Otherwise it looks right. ::: userprefs.cgi @@ +51,4 @@ > ($vars->{'realname'}) = $dbh->selectrow_array( > "SELECT realname FROM profiles WHERE userid = ?", undef, $user->id); > > + if (Bugzilla->params->{'allowemailchange'} && $user->authorizer->can_change_email) { This line is a bit long.
Attachment #553155 - Flags: review?(timello) → review+
Flags: approval?
(In reply to Tiago Mello [:timello] from comment #4) > Bug.add_comment is also using Bugzilla->user instead of $user. Nice catch, thanks! I will fix it on checkin.
Flags: approval? → approval+
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ modified buglist.cgi modified colchange.cgi modified config.cgi modified createaccount.cgi modified describekeywords.cgi modified editclassifications.cgi modified editvalues.cgi modified editwhines.cgi modified enter_bug.cgi modified process_bug.cgi modified query.cgi modified sanitycheck.cgi modified show_bug.cgi modified showdependencygraph.cgi modified summarize_time.cgi modified userprefs.cgi modified Bugzilla/WebService/Bug.pm Committed revision 7930.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: