* (bug 5195) rebuildrecentchanges.php works again; Database::insertSelect now has...
[lhc/web/wiklou.git] / maintenance / refreshLinks.php
index c444ab0..e59124a 100644 (file)
@@ -1,43 +1,32 @@
 <?php
-define( "REPORTING_INTERVAL", 500 );
+/**
+ * @todo document
+ * @package MediaWiki
+ * @subpackage Maintenance
+ */
+
+/** */
+$optionsWithArgs = array( 'm', 'e' );
+require_once( "commandLine.inc" );
+require_once( "refreshLinks.inc" );
 
-include_once( "commandLine.inc" );
 error_reporting( E_ALL & (~E_NOTICE) );
 
+if ( !$options['dfn-only'] ) {
+       if ($args[0]) {
+               $start = (int)$args[0];
+       } else {
+               $start = 1;
+       }
 
-if ($argv[2]) {
-       $start = (int)$argv[2];
-} else {
-       $start = 1;
+       refreshLinks( $start, $options['new-only'], $options['m'], $options['e'] );
 }
+// this bit's bad for replication: disabling temporarily
+// --brion 2005-07-16
+//deleteLinksFromNonexistent();
 
-$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");
-
-$wgUser->setOption("math", 3);
-for ($id = $start; $id <= $end; $id++) {
-       if ( !($id % REPORTING_INTERVAL) ) {
-               print "$id\n";
-       }
-       
-       $wgTitle = Title::newFromID( $id );
-       if ( is_null( $wgTitle ) ) {
-               continue;
-       }
-       
-       $wgLinkCache = new LinkCache;
-       $wgArticle = new Article( $wgTitle );
-       $text = $wgArticle->getContent( true );
-       @$wgOut->addWikiText( $text );
-       
-       $linksUpdate = new LinksUpdate( $id, $wgTitle );
-       $linksUpdate->doDumbUpdate();
+if ( $options['globals'] ) {
+       print_r( $GLOBALS );
 }
 
-
-exit();
-
 ?>