need to clear cache after delete/purge object in php

need to clear cache after delete/purge object in php

Wednesday 25 January 2006 9:39:58 am - 7 replies

Author Message

ludo thomas

Tuesday 31 January 2006 4:33:06 am

Pleazzzzzz, any hint??

Łukasz Serwatka

Tuesday 31 January 2006 5:09:48 am

Hi

Try with at the end:

//with object_id parameter
eZContentObject::clearCache(  array( $myobjectid ) );

//or leave empty for all objects
eZContentObject::clearCache();

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Kristof Coomans

Tuesday 31 January 2006 5:16:26 am

From which module/view are you calling this function?

Do you want to clear caches for the object that gets removed?

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

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

ludo thomas

Tuesday 31 January 2006 5:46:43 am

THX for your replys.

I have tried these 3 methods.
each time I have this msg: Call to undefined function: clearcache()

I use 3.5 version.

I use this function in a full-view template.
I have a button with this code:

<form action={"desinscription/"|ezurl} method='get'> 
	<input type='hidden' name='test' value="{$node.node_id}" />
		<input type='hidden' name='test2' value="{$node.object.id}"  />
	<input type='submit' class="button forum-account-edit" name='submit'  onClick='return confirm("Attention. Vous Perdrez tous vos credits!!.")' value='Supprimer'>
	 </form>

in the desinscription template I have this:

<h1>Annulation d'une Annonce </h1>

<p>{suprfunction() }</p>

that call for this function (in extension/myextension/autoloads/mysrtingoperators.php

function suprfunction()
    {
	
	$test=$_GET['test'];
   $test2=$_GET['test2'];
			
			
			include_once( "kernel/classes/ezcontentobjecttreenode.php" );
			
			include_once( "kernel/classes/ezcontentobject.php" );

	 		eZContentObjectTreeNode::remove( $test );
				
			
			eZContentObject::purge( $test2 );
			
			

 
			
			
        return "votre annonce a bien été supprimmée..";
    }

Łukasz Serwatka

Tuesday 31 January 2006 5:48:37 am

This method was added in 3.5.3.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

ludo thomas

Tuesday 31 January 2006 5:57:19 am

I use 3.5.1.
Do you have another trick that could permit me to do the same thing?

I use the samefunction in a cronjob, and have no problem.

I just want to remove directly some object from a template....

ludo thomas

Tuesday 31 January 2006 7:28:10 am

after some others try, I think that the problem could be from the GET['var'] I use.
...

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.