minor changes
[lhc/web/wiklou.git] / maintenance / refreshLinks.php
1 <?php
2 define( "REPORTING_INTERVAL", 500 );
3
4 include_once( "commandLine.inc" );
5 error_reporting( E_ALL & (~E_NOTICE) );
6
7
8 if ($argv[2]) {
9 $start = (int)$argv[2];
10 } else {
11 $start = 1;
12 }
13
14 $res = wfQuery("SELECT max(cur_id) as m FROM cur", DB_READ);
15 $row = wfFetchObject( $res );
16 $end = $row->m;
17
18 print("Refreshing link table. Starting from cur_id $start of $end.\n");
19
20 $wgUser->setOption("math", 3);
21 for ($id = $start; $id <= $end; $id++) {
22 if ( !($id % REPORTING_INTERVAL) ) {
23 print "$id\n";
24 }
25
26 $wgTitle = Title::newFromID( $id );
27 if ( is_null( $wgTitle ) ) {
28 continue;
29 }
30
31 $wgLinkCache = new LinkCache;
32 $wgArticle = new Article( $wgTitle );
33 $text = $wgArticle->getContent( true );
34 @$wgOut->addWikiText( $text );
35
36 $linksUpdate = new LinksUpdate( $id, $wgTitle );
37 $linksUpdate->doDumbUpdate();
38 }
39
40
41 exit();
42
43 ?>