From 0c28b414af5e683e4033a77c67cb2fef4ad6c9a5 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 22 May 2007 16:38:18 +0000 Subject: [PATCH] *Just to be safe, avoid query when IN() is empty --- maintenance/rebuildrecentchanges.inc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/maintenance/rebuildrecentchanges.inc b/maintenance/rebuildrecentchanges.inc index 5ec27aa4c7..e00c191467 100644 --- a/maintenance/rebuildrecentchanges.inc +++ b/maintenance/rebuildrecentchanges.inc @@ -124,10 +124,12 @@ function rebuildRecentChangesTablePass3() $botusers[] = $obj->rc_user; } # Fill in the rc_bot field - $botwhere = implode(',',$botusers); - $sql2 = "UPDATE $recentchanges SET rc_bot=1 " . - "WHERE rc_user IN($botwhere)"; - $dbw->query( $sql2 ); + if( !empty($botusers) ) { + $botwhere = implode(',',$botusers); + $sql2 = "UPDATE $recentchanges SET rc_bot=1 " . + "WHERE rc_user IN($botwhere)"; + $dbw->query( $sql2 ); + } } # Flag our recent autopatrolled edits if( !empty($autopatrolgroups) ) { @@ -147,10 +149,12 @@ function rebuildRecentChangesTablePass3() } # Fill in the rc_patrolled field - $patrolwhere = implode(',',$patrolusers); - $sql2 = "UPDATE $recentchanges SET rc_patrolled=1 " . - "WHERE rc_user IN($patrolwhere)"; - $dbw->query( $sql2 ); + if( !empty($patrolusers) ) { + $patrolwhere = implode(',',$patrolusers); + $sql2 = "UPDATE $recentchanges SET rc_patrolled=1 " . + "WHERE rc_user IN($patrolwhere)"; + $dbw->query( $sql2 ); + } } $dbw->freeResult( $res ); -- 2.20.1