Run Kernel module from CLI

Author Message

SiXTy

Friday 04 November 2005 11:45:44 pm

Hi.
I wrote script for importing XML data and got a little problem with it. When I call it as Kernel module, it's ok, but from CLI, there's a problem with connecting to db eye think....I'v tried to call eZContentClass::fetch() or fetchList(), but it returned an empty object...
Can somebody help me?
Thanks!
E.

Ɓukasz Serwatka

Saturday 05 November 2005 7:05:34 am

Hi,

Look on example scripts in /bin/php/*.php this will give you some overview how to build CLI script.

Small example:

include_once( 'lib/ezutils/classes/ezcli.php' );
include_once( 'kernel/classes/ezscript.php' );

$cli =& eZCLI::instance();
$script =& eZScript::instance();

$script->startup();

$script->initialize();

//Your code goes here
// include_once( 'lib/ezdb/classes/ezdb.php' );
// $db= =& eZDB::instance()
// $result = $db->arrayQuery("SELECT * ...");

$script->shutdown();

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

SiXTy

Saturday 05 November 2005 7:39:08 am

I'm using eZScript class already, but something is still wrong...And I can't figure out what's that...
E.

SiXTy

Saturday 05 November 2005 11:09:01 am

I've figured it out...the script has to be in eZPublish root...

Kristof Coomans

Saturday 12 November 2005 1:42:31 am

The script doesn't need to be in the eZ publish root dir, it only needs to be executed from the eZ publish root directory.

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

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:14:35
Script start
Timing: Jan 18 2025 16:14:35
Module start 'layout'
Timing: Jan 18 2025 16:14:35
Module start 'content'
Timing: Jan 18 2025 16:14:36
Module end 'content'
Timing: Jan 18 2025 16:14:36
Script end

Main resources:

Total runtime0.9349 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 587.9141152.6250
Module start 'layout' 0.00550.0037 740.539139.4453
Module start 'content' 0.00920.9241 779.9844599.8047
Module end 'content' 0.93340.0015 1,379.789112.4766
Script end 0.9349  1,392.2656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3650160.0002
Check MTime0.00140.1529160.0001
Mysql Total
Database connection0.00090.097210.0009
Mysqli_queries0.880994.2164650.0136
Looping result0.00060.0660630.0000
Template Total0.901596.420.4507
Template load0.00220.230620.0011
Template processing0.899396.185420.4496
Template load and register function0.00020.022410.0002
states
state_id_array0.00100.112010.0010
state_identifier_array0.00160.166620.0008
Override
Cache load0.00180.1910220.0001
Sytem overhead
Fetch class attribute can translate value0.00090.096830.0003
Fetch class attribute name0.00150.164470.0002
XML
Image XML parsing0.00130.142330.0004
class_abstraction
Instantiating content class attribute0.00000.003370.0000
General
dbfile0.00200.2148240.0001
String conversion0.00000.001240.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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/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: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs