| Index: trunk/phase3/maintenance/refreshLinks.inc |
| — | — | @@ -7,9 +7,10 @@ |
| 8 | 8 | |
| 9 | 9 | /** */ |
| 10 | 10 | define( "REPORTING_INTERVAL", 100 ); |
| | 11 | +#define( "REPORTING_INTERVAL", 1 ); |
| 11 | 12 | |
| 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; |
| 14 | 15 | |
| 15 | 16 | $fname = 'refreshLinks'; |
| 16 | 17 | $dbr =& wfGetDB( DB_SLAVE ); |
| — | — | @@ -24,6 +25,7 @@ |
| 25 | 26 | |
| 26 | 27 | # Don't generate thumbnail images |
| 27 | 28 | $wgUseImageResize = false; |
| | 29 | + $wgUseTidy = false; |
| 28 | 30 | |
| 29 | 31 | if ( $newOnly ) { |
| 30 | 32 | print "Refreshing links from "; |
| — | — | @@ -48,7 +50,9 @@ |
| 49 | 51 | } |
| 50 | 52 | } else { |
| 51 | 53 | 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 | + } |
| 53 | 57 | print("Starting from page_id $start of $end.\n"); |
| 54 | 58 | |
| 55 | 59 | for ($id = $start; $id <= $end; $id++) { |
| — | — | @@ -65,11 +69,14 @@ |
| 66 | 70 | } |
| 67 | 71 | |
| 68 | 72 | function fixLinksFromArticle( $id ) { |
| 69 | | - global $wgTitle, $wgArticle, $wgOut, $wgParser; |
| 70 | | - |
| | 73 | + global $wgTitle, $wgArticle, $wgOut, $wgParser, $wgLinkCache; |
| | 74 | + |
| 71 | 75 | $wgTitle = Title::newFromID( $id ); |
| 72 | 76 | $dbw =& wfGetDB( DB_MASTER ); |
| 73 | 77 | |
| | 78 | + $linkCache =& LinkCache::singleton(); |
| | 79 | + $linkCache->clear(); |
| | 80 | + |
| 74 | 81 | if ( is_null( $wgTitle ) ) { |
| 75 | 82 | return; |
| 76 | 83 | } |
| — | — | @@ -83,7 +90,7 @@ |
| 84 | 91 | $options = new ParserOptions; |
| 85 | 92 | $parserOutput = $wgParser->parse( $revision->getText(), $wgTitle, $options, true, true, $revision->getId() ); |
| 86 | 93 | $update = new LinksUpdate( $wgTitle, $parserOutput ); |
| 87 | | - $update->doDumbUpdate(); |
| | 94 | + $update->doUpdate(); |
| 88 | 95 | $dbw->immediateCommit(); |
| 89 | 96 | } |
| 90 | 97 | |
| Index: trunk/phase3/maintenance/refreshLinks.php |
| — | — | @@ -6,7 +6,7 @@ |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | /** */ |
| 10 | | -$optionsWithArgs = array( 'm' ); |
| | 10 | +$optionsWithArgs = array( 'm', 'e' ); |
| 11 | 11 | require_once( "commandLine.inc" ); |
| 12 | 12 | require_once( "refreshLinks.inc" ); |
| 13 | 13 | |
| — | — | @@ -19,8 +19,14 @@ |
| 20 | 20 | $start = 1; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | | - refreshLinks( $start, $options['new-only'], $options['m'] ); |
| | 23 | + refreshLinks( $start, $options['new-only'], $options['m'], $options['e'] ); |
| 24 | 24 | } |
| 25 | | -deleteLinksFromNonexistent(); |
| | 25 | +// this bit's bad for replication: disabling temporarily |
| | 26 | +// --brion 2005-07-16 |
| | 27 | +//deleteLinksFromNonexistent(); |
| 26 | 28 | |
| | 29 | +if ( $options['globals'] ) { |
| | 30 | + print_r( $GLOBALS ); |
| | 31 | +} |
| | 32 | + |
| 27 | 33 | ?> |