From c7c0a6fad30ee2747a2548ecb3b615017e5d8144 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 12 Jun 2004 03:15:00 +0000 Subject: [PATCH] Don't delete/recreate the table if it's empty but up to date in schema. --- maintenance/convertLinks.inc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/maintenance/convertLinks.inc b/maintenance/convertLinks.inc index f56a771f96..c9b7fb54cb 100644 --- a/maintenance/convertLinks.inc +++ b/maintenance/convertLinks.inc @@ -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 -- 2.20.1