Don't delete/recreate the table if it's empty but up to date in schema.
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 12 Jun 2004 03:15:00 +0000 (03:15 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 12 Jun 2004 03:15:00 +0000 (03:15 +0000)
maintenance/convertLinks.inc

index f56a771..c9b7fb5 100644 (file)
@@ -31,20 +31,21 @@ function convertLinks() {
        $perfLogFilename = "convLinksPerf.txt";
        #--------------------------------------------------------------------
 
+       $res = wfQuery( "SELECT l_from FROM links LIMIT 1", DB_READ );
+       if ( mysql_field_type( $res, 0 ) == "int" ) {
+               print "Schema already converted\n";
+               return;
+       }
+       
        $res = wfQuery( "SELECT COUNT(*) AS count FROM links", DB_WRITE );
        $row = wfFetchObject($res);
        $numRows = $row->count;
        wfFreeResult( $res );
 
        if ( $numRows == 0 ) {
-               print "No rows to convert. Updating schema...\n";
+               print "Updating schema (no rows to convert)...\n";
                createTempTable();
        } else {
-               $res = wfQuery( "SELECT l_from FROM links LIMIT 1", DB_READ );
-               if ( mysql_field_type( $res, 0 ) == "int" ) {
-                       print "Schema already converted\n";
-                       return;
-               }               
                if ( $logPerformance ) { $fh = fopen ( $perfLogFilename, "w" ); }
                $baseTime = $startTime = getMicroTime();
                # Create a title -> cur_id map