From: vladd%bugzilla.org <> Date: Sun, 18 Jun 2006 23:54:50 +0000 (+0000) Subject: Patch for bug 341374: fix checksetup failure when database exists with non-Bugzilla... X-Git-Tag: bugzilla-2.22.1~96 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bbc3888acf812aa9ed004d885d91a1add7d1d7c;p=thirdparty%2Fbugzilla.git Patch for bug 341374: fix checksetup failure when database exists with non-Bugzilla table; patch by Olav Vitters , r=mkanat, a=justdave. --- diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index e03fbc9101..a296279e58 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -273,7 +273,7 @@ sub bz_setup_database { # http://bugs.mysql.com/bug.php?id=13535 # This is a workaround, a dummy SELECT to reset the LAST_INSERT_ID. my @tables = $self->bz_table_list_real(); - if (lsearch(\@tables, 'bugs') != -1 + if (grep($_ eq 'bugs', @tables) && $self->bz_column_info_real("bugs", "bug_id")) { $self->do('SELECT 1 FROM bugs WHERE bug_id IS NULL'); @@ -294,9 +294,9 @@ sub bz_setup_database { # has existed at least since Bugzilla 2.8, and probably earlier. # For fixing the inconsistent naming of Schema indexes, # we also check for one of those inconsistently-named indexes. - if ( scalar(@tables) && - ($self->bz_index_info_real('bugs', 'assigned_to') || - $self->bz_index_info_real('flags', 'flags_bidattid_idx')) ) + if (grep($_ eq 'bugs', @tables) + && ($self->bz_index_info_real('bugs', 'assigned_to') + || $self->bz_index_info_real('flags', 'flags_bidattid_idx')) ) { # This is a check unrelated to the indexes, to see if people are