From d55ad0f29c40f274b8a2f91753854d26a0c3670e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sun, 19 Jul 2009 17:24:48 +0000 Subject: [PATCH] * (bug 19827) Special:SpecialPages title is "Upload file Restructured SpecialUpload class was performing output in constructor; this messed up other pages using the object in the background, as Special:Specialpages --- RELEASE-NOTES | 1 + includes/specials/SpecialUpload.php | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 60f6bfa5ae..9d2a265e9f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -292,6 +292,7 @@ this. Was used when mwEmbed was going to be an extension. * (bug 19784) date option "ISO 8601" produced illegal id * (bug 19761) Removed autogenerated tag with link data. Keyword set was not useful, and is ignored by modern search engines anway. +* (bug 19827) Special:SpecialPages title is "Upload file == API changes in 1.16 == diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 49bac540f1..24041d5017 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -33,17 +33,18 @@ class UploadForm extends SpecialPage { * @param $request Data posted. */ function __construct( $request = null ) { - global $wgUser, $wgRequest; - parent::__construct( 'Upload' ); + $this->mRequest = $request; + } - $this->setHeaders(); - $this->outputHeader(); - - if ( is_null( $request ) ) { + protected function initForm() { + global $wgRequest, $wgUser; + + if ( is_null( $this->mRequest ) ) { $request = $wgRequest; + } else { + $request = $this->mRequest; } - // Guess the desired name from the filename if not provided $this->mDesiredDestName = $request->getText( 'wpDestFile' ); if( !$this->mDesiredDestName ) @@ -81,14 +82,19 @@ class UploadForm extends SpecialPage { $this->mAction = $request->getVal( 'action' ); $this->mUpload = UploadBase::createFromRequest( $request ); } - - + /** * Start doing stuff * @access public */ function execute( $par ) { - global $wgUser, $wgOut; + global $wgUser, $wgOut, $wgRequest; + + $this->setHeaders(); + $this->outputHeader(); + + $this->initForm(); + # Check uploading enabled if( !UploadBase::isEnabled() ) { $wgOut->showErrorPage( 'uploaddisabled', 'uploaddisabledtext' ); -- 2.20.1