Restore hooks UploadForm:initial and UploadForm:BeforeProcessing removed in r57868.
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Mon, 21 Dec 2009 19:57:43 +0000 (19:57 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Mon, 21 Dec 2009 19:57:43 +0000 (19:57 +0000)
docs/hooks.txt
includes/specials/SpecialUpload.php

index d4ce23b..6969eea 100644 (file)
@@ -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
index b9bd277..19591c8 100644 (file)
@@ -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 ) {