From: Mark A. Hershberger Date: Thu, 11 Nov 2010 17:52:46 +0000 (+0000) Subject: * Revert r76503 X-Git-Tag: 1.31.0-rc.0~33927 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=85639560a4df2154f975f8b5aaa1694b06147735;p=lhc%2Fweb%2Fwiklou.git * 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 --- 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(); }