From e2374f6b6475caf29125c8d7c1abf3f48a99910d Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Mon, 21 Dec 2009 19:57:43 +0000 Subject: [PATCH] Restore hooks UploadForm:initial and UploadForm:BeforeProcessing removed in r57868. --- docs/hooks.txt | 11 +++++++++++ includes/specials/SpecialUpload.php | 15 +++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/docs/hooks.txt b/docs/hooks.txt index d4ce23bce8..6969eea400 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1531,6 +1531,17 @@ $article: article object removed $user: user that watched $article: article object that was watched +'UploadForm:initial': before the upload form is generated +$form: UploadForm object +You might set the member-variables $uploadFormTextTop and +$uploadFormTextAfterSummary to inject text (HTML) either before +or after the editform. + +'UploadForm:BeforeProcessing': DEPRECATED! at the beginning of processUpload() +$form: UploadForm object +Lets you poke at member variables like $mUploadDescription before the +file is saved. + 'UploadCreateFromRequest': when UploadBase::createFromRequest has been called $type: (string) the requested upload type &$className: the class name of the Upload instance to be created diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index b9bd277602..19591c8d0b 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -155,6 +155,13 @@ class SpecialUpload extends SpecialPage { && ( $this->mUpload && $this->mUploadClicked ) ) { $this->processUpload(); } else { + # Backwards compatibility hook + if( !wfRunHooks( 'UploadForm:initial', array( &$this ) ) ) + { + wfDebug( "Hook 'UploadForm:initial' broke output of the upload form" ); + return; + } + $this->showUploadForm( $this->getUploadForm() ); } @@ -344,6 +351,14 @@ class SpecialUpload extends SpecialPage { return; } + // Deprecated backwards compatibility hook + if( !wfRunHooks( 'UploadForm:BeforeProcessing', array( &$this ) ) ) + { + wfDebug( "Hook 'UploadForm:BeforeProcessing' broke processing the file.\n" ); + return array( 'status' => UploadBase::BEFORE_PROCESSING ); + } + + // Upload verification $details = $this->mUpload->verifyUpload(); if ( $details['status'] != UploadBase::OK ) { -- 2.20.1