new link rebuilder, capable of operating in the background
authorTim Starling <tstarling@users.mediawiki.org>
Mon, 23 Feb 2004 07:43:20 +0000 (07:43 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Mon, 23 Feb 2004 07:43:20 +0000 (07:43 +0000)
maintenance/refreshLinks.php [new file with mode: 0644]

diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php
new file mode 100644 (file)
index 0000000..6fdae4c
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+define( "REPORTING_INTERVAL", 500 );
+
+include_once( "commandLine.inc" );
+
+if ($argv[2]) {
+       $start = (int)$argv[2];
+} else {
+       $start = 1;
+}
+
+$res = wfQuery("SELECT max(cur_id) as m FROM cur", DB_READ);
+$row = wfFetchObject( $res );
+$end = $row->m;
+
+print("Refreshing link table. Starting from cur_id $start of $end.\n");
+
+for ($id = start; $id <= $end; $id++) {
+       if ( !($id % REPORTING_INTERVAL) ) {
+               print $id;
+       }
+       
+       $wgTitle = Title::newFromID( $id );
+       if ( $wgTitle == NULL ) {
+               continue;
+       }
+       
+       $wgLinkCache = new LinkCache;
+       $wgArticle = new Article( $wgTitle );
+       $text = $wgArticle->getContent( true );
+       $wgOut->addWikiText( $text );
+       
+       $linksUpdate = new LinksUpdate( $id, $wgTitle );
+       $linksUpdate->doDumbUpdate();
+}
+
+
+exit();
+
+?>