Author Topic

Stéphane Couzinier

Wednesday 03 June 2009 3:12:56 am

Comment51113

If you need to extract a lot of data this will work

<?php 
$userId = eZUser::currentUser()->id();  
$limit=1000;
$offset=0;
do{
$nodes = &eZContentObjectTreeNode::subTreeByNodeId( array("Limit" => $limit,'Offset',$offset) , 2 );     

foreach($nodes as $node){
       
$data = &$node->dataMap();
eZContentObject::clearCache();    
unset( $GLOBALS['eZContentObjectContentObjectCache'] );    
unset( $GLOBALS['eZContentObjectDataMapCache'] );    
unset( $GLOBALS['eZContentObjectVersionCache'] );    
unset( $GLOBALS['eZContentClassAttributeCache'] );    
unset( $GLOBALS["eZUserObject_".$node->ContentObjectID] );  
unset( $data ); 
} 

$offset+=$limit;

echo memory_get_usage() . "\n"; 
}while( !empty( $nodes) );

?>

mem usage
59751392
59814408
59946280
59950608
59946168
59952120
59957768
59936880

http://www.kouz-cooking.fr