r76386 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76385‎ | r76386 | r76387 >
Date:12:56, 9 November 2010
Author:ialex
Status:ok
Tags:
Comment:
* Marked Special:UploadStash unlisted since accessing it only subpage param only returns a 403 (and also resolves bug 25813)
* Use OutputPage::getStatusMessage() instead of duplicating the list
* Removed trailing whitespaces
Modified paths:
  • /trunk/phase3/includes/specials/SpecialUploadStash.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialUploadStash.php
@@ -16,15 +16,7 @@
1717 * @ingroup Upload
1818 */
1919
20 -class SpecialUploadStash extends SpecialPage {
21 -
22 - static $HttpErrors = array( // FIXME: Use OutputPage::getStatusMessage() --RK
23 - 400 => 'Bad Request',
24 - 403 => 'Access Denied',
25 - 404 => 'File not found',
26 - 500 => 'Internal Server Error',
27 - );
28 -
 20+class SpecialUploadStash extends UnlistedSpecialPage {
2921 // UploadStash
3022 private $stash;
3123
@@ -35,7 +27,7 @@
3628 // $subpage is everything in the URL after Special:UploadStash
3729 // FIXME: These parameters don't match SpecialPage::__construct()'s params at all, and are unused --RK
3830 public function __construct( $request = null, $subpage = null ) {
39 - parent::__construct( 'UploadStash', 'upload' );
 31+ parent::__construct( 'UploadStash', 'upload' );
4032 $this->stash = new UploadStash();
4133 }
4234
@@ -44,7 +36,7 @@
4537 * n.b. Most sanity checking done in UploadStashLocalFile, so this is straightforward.
4638 *
4739 * @param {String} $subPage: subpage, e.g. in http://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg" part
48 - * @return {Boolean} success
 40+ * @return {Boolean} success
4941 */
5042 public function execute( $subPage ) {
5143 global $wgOut, $wgUser;
@@ -73,7 +65,7 @@
7466 $code = 500;
7567 }
7668
77 - wfHttpError( $code, self::$HttpErrors[$code], $e->getCode(), $e->getMessage() );
 69+ wfHttpError( $code, OutputPage::getStatusMessage( $code ), $e->getMessage() );
7870 return false;
7971 }
8072
@@ -89,8 +81,8 @@
9082 // the stash key doesn't have an extension
9183 $key = $subPage;
9284 $n = strrpos( $subPage, '.' );
93 - if ( $n !== false ) {
94 - $key = $n ? substr( $subPage, 0, $n ) : $subPage;
 85+ if ( $n !== false ) {
 86+ $key = $n ? substr( $subPage, 0, $n ) : $subPage;
9587 }
9688
9789 try {
@@ -119,7 +111,7 @@
120112 }
121113 $file = $thumbnailImage->thumbnailFile;
122114 }
123 -
 115+
124116 return $file;
125117 }
126118
@@ -127,7 +119,7 @@
128120 * Output HTTP response for file
129121 * Side effects, obviously, of echoing lots of stuff to stdout.
130122 * @param {File} file
131 - */
 123+ */
132124 private function outputFile( $file ) {
133125 header( 'Content-Type: ' . $file->getMimeType(), true );
134126 header( 'Content-Transfer-Encoding: binary', true );
@@ -137,4 +129,3 @@
138130 readfile( $file->getPath() );
139131 }
140132 }
141 -

Follow-up revisions

RevisionCommit summaryAuthorDate
r76443Fixed some doxygen warnings (and some whitespaces removal I forgot to commit ...ialex14:48, 10 November 2010
r76797uploadwizard-deployment: Merge recent revs from trunk: r75995, r76354, r76386...catrope14:47, 16 November 2010

Status & tagging log