*
* @ingroup Maintenance
*/
-
+
require_once( dirname( __FILE__ ) . '/Maintenance.php' );
class DeleteBatch extends Maintenance {
-
+
public function __construct() {
parent::__construct();
$this->mDescription = "Deletes a batch of pages";
$this->addOption( 'u', "User to perform deletion", false, true );
$this->addOption( 'r', "Reason to delete page", false, true );
$this->addOption( 'i', "Interval to sleep between deletions" );
- $this->addArg( 'listfile', 'File with titles to delete, separated by newlines', false );
+ $this->addArg( 'listfile', 'File with titles to delete, separated by newlines. ' .
+ 'If not given, stdin will be used.', false );
}
-
+
public function execute() {
global $wgUser;
# Change to current working directory
$oldCwd = getcwd();
chdir( $oldCwd );
-
+
# Options processing
$user = $this->getOption( 'u', 'Delete page script' );
$reason = $this->getOption( 'r', '' );
$this->output( "Skipping nonexistent page '$line'\n" );
continue;
}
-
-
+
+
$this->output( $page->getPrefixedText() );
$dbw->begin();
if ( $page->getNamespace() == NS_FILE ) {
} else {
$this->output( " FAILED to delete article\n" );
}
-
+
if ( $interval ) {
sleep( $interval );
}
- wfWaitForSlaves( 5 );
+ wfWaitForSlaves();
}
}
}
$maintClass = "DeleteBatch";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );