Reconcept cl_raw_sortkey as cl_sortkey_prefix
[lhc/web/wiklou.git] / maintenance / edit.php
index 9fdce24..7e4b2f7 100644 (file)
@@ -20,7 +20,7 @@
  * @ingroup Maintenance
  */
 
-require_once( "Maintenance.php" );
+require_once( dirname( __FILE__ ) . '/Maintenance.php' );
 
 class EditCLI extends Maintenance {
        public function __construct() {
@@ -32,11 +32,11 @@ class EditCLI extends Maintenance {
                $this->addOption( 'b', 'Bot edit' );
                $this->addOption( 'a', 'Enable autosummary' );
                $this->addOption( 'no-rc', 'Do not show the change in recent changes' );
-               $this->addArgs( array( 'title' ) );
+               $this->addArg( 'title', 'Title of article to edit' );
        }
 
        public function execute() {
-               global $wgUser, $wgTitle, $wgArticle;
+               global $wgUser, $wgArticle;
 
                $userName = $this->getOption( 'u', 'Maintenance script' );
                $summary = $this->getOption( 's', '' );
@@ -47,27 +47,27 @@ class EditCLI extends Maintenance {
                
                $wgUser = User::newFromName( $userName );
                if ( !$wgUser ) {
-                       $this->error( "Invalid username\n", true );
+                       $this->error( "Invalid username", true );
                }
                if ( $wgUser->isAnon() ) {
                        $wgUser->addToDatabase();
                }
        
-               $wgTitle = Title::newFromText( $this->getArg() );
-               if ( !$wgTitle ) {
-                       $this->error( "Invalid title\n", true );
+               $title = Title::newFromText( $this->getArg() );
+               if ( !$title ) {
+                       $this->error( "Invalid title", true );
                }
        
-               $wgArticle = new Article( $wgTitle );
+               $wgArticle = new Article( $title );
        
                # Read the text
-               $text = $this->getStdin();
+               $text = $this->getStdin( Maintenance::STDIN_ALL );
                
                # Do the edit
                $this->output( "Saving... " );
-               $status = $wgArticle->doEdit( $text, $summary, 
+               $status = $wgArticle->doEdit( $text, $summary,
                        ( $minor ? EDIT_MINOR : 0 ) |
-                       ( $bot ? EDIT_FORCE_BOT : 0 ) | 
+                       ( $bot ? EDIT_FORCE_BOT : 0 ) |
                        ( $autoSummary ? EDIT_AUTOSUMMARY : 0 ) |
                        ( $noRC ? EDIT_SUPPRESS_RC : 0 ) );
                if ( $status->isOK() ) {