eZ Community » Forums » Install & configuration » Binary File Settings Handler in more...
expandshrink

Binary File Settings Handler in more than one extension?

Binary File Settings Handler in more than one extension?

Monday 16 April 2012 10:03:27 am - 5 replies

Hi. Via file.ini and file.ini.append.php added to your own extensions, you can define your own binaryfilehandler handler...

But what if a add two or more extensions having its own?

For instance, ezvideoflv extensions adds its own

[BinaryFileSettings]Handler=eZVideoFLVHandler

But what will happen if i add a custom extension, or maybe i add another one made by the community having its own also? Won't they be conflicting?

Cheers.

Monday 16 April 2012 3:56:52 pm

Hi Carlos,

extension ordering priority kicks in in that case. Whichever extension has the highest priority when loading (controllable via ActiveExtensions configuration and extension.xml), its settings will take precedence over other extensions so there won't be any conflicts.

Monday 16 April 2012 4:16:43 pm

Hi Edi... Ok to that, but my worries is that two different  handlers can have totally different behaviours. Following ezvideoflv example, we have this piece of code in preview.php view 

 $result = $fileHandler->handleDownload( $contentObject, $contentObjectAttribute, eZVideoHandler::TYPE_PREVIEW );

eZVideoFLVhandler has two const, for download previews or the video itself... 

having ezvideflvhandler, this leads you to file handleFileDownloadPreview method of the eZVideoFlvHandler class, and this shows the preview. 

but i add a new extension, having it's own handler and with more priority. wouldn't this be a problem? wouldn't this affect the previews or the videos of ezvideoflv extension if i not copy their functions to my custom handler?

Cheers. 

Monday 16 April 2012 4:46:00 pm

I'm afraid there's no way around it. If you leave it to eZBinaryFileHandler::instance() to provide the "correct" binary file handler, you'll end up with whichever one has highest priority.

If you're using binary file handler in your custom code, you can always instantiate the correct file handler by hand for specific objects, in this case:

$videoHandler = new eZVideoHandler();
$result = $videoHandler->handleDownload( $contentObject, $contentObjectAttribute, eZVideoHandler::TYPE_PREVIEW );

Modified on Monday 16 April 2012 4:46:33 pm by Edi Modrić

Monday 16 April 2012 4:57:41 pm

i see... yep, that seems to be the best option. Thank you

Friday 27 April 2012 11:48:03 am

Hi Carlos and Edi,

it looks like I have exactly the same issue... but I'm too stupid to use the code snippet from Edi sad.gif Emoticon
@Carlos: could you please post your customized handler ? (The class where you call the ezvideoflv handler from your customized handler).

Thanks
Laurent

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from