From 85639560a4df2154f975f8b5aaa1694b06147735 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Thu, 11 Nov 2010 17:52:46 +0000 Subject: [PATCH] * Revert r76503 * Catch exception thrown when user is not logged in SpecialUploadStash.php * Address RK's fixme comment by making constructor's mimic UnlistedSpecialPage's --- includes/specials/SpecialUploadStash.php | 11 +++++++---- includes/upload/UploadStash.php | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/includes/specials/SpecialUploadStash.php b/includes/specials/SpecialUploadStash.php index d7eb0dc70a..e085e6d964 100644 --- a/includes/specials/SpecialUploadStash.php +++ b/includes/specials/SpecialUploadStash.php @@ -25,10 +25,13 @@ class SpecialUploadStash extends UnlistedSpecialPage { // $request is the request (usually wgRequest) // $subpage is everything in the URL after Special:UploadStash - // FIXME: These parameters don't match SpecialPage::__construct()'s params at all, and are unused --RK - public function __construct( $request = null, $subpage = null ) { - parent::__construct( 'UploadStash', 'upload' ); - $this->stash = new UploadStash(); + public function __construct( $name, $restriction = '', $function = false, $file = 'default' ) { + parent::__construct( $name, 'upload' ); + try { + $this->stash = new UploadStash( ); + } catch (UploadStashNotAvailableException $e) { + return null; + } } /** diff --git a/includes/upload/UploadStash.php b/includes/upload/UploadStash.php index fe5a30d7bb..15e32887a0 100644 --- a/includes/upload/UploadStash.php +++ b/includes/upload/UploadStash.php @@ -44,6 +44,10 @@ class UploadStash { $this->repo = $repo; + if ( ! isset( $_SESSION ) ) { + throw new UploadStashNotAvailableException( 'no session variable' ); + } + if ( !isset( $_SESSION[UploadBase::SESSION_KEYNAME] ) ) { $_SESSION[UploadBase::SESSION_KEYNAME] = array(); } -- 2.20.1