eZInformationCollection fetch information collector data CLI

Author Message

Benoit Schumacher

Wednesday 25 March 2009 3:42:06 am

Hi,

I have been trying to figure out how to use php to get information collector data as I need to export it as xml for a external application to use.

I am able to get the collection ids, but not to get the collected info for each collection.

What I probably need is simply to have this:

{def $collection=fetch( 'content', 'collected_info_collection',
                        hash( 'collection_id',    123,
                              'contentobject_id', 456 ) )}

in the php format ?

below is my script I am trying:


#!/usr/bin/env php
<?php 
 
 require 'autoload.php';
 
include_once( 'lib/ezutils/classes/ezcli.php' );
include_once( 'kernel/classes/ezscript.php' );
 
$cli =& eZCLI::instance();
$script =& eZScript::instance();
 
$script->startup();
 
$options = $script->getOptions();
 
$script->initialize();
 
	//include_once( 'kernel/classes/ezcontentobjecttreenode.php' );
	include_once( 'kernel/classes/ezcontentclass.php' );
	include_once( 'kernel/classes/ezcontentobject.php' );
	include_once( 'kernel/classes/ezinformationcollection.php' );
	
	 
	$objectID = 887;
                                                               
	$collections = eZInformationCollection::fetchCollectionsList(
											                 $objectID,
											                 false,
											                 false,
											                 array() ); 
                                                                  
	$numberOfCollections = eZInformationCollection::fetchCollectionCountForObject( $objectID ); 
	 
	 
	 /*{def $collection=fetch( 'content', 'collected_info_collection',
                        hash( 'collection_id',    123,
                              'contentobject_id', 456 ) )}*/

	
	
	/*$v0 = var_export($collections);	
	$cli->output($v0);*/

	$node = eZInformationCollection::fetch( 2 );
	
	$v0 = var_export($node);	
	$cli->output($v0);
	
	$cli->output("node2::");
	
	$node2 = eZInformationCollection::fetch( 534 );
	
	$v02 = var_export($node2);	
	$cli->output($v02);
		
	
	$cli->output("by identifier::");
	
	$node3 = eZInformationCollection::fetchByUserIdentifier( '64sbs9p4krcpe7ba0vp7ico4r2' , $objectID );
	
	$v03 = var_export($node3);	
	$cli->output($v03);
		
	/*foreach($collections as $collection) {
				
		$v2 = var_export($collection);

		$cli->output($v2);
		$cli->output("colitemID:" );
		$cli->output($collection->ID);
		
	}*/
		
	//write to file
	/*$myFile = "testWrite.php";
	$fh = fopen($myFile, 'w') or die("can't open file");
	$stringData = "Floppy Jalopy\n";
	fwrite($fh, $stringData);
	fclose($fh);*/
	 
	//$cli->output("NumberCollections:  ".$numberOfCollections );
	//$cli->output($v );
	
 
$script->shutdown();
 
?>

I have installed the extension http://projects.ez.no/cie which works well, however have tried running the cronjob and doenst work, I get errors.

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

eZ debug

Timing: Jan 18 2025 16:21:57
Script start
Timing: Jan 18 2025 16:21:57
Module start 'layout'
Timing: Jan 18 2025 16:21:57
Module start 'content'
Timing: Jan 18 2025 16:21:58
Module end 'content'
Timing: Jan 18 2025 16:21:58
Script end

Main resources:

Total runtime1.3328 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 589.3047152.6563
Module start 'layout' 0.00490.0020 741.960939.5078
Module start 'content' 0.00691.3241 781.4688411.6563
Module end 'content' 1.33100.0018 1,193.12508.0938
Script end 1.3328  1,201.2188 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.2320160.0002
Check MTime0.00120.0935160.0001
Mysql Total
Database connection0.00090.065610.0009
Mysqli_queries1.295297.1794460.0282
Looping result0.00060.0426440.0000
Template Total1.303297.820.6516
Template load0.00240.180420.0012
Template processing1.300897.598220.6504
Template load and register function0.00020.015210.0002
states
state_id_array0.00100.075210.0010
state_identifier_array0.00440.330120.0022
Override
Cache load0.00180.1370120.0002
Sytem overhead
Fetch class attribute can translate value0.00070.049110.0007
Fetch class attribute name0.00080.063810.0008
XML
Image XML parsing0.00010.008310.0001
class_abstraction
Instantiating content class attribute0.00000.000410.0000
General
dbfile0.00060.0427100.0001
String conversion0.00000.000540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 8
 Number of unique templates used: 5

Time used to render debug report: 0.0002 secs