* @ingroup Maintenance
*/
-require_once( "Maintenance.php" );
+require_once( dirname(__FILE__) . '/Maintenance.php' );
class RefreshLinks extends Maintenance {
public function __construct() {
$this->addOption( 'old-redirects-only', 'Only fix redirects with no redirect table entry' );
$this->addOption( 'm', 'Maximum replication lag', false, true );
$this->addOption( 'e', 'Last page id to refresh', false, true );
- $this->addArgs( array( 'start' => true ) );
+ $this->addArg( 'start', 'Page_id to start from, default 1' );
$this->setBatchSize( 100 );
}
$num = $dbr->numRows( $res );
$this->output( "Refreshing $num old redirects from $start...\n" );
- while( $row = $dbr->fetchObject( $res ) ) {
+ foreach( $res as $row ) {
if ( !( ++$i % $reportingInterval ) ) {
$this->output( "$i\n" );
wfWaitForSlaves( $maxLag );
$this->output( "$num new articles...\n" );
$i = 0;
- while ( $row = $dbr->fetchObject( $res ) ) {
+ foreach ( $res as $row ) {
if ( !( ++$i % $reportingInterval ) ) {
$this->output( "$i\n" );
wfWaitForSlaves( $maxLag );