r12873 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12872‎ | r12873 | r12874 >
Date:11:25, 26 January 2006
Author:timstarling
Status:old
Tags:
Comment:
Don't use tidy. Command line option to specify the end ID. Clear the link cache after each article to keep memory usage down.
Modified paths:
  • /trunk/phase3/maintenance/refreshLinks.inc (modified) (history)
  • /trunk/phase3/maintenance/refreshLinks.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/refreshLinks.inc
@@ -7,9 +7,10 @@
88
99 /** */
1010 define( "REPORTING_INTERVAL", 100 );
 11+#define( "REPORTING_INTERVAL", 1 );
1112
12 -function refreshLinks( $start, $newOnly = false, $maxLag = false ) {
13 - global $wgUser, $wgParser, $wgUseImageResize;
 13+function refreshLinks( $start, $newOnly = false, $maxLag = false, $end = 0 ) {
 14+ global $wgUser, $wgParser, $wgUseImageResize, $wgUseTidy;
1415
1516 $fname = 'refreshLinks';
1617 $dbr =& wfGetDB( DB_SLAVE );
@@ -24,6 +25,7 @@
2526
2627 # Don't generate thumbnail images
2728 $wgUseImageResize = false;
 29+ $wgUseTidy = false;
2830
2931 if ( $newOnly ) {
3032 print "Refreshing links from ";
@@ -48,7 +50,9 @@
4951 }
5052 } else {
5153 print "Refreshing link table.\n";
52 - $end = $dbr->selectField( 'page', 'max(page_id)', false );
 54+ if ( !$end ) {
 55+ $end = $dbr->selectField( 'page', 'max(page_id)', false );
 56+ }
5357 print("Starting from page_id $start of $end.\n");
5458
5559 for ($id = $start; $id <= $end; $id++) {
@@ -65,11 +69,14 @@
6670 }
6771
6872 function fixLinksFromArticle( $id ) {
69 - global $wgTitle, $wgArticle, $wgOut, $wgParser;
70 -
 73+ global $wgTitle, $wgArticle, $wgOut, $wgParser, $wgLinkCache;
 74+
7175 $wgTitle = Title::newFromID( $id );
7276 $dbw =& wfGetDB( DB_MASTER );
7377
 78+ $linkCache =& LinkCache::singleton();
 79+ $linkCache->clear();
 80+
7481 if ( is_null( $wgTitle ) ) {
7582 return;
7683 }
@@ -83,7 +90,7 @@
8491 $options = new ParserOptions;
8592 $parserOutput = $wgParser->parse( $revision->getText(), $wgTitle, $options, true, true, $revision->getId() );
8693 $update = new LinksUpdate( $wgTitle, $parserOutput );
87 - $update->doDumbUpdate();
 94+ $update->doUpdate();
8895 $dbw->immediateCommit();
8996 }
9097
Index: trunk/phase3/maintenance/refreshLinks.php
@@ -6,7 +6,7 @@
77 */
88
99 /** */
10 -$optionsWithArgs = array( 'm' );
 10+$optionsWithArgs = array( 'm', 'e' );
1111 require_once( "commandLine.inc" );
1212 require_once( "refreshLinks.inc" );
1313
@@ -19,8 +19,14 @@
2020 $start = 1;
2121 }
2222
23 - refreshLinks( $start, $options['new-only'], $options['m'] );
 23+ refreshLinks( $start, $options['new-only'], $options['m'], $options['e'] );
2424 }
25 -deleteLinksFromNonexistent();
 25+// this bit's bad for replication: disabling temporarily
 26+// --brion 2005-07-16
 27+//deleteLinksFromNonexistent();
2628
 29+if ( $options['globals'] ) {
 30+ print_r( $GLOBALS );
 31+}
 32+
2733 ?>

Status & tagging log