Share » Forums » Developer » Insert objects from module clear...

Insert objects from module clear cache problem

Insert objects from module clear cache problem

Wednesday 08 February 2006 3:15:52 am - 5 replies

Modified on Friday 10 February 2006 8:08:15 am by H-Works Agency

Author Message

Kristof Coomans

Saturday 11 February 2006 1:48:31 am

Hi Martin

This is the code you need:

include_once( 'kernel/classes/ezcontentcachemanager.php' );
eZContentCacheManager::clearContentCacheIfNeeded( $objectID );

Aren't you using the publish operation to insert those content objects? If you're using this operation, clearing caches would be done automatically. Or do these content objects already exist and are you creating additional node assignments?

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

H-Works Agency

Saturday 11 February 2006 8:24:25 am

Hi Kristof and thanx a lot for your code.

To respond to your question my extension is inserting objects inside one of my root folders, its not creating extra node assignements.

Actually i had hard time finding documentation about inserting an object from an extension, i had to browse contribution to take code as exemple but i didn't know if i used the right procedure but now that you say that the right EZP insert function is auto clearing the cache, i am shure i didn't use the right one because mine doesn't.

What is the "right" function to handle such operations ? I mean the built in ezp function that insert an object somewhere and clear parent's cache automatically ?

Thanx for everything,

Regards,
Martin

EZP is Great

Kristof Coomans

Saturday 11 February 2006 9:51:45 am

After creating node assignments for your object, you should call the publish operation, as mentioned in this thread: http://ez.no/community/forum/general/publish_object_with_php:

$operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID, 'version' => $contentObjectVersion ) );

There are other forum threads about programmatically creating content objects, like http://ez.no/community/forum/developer/importing_update_entry_if_it_already_exists, but they're quite hard to find with the search function.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

H-Works Agency

Thursday 16 February 2006 8:00:58 am

I already use this function to insert my object from my module but it doesn't clear the cache...am i missing something ?

$operationResult = eZOperationHandler::execute('content', 'publish', array('object_id' => $contentObjectID, 'version' => 1));

Martin

EZP is Great

H-Works Agency

Thursday 16 February 2006 8:26:21 am

Ok thanx a lot Kristian, in fact my function clear the cache by default, but it was missing this line :

include_once('kernel/classes/ezcontentcachemanager.php');

Martin

EZP is Great

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

36 542 Users on board!

Forums menu