]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - maintenance/refreshLinks.php
MediaWiki 1.15.0
[autoinstallsdev/mediawiki.git] / maintenance / refreshLinks.php
1 <?php
2 /**
3  * @file
4  * @ingroup Maintenance
5  */
6
7 /** */
8 $optionsWithArgs = array('batch-size', 'm', 'e' );
9
10 require_once( "commandLine.inc" );
11 require_once( "refreshLinks.inc" );
12
13 if( isset( $options['help'] ) ) {
14         echo <<<TEXT
15 Usage:
16     php refreshLinks.php --help
17     php refreshLinks.php [<start>] [-e <end>] [-m <maxlag>] [--dfn-only]
18                          [--batch-size <size>] [--new-only] [--redirects-only]
19     php refreshLinks.php [<start>] [-e <end>] [-m <maxlag>] --old-redirects-only
20
21     --help                : This help message
22     --dfn-only            : Delete links from nonexistent articles only
23     --batch-size <number> : The delete batch size when removing links from
24                             nonexistent articles (defaults to 100)
25     --new-only            : Only affect articles with just a single edit
26     --redirects-only      : Only fix redirects, not all links
27     --old-redirects-only  : Only fix redirects with no redirect table entry
28     -m <number>           : Maximum replication lag
29     <start>               : First page id to refresh
30     -e <number>           : Last page id to refresh
31
32 TEXT;
33         exit(0);
34 }
35
36 error_reporting( E_ALL & (~E_NOTICE) );
37
38 if ( !$options['dfn-only'] ) {
39         if ( isset( $args[0] ) ) {
40                 $start = (int)$args[0];
41         } else {
42                 $start = 1;
43         }
44
45         refreshLinks( $start, $options['new-only'], $options['m'], $options['e'], $options['redirects-only'], $options['old-redirects-only'] );
46 }
47
48 if ( !isset( $options['batch-size'] ) ) {
49   $options['batch-size'] = 100;
50 }
51
52 deleteLinksFromNonexistent($options['m'], $options['batch-size']);
53
54 if ( $options['globals'] ) {
55         print_r( $GLOBALS );
56 }