Path

ez projects / ezsi / forum / general / ezsi files /var/si-blocks/...


EZSI files /var/si-blocks/ and ezdbfilecluster...

You need to be logged in to post messages in the forums. New users may register here.

Pablo Pernot

Member since:
09 January 2008

Posts: 17

Wednesday 19 May 2010 4:22:57 pm


Hello,

I got multiple frontend, and a db cluster (ezdbcluster) behind.
I noticed the ezsi files are stored on the filesystem : var/si-blocks/ ... of my frontend.

Is there a way to store them within the ezdbfile / data tables ?

thanks.
Up

Alexandre Nion

Member since:
09 January 2008

Posts: 5

Friday 04 June 2010 11:26:35 am

Hello,

Is there a way to store them within the ezdbfile / data tables ?


Yes, you will need to write your own file handler that will use cluster api instead of direct file calls.

To achieve this, a class ezsiclusterfilehandler can be written in folder classes/filehandlers/cluster , defining how to store and delete using cluster api. It should contain something like :




   public function storeFile( $directory, $fileName, $fileContents )


   {


       $filePath = 'var/'.$directory.'/'.$fileName;


       $clusterFileHandler = eZClusterFileHandler::instance();


       $clusterFileHandler->fileStoreContents( $filePath, $fileContents );


 

       // TODO : Check for a better error handling


       return true;


   }


..


   public function removeFile( $directory, $fileName )


   {


       $filePath = $directory.'/'.$fileName;


       eZDebug::writeNotice( 'Removing ' . $filePath, __METHOD__ );


       $clusterFileHandler = eZClusterFileHandler::instance( $filePath );


       $clusterFileHandler->delete();


   }




This works nice for me. Just check carefully that SI blocks will also be cached by your Varnish as this may strongly increase charge on your database..

Enjoy
Up

Gaetano Giunta

Member since:
30 November 1999

Posts: 269

Friday 04 June 2010 1:49:26 pm

Principal Consultant International Business
Member of the Community Project Board

Up

You need to be logged in to post messages in the forums. New users may register here.