r60277 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60276‎ | r60277 | r60278 >
Date:19:57, 21 December 2009
Author:btongminh
Status:ok (Comments)
Tags:
Comment:
Restore hooks UploadForm:initial and UploadForm:BeforeProcessing removed in r57868.
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUpload.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -1531,6 +1531,17 @@
15321532 $user: user that watched
15331533 $article: article object that was watched
15341534
 1535+'UploadForm:initial': before the upload form is generated
 1536+$form: UploadForm object
 1537+You might set the member-variables $uploadFormTextTop and
 1538+$uploadFormTextAfterSummary to inject text (HTML) either before
 1539+or after the editform.
 1540+
 1541+'UploadForm:BeforeProcessing': DEPRECATED! at the beginning of processUpload()
 1542+$form: UploadForm object
 1543+Lets you poke at member variables like $mUploadDescription before the
 1544+file is saved.
 1545+
15351546 'UploadCreateFromRequest': when UploadBase::createFromRequest has been called
15361547 $type: (string) the requested upload type
15371548 &$className: the class name of the Upload instance to be created
Index: trunk/phase3/includes/specials/SpecialUpload.php
@@ -155,6 +155,13 @@
156156 && ( $this->mUpload && $this->mUploadClicked ) ) {
157157 $this->processUpload();
158158 } else {
 159+ # Backwards compatibility hook
 160+ if( !wfRunHooks( 'UploadForm:initial', array( &$this ) ) )
 161+ {
 162+ wfDebug( "Hook 'UploadForm:initial' broke output of the upload form" );
 163+ return;
 164+ }
 165+
159166 $this->showUploadForm( $this->getUploadForm() );
160167 }
161168
@@ -344,6 +351,14 @@
345352 return;
346353 }
347354
 355+ // Deprecated backwards compatibility hook
 356+ if( !wfRunHooks( 'UploadForm:BeforeProcessing', array( &$this ) ) )
 357+ {
 358+ wfDebug( "Hook 'UploadForm:BeforeProcessing' broke processing the file.\n" );
 359+ return array( 'status' => UploadBase::BEFORE_PROCESSING );
 360+ }
 361+
 362+
348363 // Upload verification
349364 $details = $this->mUpload->verifyUpload();
350365 if ( $details['status'] != UploadBase::OK ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r60280Follow up to r60277: Restore the uploadFormTextTop and uploadFormTextAfterSum...btongminh21:30, 21 December 2009
r70130Follow-up r60277: Do not return BEFORE_PROCESSING, but void instead.btongminh09:32, 29 July 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r57868Rewrote Special:Upload to allow easier extension. Mostly backwards compatible...btongminh19:41, 18 October 2009

Comments

#Comment by Reedy (talk | contribs)   07:47, 29 July 2010

UploadBase::BEFORE_PROCESSING seems not to exist....

Status & tagging log