* Revert r76503
authorMark A. Hershberger <mah@users.mediawiki.org>
Thu, 11 Nov 2010 17:52:46 +0000 (17:52 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Thu, 11 Nov 2010 17:52:46 +0000 (17:52 +0000)
* 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
includes/upload/UploadStash.php

index d7eb0dc..e085e6d 100644 (file)
@@ -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;
+               }
        }
 
        /**
index fe5a30d..15e3288 100644 (file)
@@ -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();
                }