http://www.mediawiki.org/wiki/Special:Code/MediaWiki/76341
Revision: 76341
Author: btongminh
Date: 2010-11-08 21:07:10 +0000 (Mon, 08 Nov 2010)
Log Message:
-----------
Undeprecate UploadForm:BeforeProcessing. Instead only deprecate the code path
that would return the user a blank form with no error message.
Modified Paths:
--------------
trunk/phase3/docs/hooks.txt
trunk/phase3/includes/specials/SpecialUpload.php
trunk/phase3/includes/upload/UploadBase.php
Modified: trunk/phase3/docs/hooks.txt
===================================================================
--- trunk/phase3/docs/hooks.txt 2010-11-08 20:53:52 UTC (rev 76340)
+++ trunk/phase3/docs/hooks.txt 2010-11-08 21:07:10 UTC (rev 76341)
@@ -1678,10 +1678,13 @@
$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
Modified: trunk/phase3/includes/specials/SpecialUpload.php
===================================================================
--- trunk/phase3/includes/specials/SpecialUpload.php 2010-11-08 20:53:52 UTC
(rev 76340)
+++ trunk/phase3/includes/specials/SpecialUpload.php 2010-11-08 21:07:10 UTC
(rev 76341)
@@ -425,12 +425,13 @@
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;
}
Modified: trunk/phase3/includes/upload/UploadBase.php
===================================================================
--- trunk/phase3/includes/upload/UploadBase.php 2010-11-08 20:53:52 UTC (rev
76340)
+++ trunk/phase3/includes/upload/UploadBase.php 2010-11-08 21:07:10 UTC (rev
76341)
@@ -266,7 +266,6 @@
$error = '';
if( !wfRunHooks( 'UploadVerification',
array( $this->mDestName, $this->mTempPath,
&$error ) ) ) {
- // @fixme This status needs another name...
return array( 'status' => self::HOOK_ABORTED, 'error'
=> $error );
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs