mediawiki.api.watch: Fix promise return value format
[lhc/web/wiklou.git] / includes / actions / RevertAction.php
index a5fc4e1..cdd139e 100644 (file)
@@ -38,7 +38,8 @@ class RevertAction extends Action {
                $this->getOutput()->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
        }
 
-       public function execute() {}
+       public function execute() {
+       }
 }
 
 /**
@@ -47,6 +48,9 @@ class RevertAction extends Action {
  * @ingroup Actions
  */
 class RevertFileAction extends FormAction {
+       /**
+        * @var OldLocalFile
+        */
        protected $oldFile;
 
        public function getName() {
@@ -63,12 +67,16 @@ class RevertFileAction extends FormAction {
                $oldimage = $this->getRequest()->getText( 'oldimage' );
                if ( strlen( $oldimage ) < 16
                        || strpos( $oldimage, '/' ) !== false
-                       || strpos( $oldimage, '\\' ) !== false )
-               {
+                       || strpos( $oldimage, '\\' ) !== false
+               {
                        throw new ErrorPageError( 'internalerror', 'unexpected', array( 'oldimage', $oldimage ) );
                }
 
-               $this->oldFile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $this->getTitle(), $oldimage );
+               $this->oldFile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName(
+                       $this->getTitle(),
+                       $oldimage
+               );
+
                if ( !$this->oldFile->exists() ) {
                        throw new ErrorPageError( '', 'filerevert-badversion' );
                }
@@ -99,8 +107,10 @@ class RevertFileAction extends FormAction {
                                'raw' => true,
                                'default' => $this->msg( 'filerevert-intro',
                                        $this->getTitle()->getText(), $userDate, $userTime,
-                                       wfExpandUrl( $this->page->getFile()->getArchiveUrl( $this->getRequest()->getText( 'oldimage' ) ),
-                                               PROTO_CURRENT ) )->parseAsBlock()
+                                       wfExpandUrl(
+                                               $this->page->getFile()->getArchiveUrl( $this->getRequest()->getText( 'oldimage' ) ),
+                                               PROTO_CURRENT
+                                       ) )->parseAsBlock()
                        ),
                        'comment' => array(
                                'type' => 'text',
@@ -112,10 +122,21 @@ class RevertFileAction extends FormAction {
        }
 
        public function onSubmit( $data ) {
-               $source = $this->page->getFile()->getArchiveVirtualUrl( $this->getRequest()->getText( 'oldimage' ) );
+               $source = $this->page->getFile()->getArchiveVirtualUrl(
+                       $this->getRequest()->getText( 'oldimage' )
+               );
                $comment = $data['comment'];
+
                // TODO: Preserve file properties from database instead of reloading from file
-               return $this->page->getFile()->upload( $source, $comment, $comment, 0, false, false, $this->getUser() );
+               return $this->page->getFile()->upload(
+                       $source,
+                       $comment,
+                       $comment,
+                       0,
+                       false,
+                       false,
+                       $this->getUser()
+               );
        }
 
        public function onSuccess() {
@@ -139,6 +160,7 @@ class RevertFileAction extends FormAction {
 
        protected function getDescription() {
                $this->getOutput()->addBacklinkSubtitle( $this->getTitle() );
+
                return '';
        }
 }