Remove never thrown UploadStashNotAvailableException
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 14 Mar 2015 14:12:05 +0000 (15:12 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Wed, 25 Mar 2015 19:29:49 +0000 (19:29 +0000)
Also move creation of UploadStash to main entry point of the special
page to avoid use of context before it is set (by called getUser).

Change-Id: Ibcb17b6ee1b853d807f91104ba428b307e9a5208

autoload.php
includes/api/ApiQueryStashImageInfo.php
includes/specials/SpecialUploadStash.php
includes/upload/UploadStash.php

index 892a1f7..e0b91df 100644 (file)
@@ -1264,7 +1264,6 @@ $wgAutoloadLocalClasses = array(
        'UploadStashFileException' => __DIR__ . '/includes/upload/UploadStash.php',
        'UploadStashFileNotFoundException' => __DIR__ . '/includes/upload/UploadStash.php',
        'UploadStashNoSuchKeyException' => __DIR__ . '/includes/upload/UploadStash.php',
-       'UploadStashNotAvailableException' => __DIR__ . '/includes/upload/UploadStash.php',
        'UploadStashNotLoggedInException' => __DIR__ . '/includes/upload/UploadStash.php',
        'UploadStashWrongOwnerException' => __DIR__ . '/includes/upload/UploadStash.php',
        'UploadStashZeroLengthFileException' => __DIR__ . '/includes/upload/UploadStash.php',
index 59fe8ad..342e367 100644 (file)
@@ -62,8 +62,6 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo {
                                $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), $modulePrefix );
                        }
                // @todo Update exception handling here to understand current getFile exceptions
-               } catch ( UploadStashNotAvailableException $e ) {
-                       $this->dieUsage( "Session not available: " . $e->getMessage(), "nosession" );
                } catch ( UploadStashFileNotFoundException $e ) {
                        $this->dieUsage( "File not found: " . $e->getMessage(), "invalidsessiondata" );
                } catch ( UploadStashBadPathException $e ) {
index 87e7063..12e103e 100644 (file)
@@ -48,10 +48,6 @@ class SpecialUploadStash extends UnlistedSpecialPage {
 
        public function __construct() {
                parent::__construct( 'UploadStash', 'upload' );
-               try {
-                       $this->stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash( $this->getUser() );
-               } catch ( UploadStashNotAvailableException $e ) {
-               }
        }
 
        /**
@@ -62,6 +58,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
         * @return bool Success
         */
        public function execute( $subPage ) {
+               $this->stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash( $this->getUser() );
                $this->checkPermissions();
 
                if ( $subPage === null || $subPage === '' ) {
index 52ce4d3..c07665a 100644 (file)
@@ -727,9 +727,6 @@ class UploadStashFile extends UnregisteredLocalFile {
 class UploadStashException extends MWException {
 }
 
-class UploadStashNotAvailableException extends UploadStashException {
-}
-
 class UploadStashFileNotFoundException extends UploadStashException {
 }