From 497dba23b2aa779e5ae2f3fbdca3cf63184634df Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Mon, 8 Nov 2010 21:07:10 +0000 Subject: [PATCH] Undeprecate UploadForm:BeforeProcessing. Instead only deprecate the code path that would return the user a blank form with no error message. --- docs/hooks.txt | 5 ++++- includes/specials/SpecialUpload.php | 9 +++++---- includes/upload/UploadBase.php | 1 - 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 26e3c36b6c..652b90f4df 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1678,10 +1678,13 @@ 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() +'UploadForm:BeforeProcessing': at the beginning of processUpload() $form: UploadForm object Lets you poke at member variables like $mUploadDescription before the file is saved. +Do not use this hook to break upload processing. This will return the user to +a blank form with no error message; use UploadVerification and +UploadVerifyFile instead 'UploadCreateFromRequest': when UploadBase::createFromRequest has been called $type: (string) the requested upload type diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 32ffdb0caf..e9e127a9d2 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -425,12 +425,13 @@ 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 without notifying the user of an error. This sucks, but - // this was the previous behaviour as well, and as this hook is - // deprecated we're not going to do anything about it. + // This code path is deprecated. If you want to break upload processing + // do so by hooking into the appropriate hooks in UploadBase::verifyUpload + // and UploadBase::verifyFile. + // If you use this hook to break uploading, the user will be returned + // an empty form with no error message whatsoever. return; } diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index 4c2e50761e..ff25891c7b 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -266,7 +266,6 @@ abstract class UploadBase { $error = ''; if( !wfRunHooks( 'UploadVerification', array( $this->mDestName, $this->mTempPath, &$error ) ) ) { - // @fixme This status needs another name... return array( 'status' => self::HOOK_ABORTED, 'error' => $error ); } -- 2.20.1