Undeprecate UploadForm:BeforeProcessing. Instead only deprecate the code path that would return the user a blank form with no error message.

This commit is contained in:
Bryan Tong Minh 2010-11-08 21:07:10 +00:00
parent 6b1f0fa6d2
commit 497dba23b2
3 changed files with 9 additions and 6 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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 );
}