From 666306c95359c8e0f08d19b0bdc5de4aa0e6c463 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 11 Aug 2004 09:02:20 +0000 Subject: [PATCH] Fix some of the rebuild scripts --- maintenance/rebuildall.php | 22 ++++++++++++---------- maintenance/rebuildrecentchanges.inc | 6 +++--- maintenance/refreshLinks.inc | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/maintenance/rebuildall.php b/maintenance/rebuildall.php index d9ec307c06..670f560953 100644 --- a/maintenance/rebuildall.php +++ b/maintenance/rebuildall.php @@ -10,21 +10,23 @@ require_once( "refreshlinks.inc" ); require_once( "rebuildtextindex.inc" ); require_once( "rebuildrecentchanges.inc" ); -$wgDBuser = $wgDBadminuser; -$wgDBpassword = $wgDBadminpassword; +$database = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname ); + +print "** Rebuilding fulltext search index (if you abort this will break searching; run this script again to fix):\n"; +dropTextIndex( $database ); +rebuildTextIndex( $database ); +createTextIndex( $database ); + +print "\n\n** Rebuilding recentchanges table:\n"; +rebuildRecentChangesTablePass1(); +rebuildRecentChangesTablePass2(); # Doesn't work anymore # rebuildLinkTables(); # Use the slow incomplete one instead. It's designed to work in the background -#refreshLinks( 1 ); - -dropTextIndex(); -rebuildTextIndex(); -createTextIndex(); - -rebuildRecentChangesTablePass1(); -rebuildRecentChangesTablePass2(); +print "\n\n** Rebuilding links tables -- this can take a long time. It should be safe to about via ctrl+C if you get bored.\n"; +refreshLinks( 1 ); print "Done.\n"; exit(); diff --git a/maintenance/rebuildrecentchanges.inc b/maintenance/rebuildrecentchanges.inc index f4d739e66e..8d10f56f51 100644 --- a/maintenance/rebuildrecentchanges.inc +++ b/maintenance/rebuildrecentchanges.inc @@ -7,7 +7,7 @@ function rebuildRecentChangesTablePass1() { $fname = 'rebuildRecentChangesTablePass1'; $dbw =& wfGetDB( DB_MASTER ); - extract( $dbw->tableNames( 'recentchanges', 'cur', 'old' ); + extract( $dbw->tableNames( 'recentchanges', 'cur', 'old' ) ); $dbw->delete( 'recentchanges', '*' ); @@ -29,7 +29,7 @@ function rebuildRecentChangesTablePass1() 'rc_this_oldid' => 0, 'rc_last_oldid' => 0, 'rc_type' => 'IF(cur_is_new,' . RC_NEW . ',' . RC_EDIT . ')' - ), '*', $fname, array( 'ORDER BY' => 'inverse_timestamp', 'LIMIT' => 5000 + ), '*', $fname, array( 'ORDER BY' => 'inverse_timestamp', 'LIMIT' => 5000 ) ); print( "Loading from OLD table...\n" ); @@ -56,7 +56,7 @@ function rebuildRecentChangesTablePass1() function rebuildRecentChangesTablePass2() { $dbw =& wfGetDB( DB_MASTER ); - extract( $dbw->tableNames( 'recentchanges', 'cur', 'old' ); + extract( $dbw->tableNames( 'recentchanges', 'cur', 'old' ) ); $ns = $id = $count = 0; $title = $ct = ""; diff --git a/maintenance/refreshLinks.inc b/maintenance/refreshLinks.inc index 5a18a166a8..2261803f8e 100644 --- a/maintenance/refreshLinks.inc +++ b/maintenance/refreshLinks.inc @@ -8,7 +8,7 @@ function refreshLinks( $start ) { $dbw =& wfGetDB( DB_MASTER ); - $end = $dbw->selectField( 'cur_id', 'max(cur_id)', false ); + $end = $dbw->selectField( 'cur', 'max(cur_id)', false ); print("Refreshing link table. Starting from cur_id $start of $end.\n"); -- 2.20.1