From 640ec1663b430fa616c2d5af14edbd6dafb85a89 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Mon, 15 Aug 2011 20:38:08 +0800 Subject: Bug 678959: Make GenerateUniqueToken work for all tables r=LpSolit, a=LpSolit --- Bugzilla/Token.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm index 69751e905..c339c5984 100644 --- a/Bugzilla/Token.pm +++ b/Bugzilla/Token.pm @@ -245,7 +245,7 @@ sub GenerateUniqueToken { $column ||= "token"; my $dbh = Bugzilla->dbh; - my $sth = $dbh->prepare("SELECT userid FROM $table WHERE $column = ?"); + my $sth = $dbh->prepare("SELECT 1 FROM $table WHERE $column = ?"); while ($duplicate) { ++$tries; -- cgit v1.2.3-24-g4f1b From a14cd9ea38a1fefe3b4d586ea33920fd40ee4f65 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Tue, 16 Aug 2011 03:15:05 +0200 Subject: Bug 582209: Bugzilla::DB::Oracle::adjust_statement() LIMIT code corrupts sub-selects r/a=mkanat --- Bugzilla/DB/Oracle.pm | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm index 9fdacf24c..f444129e1 100644 --- a/Bugzilla/DB/Oracle.pm +++ b/Bugzilla/DB/Oracle.pm @@ -379,20 +379,17 @@ sub adjust_statement { if ($new_sql !~ /\bWHERE\b/) { $new_sql = $new_sql." WHERE 1=1"; } - my ($before_where, $after_where) = split /\bWHERE\b/i,$new_sql; - if (defined($offset)) { - if ($new_sql =~ /(.*\s+)FROM(\s+.*)/i) { - my ($before_from,$after_from) = ($1,$2); - $before_where = "$before_from FROM ($before_from," - . " ROW_NUMBER() OVER (ORDER BY 1) R " - . " FROM $after_from ) "; - $after_where = " R BETWEEN $offset+1 AND $limit+$offset"; - } - } else { - $after_where = " rownum <=$limit AND ".$after_where; - } - - $new_sql = $before_where." WHERE ".$after_where; + my ($before_where, $after_where) = split(/\bWHERE\b/i, $new_sql, 2); + if (defined($offset)) { + my ($before_from, $after_from) = split(/\bFROM\b/i, $new_sql, 2); + $before_where = "$before_from FROM ($before_from," + . " ROW_NUMBER() OVER (ORDER BY 1) R " + . " FROM $after_from ) "; + $after_where = " R BETWEEN $offset+1 AND $limit+$offset"; + } else { + $after_where = " rownum <=$limit AND ".$after_where; + } + $new_sql = $before_where." WHERE ".$after_where; } return $new_sql; } -- cgit v1.2.3-24-g4f1b From f89f20583287fd49e54f4e0818f2d7ea46b58034 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Tue, 16 Aug 2011 03:32:06 +0200 Subject: Bug 654496: Duplicate bug detection doesn't work when using Oracle r/a=mkanat --- Bugzilla/Bug.pm | 4 ++-- Bugzilla/DB/Oracle.pm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 40bf3af2e..c9ccf541d 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -554,8 +554,8 @@ sub possible_duplicates { FROM bugs INNER JOIN bugs_fulltext ON bugs.bug_id = bugs_fulltext.bug_id WHERE ($where_sql) $product_sql - ORDER BY relevance DESC, bug_id DESC - LIMIT $sql_limit", {Slice=>{}}); + ORDER BY relevance DESC, bug_id DESC " . + $dbh->sql_limit($sql_limit), {Slice=>{}}); my @actual_dupe_ids; # Resolve duplicates into their ultimate target duplicates. diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm index f444129e1..d91eb428e 100644 --- a/Bugzilla/DB/Oracle.pm +++ b/Bugzilla/DB/Oracle.pm @@ -177,7 +177,7 @@ sub sql_fulltext_search { my ($self, $column, $text, $label) = @_; $text = $self->quote($text); trick_taint($text); - return "CONTAINS($column,$text,$label)", "SCORE($label)"; + return "CONTAINS($column,$text,$label) > 0", "SCORE($label)"; } sub sql_date_format { -- cgit v1.2.3-24-g4f1b From 32ca131f3518873f80690b8bf51b32337c422927 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Tue, 16 Aug 2011 03:44:09 +0200 Subject: Bug 678772: version.pm 0.92 and newer forbids negative values, making checksetup.pl to fail r/a=mkanat --- Bugzilla/Install/Requirements.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm index 8825eb3a7..ef4bf3d22 100644 --- a/Bugzilla/Install/Requirements.pm +++ b/Bugzilla/Install/Requirements.pm @@ -717,8 +717,9 @@ sub _checking_for { # show "ok" or "not found". if (exists $params->{found}) { my $found_string; - # We do a string compare in case it's non-numeric. - if ($found and $found eq "-1") { + # We do a string compare in case it's non-numeric. We make sure + # it's not a version object as negative versions are forbidden. + if ($found && !ref($found) && $found eq '-1') { $found_string = install_string('module_not_found'); } elsif ($found) { -- cgit v1.2.3-24-g4f1b From 8713e6f943fe4bb02972199405ab504f4f3b903d Mon Sep 17 00:00:00 2001 From: Tiago Mello Date: Tue, 16 Aug 2011 19:05:53 -0300 Subject: Bug 672947: Add 'require Bugzilla::BugMail' in Bugzilla::Bug->_send_bugmail and remove unnecessary module imports in process_bug.cgi. r/a=LpSolit --- Bugzilla/Bug.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Bugzilla') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index c9ccf541d..6fdab3645 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1217,6 +1217,8 @@ sub send_changes { sub _send_bugmail { my ($params, $vars) = @_; + require Bugzilla::BugMail; + my $results = Bugzilla::BugMail::Send($params->{'id'}, $params->{'forced'}, $params); -- cgit v1.2.3-24-g4f1b From a19a89b719051f356cf16060b35be9bc9aa6cb01 Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Tue, 16 Aug 2011 17:42:54 -0700 Subject: Bug 655472: Print out localconfig as UTF-8 so we don't mangle UTF-8 comments. r=LpSolit, a=LpSolit --- Bugzilla/Install/Localconfig.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Install/Localconfig.pm b/Bugzilla/Install/Localconfig.pm index 3ce12207e..1ee7aca67 100644 --- a/Bugzilla/Install/Localconfig.pm +++ b/Bugzilla/Install/Localconfig.pm @@ -245,7 +245,8 @@ sub update_localconfig { # Move any custom or old variables into a separate file. if (scalar @old_vars) { my $filename_old = "$filename.old"; - open(my $old_file, ">>$filename_old") || die "$filename_old: $!"; + open(my $old_file, ">>:utf8", $filename_old) + or die "$filename_old: $!"; local $Data::Dumper::Purity = 1; foreach my $var (@old_vars) { print $old_file Data::Dumper->Dump([$localconfig->{$var}], @@ -259,7 +260,7 @@ sub update_localconfig { } # Re-write localconfig - open(my $fh, ">$filename") || die "$filename: $!"; + open(my $fh, ">:utf8", $filename) or die "$filename: $!"; foreach my $var (LOCALCONFIG_VARS) { my $name = $var->{name}; my $desc = install_string("localconfig_$name", { root => ROOT_USER }); -- cgit v1.2.3-24-g4f1b From dd7eacbef2571efe55e5b18d80e93837dc6619d1 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Wed, 17 Aug 2011 14:54:44 +0200 Subject: Bug 677522: IssueEmailChangeToken() should get the old login name from the user object r=timello a=LpSolit --- Bugzilla/Token.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm index c339c5984..86220aa29 100644 --- a/Bugzilla/Token.pm +++ b/Bugzilla/Token.pm @@ -92,8 +92,9 @@ sub issue_new_user_account_token { } sub IssueEmailChangeToken { - my ($user, $old_email, $new_email) = @_; + my ($user, $new_email) = @_; my $email_suffix = Bugzilla->params->{'emailsuffix'}; + my $old_email = $user->login; my ($token, $token_ts) = _create_token($user->id, 'emailold', $old_email . ":" . $new_email); @@ -447,7 +448,7 @@ Bugzilla::Token - Provides different routines to manage tokens. use Bugzilla::Token; Bugzilla::Token::issue_new_user_account_token($login_name); - Bugzilla::Token::IssueEmailChangeToken($user, $old_email, $new_email); + Bugzilla::Token::IssueEmailChangeToken($user, $new_email); Bugzilla::Token::IssuePasswordToken($user); Bugzilla::Token::DeletePasswordTokens($user_id, $reason); Bugzilla::Token::Cancel($token, $cancelaction, $vars); @@ -478,7 +479,7 @@ Bugzilla::Token - Provides different routines to manage tokens. Returns: Nothing. It throws an error if the same user made the same request in the last few minutes. -=item C +=item C Description: Sends two distinct tokens per email to the old and new email addresses to confirm the email address change for the given @@ -486,7 +487,6 @@ Bugzilla::Token - Provides different routines to manage tokens. Params: $user - User object of the user requesting a new email address. - $old_email - The current (old) email address of the user. $new_email - The new email address of the user. Returns: Nothing. -- cgit v1.2.3-24-g4f1b