edit.php maintenance script not setting up context, just globals
authorAlex Monk <krenair@gmail.com>
Thu, 6 Jun 2013 20:20:20 +0000 (21:20 +0100)
committerAlex Monk <krenair@gmail.com>
Thu, 6 Jun 2013 20:21:19 +0000 (21:21 +0100)
Was breaking one of Echo's hooks

Bug: 49271
Change-Id: Ie1b5f5bc4a672bcfff3c99b9a76b37c502c09985

maintenance/edit.php

index 7fca651..7c24f0f 100644 (file)
@@ -52,6 +52,8 @@ class EditCLI extends Maintenance {
                $noRC = $this->hasOption( 'no-rc' );
 
                $wgUser = User::newFromName( $userName );
+               $context = RequestContext::getMain();
+               $context->setUser( $wgUser );
                if ( !$wgUser ) {
                        $this->error( "Invalid username", true );
                }
@@ -63,6 +65,7 @@ class EditCLI extends Maintenance {
                if ( !$wgTitle ) {
                        $this->error( "Invalid title", true );
                }
+               $context->setTitle( $wgTitle );
 
                $page = WikiPage::factory( $wgTitle );