From 50b1cd2fbc5c76e8e13f68febd2a764fddeda8bb Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 14 Mar 2015 15:12:05 +0100 Subject: [PATCH] Remove never thrown UploadStashNotAvailableException 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 | 1 - includes/api/ApiQueryStashImageInfo.php | 2 -- includes/specials/SpecialUploadStash.php | 5 +---- includes/upload/UploadStash.php | 3 --- 4 files changed, 1 insertion(+), 10 deletions(-) diff --git a/autoload.php b/autoload.php index 892a1f71d4..e0b91dfb1a 100644 --- a/autoload.php +++ b/autoload.php @@ -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', diff --git a/includes/api/ApiQueryStashImageInfo.php b/includes/api/ApiQueryStashImageInfo.php index 59fe8adf99..342e3675f2 100644 --- a/includes/api/ApiQueryStashImageInfo.php +++ b/includes/api/ApiQueryStashImageInfo.php @@ -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 ) { diff --git a/includes/specials/SpecialUploadStash.php b/includes/specials/SpecialUploadStash.php index 87e70630cf..12e103e737 100644 --- a/includes/specials/SpecialUploadStash.php +++ b/includes/specials/SpecialUploadStash.php @@ -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 === '' ) { diff --git a/includes/upload/UploadStash.php b/includes/upload/UploadStash.php index 52ce4d3a8a..c07665a06c 100644 --- a/includes/upload/UploadStash.php +++ b/includes/upload/UploadStash.php @@ -727,9 +727,6 @@ class UploadStashFile extends UnregisteredLocalFile { class UploadStashException extends MWException { } -class UploadStashNotAvailableException extends UploadStashException { -} - class UploadStashFileNotFoundException extends UploadStashException { } -- 2.20.1