Single messages can be passed as strings to Api::dieUsageMsg()
[lhc/web/wiklou.git] / maintenance / deleteBatch.php
index 120ed7e..f5f850a 100644 (file)
  *
  * @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', '' );
@@ -79,8 +80,8 @@ class DeleteBatch extends Maintenance {
                                $this->output( "Skipping nonexistent page '$line'\n" );
                                continue;
                        }
-       
-       
+
+
                        $this->output( $page->getPrefixedText() );
                        $dbw->begin();
                        if ( $page->getNamespace() == NS_FILE ) {
@@ -99,14 +100,14 @@ class DeleteBatch extends Maintenance {
                        } 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 );