Don't die with an SQL syntax error when there are no pages in the wiki.
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 3 Oct 2008 21:16:35 +0000 (21:16 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 3 Oct 2008 21:16:35 +0000 (21:16 +0000)
MySQL returned error "1064: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND 99 AND page_restrictions !='' AND page_restrictions !='edit (10.0.0.101)"

maintenance/updateRestrictions.php

index c2d256e..fd4c271 100644 (file)
@@ -25,6 +25,11 @@ function migrate_page_restrictions( $db ) {
        
        $start = $db->selectField( 'page', 'MIN(page_id)', false, __FUNCTION__ );
        $end = $db->selectField( 'page', 'MAX(page_id)', false, __FUNCTION__ );
+       
+       if( !$start ) {
+               die("Nothing to do.\n");
+       }
+       
        # Do remaining chunk
        $end += BATCH_SIZE - 1;
        $blockStart = $start;