00001 <?php
00008 $optionsWithArgs = array('batch-size', 'm', 'e' );
00009
00010 require_once( "commandLine.inc" );
00011 require_once( "refreshLinks.inc" );
00012
00013 if( isset( $options['help'] ) ) {
00014 echo <<<TEXT
00015 Usage:
00016 php refreshLinks.php --help
00017 php refreshLinks.php [<start>] [-e <end>] [-m <maxlag>] [--dfn-only]
00018 [--batch-size <size>] [--new-only] [--redirects-only]
00019 php refreshLinks.php [<start>] [-e <end>] [-m <maxlag>] --old-redirects-only
00020
00021 --help : This help message
00022 --dfn-only : Delete links from nonexistent articles only
00023 --batch-size <number> : The delete batch size when removing links from
00024 nonexistent articles (defaults to 100)
00025 --new-only : Only affect articles with just a single edit
00026 --redirects-only : Only fix redirects, not all links
00027 --old-redirects-only : Only fix redirects with no redirect table entry
00028 -m <number> : Maximum replication lag
00029 <start> : First page id to refresh
00030 -e <number> : Last page id to refresh
00031
00032 TEXT;
00033 exit(0);
00034 }
00035
00036 error_reporting( E_ALL & (~E_NOTICE) );
00037
00038 if ( !$options['dfn-only'] ) {
00039 if ( isset( $args[0] ) ) {
00040 $start = (int)$args[0];
00041 } else {
00042 $start = 1;
00043 }
00044
00045 refreshLinks( $start, $options['new-only'], $options['m'], $options['e'], $options['redirects-only'], $options['old-redirects-only'] );
00046 }
00047
00048 if ( !isset( $options['batch-size'] ) ) {
00049 $options['batch-size'] = 100;
00050 }
00051
00052 deleteLinksFromNonexistent($options['m'], $options['batch-size']);
00053
00054 if ( $options['globals'] ) {
00055 print_r( $GLOBALS );
00056 }