This is a bit weired but... Don't throw a MySQL error if revision table is empty
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 17 Apr 2008 19:56:31 +0000 (19:56 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Thu, 17 Apr 2008 19:56:31 +0000 (19:56 +0000)
maintenance/populateParentId.php

index 4b73070..366c457 100644 (file)
@@ -22,6 +22,14 @@ function populate_rev_parent_id( $db ) {
        echo "Populating rev_parent_id column\n";
        $start = $db->selectField( 'revision', 'MIN(rev_id)', false, __FUNCTION__ );
        $end = $db->selectField( 'revision', 'MAX(rev_id)', false, __FUNCTION__ );
+       if( is_null( $start ) || is_null( $end ) ){
+               echo "...revision table seems to be empty.\n";
+               $db->insert( 'updatelog',
+                       array( 'ul_key' => 'populate rev_parent_id' ),
+                       __FUNCTION__,
+                       'IGNORE' );
+               return;
+       }
        # Do remaining chunk
        $end += BATCH_SIZE - 1;
        $blockStart = $start;