Jump to content

Manual talk:Hooks/UploadComplete

Add topic
From mediawiki.org
Latest comment: 15 years ago by Benjamin Garn

What is the return value that is expected here? 141.241.202.16 10:51, 1 September 2008 (UTC)Reply

Read the docs:
Event handlers can return one of three possible values:
  • true: the hook has operated successfully
  • "some string": an error occurred; processing should stop and the error should be shown to the user
  • false: the hook has successfully done the work necessary and the calling function should skip
--Benjamin Garn 16:40, 17 December 2008 (UTC)Reply

$image is not Image

[edit]

The object passed to this hook is NOT Image but UploadForm! --Benjamin Garn 16:33, 17 December 2008 (UTC)Reply

$image->mLocalFile is protected

[edit]

I am using $image->mFileProps accessing some meta data, because mLocalFile is protected. Because of this protection access mentioned in Manual:Hooks/UploadComplete (e.g. $image->mLocalFile->media_type) is not available. I am using $image->mFileProps->media_type instead.

when i access $image->mLocalFile i get the following error Fatal error: Cannot access protected property UploadFromFile::$mLocalFile in myextension.php solution: http://www.mail-archive.com/mediawiki-cvs@lists.wikimedia.org/msg26323.html SpecialUpload.php has changed mLocalFile to protected. Change it back to public respectively updating mediawiki via svn maybe solves the error above. in includes/upload/UploadBase.php mLocalFile must also be changed. This is not included in svn version phase3.