Undeprecate UploadForm:BeforeProcessing. Instead only deprecate the code path that...
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Mon, 8 Nov 2010 21:07:10 +0000 (21:07 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Mon, 8 Nov 2010 21:07:10 +0000 (21:07 +0000)
docs/hooks.txt
includes/specials/SpecialUpload.php
includes/upload/UploadBase.php

index 26e3c36..652b90f 100644 (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
index 32ffdb0..e9e127a 100644 (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;
                }
 
index 4c2e507..ff25891 100644 (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 );
                }