summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-02-04 20:29:26 +0100
committerlpsolit%gmail.com <>2008-02-04 20:29:26 +0100
commit24c32fe3d8141ac056c6350ae148cfc30ddadfea (patch)
tree9b887cc8d182260e2a25b541bfd7b4fed8da1c00
parenta9053d2b041eb08f939711005c53b66f9610f9bc (diff)
downloadbugzilla-24c32fe3d8141ac056c6350ae148cfc30ddadfea.tar.gz
bugzilla-24c32fe3d8141ac056c6350ae148cfc30ddadfea.tar.xz
Bug 415155: Remove $cgi from the list of arguments when calling Bugzilla::Flag subroutines - Patch by Frédéric Buclin <LpSolit@gmail.com> a=LpSolit
-rw-r--r--Bugzilla/Attachment.pm6
-rw-r--r--Bugzilla/Flag.pm22
-rwxr-xr-xattachment.cgi4
-rwxr-xr-xpost_bug.cgi4
-rwxr-xr-xprocess_bug.cgi4
5 files changed, 20 insertions, 20 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm
index b4ac9e6f0..314227c87 100644
--- a/Bugzilla/Attachment.pm
+++ b/Bugzilla/Attachment.pm
@@ -890,7 +890,7 @@ sub insert_attachment_for_bug {
foreach my $obsolete_attachment (@obsolete_attachments) {
# If the obsolete attachment has request flags, cancel them.
# This call must be done before updating the 'attachments' table.
- Bugzilla::Flag::CancelRequests($bug, $obsolete_attachment, $timestamp);
+ Bugzilla::Flag->CancelRequests($bug, $obsolete_attachment, $timestamp);
$dbh->do('UPDATE attachments SET isobsolete = 1, modification_time = ?
WHERE attach_id = ?',
@@ -917,8 +917,8 @@ sub insert_attachment_for_bug {
my $error_mode_cache = Bugzilla->error_mode;
Bugzilla->error_mode(ERROR_MODE_DIE);
eval {
- Bugzilla::Flag::validate($cgi, $bug->bug_id, -1, SKIP_REQUESTEE_ON_ERROR);
- Bugzilla::Flag->process($bug, $attachment, $timestamp, $cgi, $hr_vars);
+ Bugzilla::Flag::validate($bug->bug_id, -1, SKIP_REQUESTEE_ON_ERROR);
+ Bugzilla::Flag->process($bug, $attachment, $timestamp, $hr_vars);
};
Bugzilla->error_mode($error_mode_cache);
if ($@) {
diff --git a/Bugzilla/Flag.pm b/Bugzilla/Flag.pm
index dc298634d..1fc2a6827 100644
--- a/Bugzilla/Flag.pm
+++ b/Bugzilla/Flag.pm
@@ -246,7 +246,7 @@ sub count {
=over
-=item C<validate($cgi, $bug_id, $attach_id, $skip_requestee_on_error)>
+=item C<validate($bug_id, $attach_id, $skip_requestee_on_error)>
Validates fields containing flag modifications.
@@ -258,8 +258,8 @@ to -1 to force its check anyway.
=cut
sub validate {
- my ($cgi, $bug_id, $attach_id, $skip_requestee_on_error) = @_;
-
+ my ($bug_id, $attach_id, $skip_requestee_on_error) = @_;
+ my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
# Get a list of flags to validate. Uses the "map" function
@@ -501,22 +501,22 @@ sub snapshot {
=over
-=item C<process($bug, $attachment, $timestamp, $cgi, $hr_vars)>
+=item C<process($bug, $attachment, $timestamp, $hr_vars)>
Processes changes to flags.
The bug and/or the attachment objects are the ones this flag is about,
the timestamp is the date/time the bug was last touched (so that changes
-to the flag can be stamped with the same date/time), the cgi is the CGI
-object used to obtain the flag fields that the user submitted.
+to the flag can be stamped with the same date/time).
=back
=cut
sub process {
- my ($class, $bug, $attachment, $timestamp, $cgi, $hr_vars) = @_;
+ my ($class, $bug, $attachment, $timestamp, $hr_vars) = @_;
my $dbh = Bugzilla->dbh;
+ my $cgi = Bugzilla->cgi;
# Make sure the bug (and attachment, if given) exists and is accessible
# to the current user. Moreover, if an attachment object is passed,
@@ -535,7 +535,7 @@ sub process {
# Cancel pending requests if we are obsoleting an attachment.
if ($attachment && $cgi->param('isobsolete')) {
- CancelRequests($bug, $attachment);
+ $class->CancelRequests($bug, $attachment);
}
# Create new flags and update existing flags.
@@ -1094,7 +1094,7 @@ sub notify {
# Cancel all request flags from the attachment being obsoleted.
sub CancelRequests {
- my ($bug, $attachment, $timestamp) = @_;
+ my ($class, $bug, $attachment, $timestamp) = @_;
my $dbh = Bugzilla->dbh;
my $request_ids =
@@ -1109,7 +1109,7 @@ sub CancelRequests {
return if (!scalar(@$request_ids));
# Take a snapshot of flags before any changes.
- my @old_summaries = __PACKAGE__->snapshot($bug->bug_id, $attachment->id)
+ my @old_summaries = $class->snapshot($bug->bug_id, $attachment->id)
if ($timestamp);
my $flags = Bugzilla::Flag->new_from_list($request_ids);
foreach my $flag (@$flags) { clear($flag, $bug, $attachment) }
@@ -1118,7 +1118,7 @@ sub CancelRequests {
return unless ($timestamp);
# Take a snapshot of flags after any changes.
- my @new_summaries = __PACKAGE__->snapshot($bug->bug_id, $attachment->id);
+ my @new_summaries = $class->snapshot($bug->bug_id, $attachment->id);
update_activity($bug->bug_id, $attachment->id, $timestamp,
\@old_summaries, \@new_summaries);
}
diff --git a/attachment.cgi b/attachment.cgi
index 449abde65..bc5b2ac75 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -508,7 +508,7 @@ sub update {
Bugzilla::User::match_field($cgi, {
'^requestee(_type)?-(\d+)$' => { 'type' => 'multi' }
});
- Bugzilla::Flag::validate($cgi, $bug->id, $attachment->id);
+ Bugzilla::Flag::validate($bug->id, $attachment->id);
# Start a transaction in preparation for updating the attachment.
$dbh->bz_start_transaction();
@@ -529,7 +529,7 @@ sub update {
# to attachments so that we can delete pending requests if the user
# is obsoleting this attachment without deleting any requests
# the user submits at the same time.
- Bugzilla::Flag->process($bug, $attachment, $timestamp, $cgi, $vars);
+ Bugzilla::Flag->process($bug, $attachment, $timestamp, $vars);
# Update the attachment record in the database.
$dbh->do("UPDATE attachments
diff --git a/post_bug.cgi b/post_bug.cgi
index 89edca2f4..988a1dedf 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -229,8 +229,8 @@ if (defined($cgi->upload('data')) || $cgi->param('attachurl')) {
my $error_mode_cache = Bugzilla->error_mode;
Bugzilla->error_mode(ERROR_MODE_DIE);
eval {
- Bugzilla::Flag::validate($cgi, $id, undef, SKIP_REQUESTEE_ON_ERROR);
- Bugzilla::Flag->process($bug, undef, $timestamp, $cgi, $vars);
+ Bugzilla::Flag::validate($id, undef, SKIP_REQUESTEE_ON_ERROR);
+ Bugzilla::Flag->process($bug, undef, $timestamp, $vars);
};
Bugzilla->error_mode($error_mode_cache);
if ($@) {
diff --git a/process_bug.cgi b/process_bug.cgi
index 7c5902e73..0e081b407 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -162,7 +162,7 @@ if (defined $cgi->param('dontchange')) {
# Validate flags in all cases. validate() should not detect any
# reference to flags if $cgi->param('id') is undefined.
-Bugzilla::Flag::validate($cgi, $cgi->param('id'));
+Bugzilla::Flag::validate($cgi->param('id'));
######################################################################
# End Data/Security Validation
@@ -550,7 +550,7 @@ foreach my $bug (@bug_objects) {
}
# Set and update flags.
- Bugzilla::Flag->process($bug, undef, $timestamp, $cgi, $vars);
+ Bugzilla::Flag->process($bug, undef, $timestamp, $vars);
$dbh->bz_commit_transaction();