Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php |
— | — | @@ -471,21 +471,18 @@ |
472 | 472 | $page_namespace = $this->page_namespace; |
473 | 473 | $dbr = wfGetDB( DB_SLAVE ); |
474 | 474 | $catlinks = $dbr->tableName( 'categorylinks' ); |
| 475 | + |
| 476 | + $values = array(); |
475 | 477 | foreach ( $page_ids as $id => $pdbk ) { |
476 | 478 | // consider only link in page namespace |
477 | 479 | if ( preg_match( "/^$page_namespace:(.*?)$/", $pdbk ) ) { |
478 | 480 | $colours[$pdbk] = 'quality1'; |
479 | | - if ( !isset( $query ) ) { |
480 | | - $query = "SELECT cl_from, cl_to FROM $catlinks WHERE cl_from IN("; |
481 | | - } else { |
482 | | - $query .= ', '; |
483 | | - } |
484 | | - $query .= intval( $id ); |
| 481 | + $values[] = intval( $id ); |
485 | 482 | } |
486 | 483 | } |
487 | 484 | |
488 | | - if ( isset( $query ) ) { |
489 | | - $query .= ')'; |
| 485 | + if ( count( $values ) ) { |
| 486 | + $query .= "SELECT cl_from, cl_to FROM $catlinks WHERE cl_from IN(" . implode( ",", $values ) . ")"; |
490 | 487 | $res = $dbr->query( $query, __METHOD__ ); |
491 | 488 | |
492 | 489 | foreach ( $res as $x ) { |