As suggested to me by email: very active members of a wiki community can end up recei...
[lhc/web/wiklou.git] / includes / specials / SpecialUploadStash.php
index 9f14c5f..3be2e81 100644 (file)
@@ -97,7 +97,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                        $message = $e->getMessage();
                }
 
-               wfHttpError( $code, OutputPage::getStatusMessage( $code ), $message );
+               wfHttpError( $code, HttpStatus::getMessage( $code ), $message );
                return false;
        }
 
@@ -133,13 +133,12 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                return array( 'file' => $file, 'type' => $type );
        }
 
-
-
-
        /**
         * Get a thumbnail for file, either generated locally or remotely, and stream it out
-        * @param String $key: key for the file in the stash
-        * @param int $width: width of desired thumbnail
+        *
+        * @param $file
+        * @param $params array
+        *
         * @return boolean success
         */
        private function outputThumbFromStash( $file, $params ) {
@@ -155,11 +154,8 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                } else {
                        $this->outputLocallyScaledThumb( $file, $params, $flags );
                }
-
-
        }
 
-
        /**
         * Scale a file (probably with a locally installed imagemagick, or similar) and output it to STDOUT.
         * @param $file: File object
@@ -230,8 +226,10 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                $req = MWHttpRequest::factory( $scalerThumbUrl, $httpOptions );
                $status = $req->execute();
                if ( ! $status->isOK() ) {
-                       $errors = $status->getWikiTextArray( $status->getErrorsArray() );
-                       throw new MWException( "Fetching thumbnail failed: " . join( ", ", $errors ) );
+                       $errors = $status->getErrorsArray();
+                       $errorStr = "Fetching thumbnail failed: " . print_r( $errors, 1 );
+                       $errorStr .= "\nurl = $scalerThumbUrl\n";
+                       throw new MWException( $errorStr );
                }
                $contentType = $req->getResponseHeader( "content-type" );
                if ( ! $contentType ) {
@@ -320,7 +318,6 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                $this->setHeaders();
                $this->outputHeader();
 
-
                // create the form, which will also be used to execute a callback to process incoming form data
                // this design is extremely dubious, but supposedly HTMLForm is our standard now?
 
@@ -338,13 +335,12 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                $form->prepareForm();
                $formResult = $form->tryAuthorizedSubmit();
 
-
                // show the files + form, if there are any, or just say there are none
                $refreshHtml = Html::element( 'a',
                        array( 'href' => $this->getTitle()->getLocalURL() ),
                        wfMsg( 'uploadstash-refresh' ) );
                $files = $this->stash->listFiles();
-               if ( count( $files ) ) {
+               if ( $files && count( $files ) ) {
                        sort( $files );
                        $fileListItemsHtml = '';
                        foreach ( $files as $file ) {