Forums / Developer / Run Kernel module from CLI

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

eZ debug

Timing: Jan 18 2025 18:27:06
Script start
Timing: Jan 18 2025 18:27:06
Module start 'content'
Timing: Jan 18 2025 18:27:07
Module end 'content'
Timing: Jan 18 2025 18:27:07
Script end

Main resources:

Total runtime0.8342 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0098 587.7109180.8359
Module start 'content' 0.00990.6440 768.5469604.8828
Module end 'content' 0.65390.1802 1,373.4297337.6875
Script end 0.8341  1,711.1172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00470.5583210.0002
Check MTime0.00160.1952210.0001
Mysql Total
Database connection0.00170.198810.0017
Mysqli_queries0.738888.56392020.0037
Looping result0.00240.28952000.0000
Template Total0.800295.920.4001
Template load0.00230.280320.0012
Template processing0.797995.650820.3989
Template load and register function0.00010.013710.0001
states
state_id_array0.00090.109010.0009
state_identifier_array0.00100.122320.0005
Override
Cache load0.00190.2309220.0001
Sytem overhead
Fetch class attribute can translate value0.00150.185840.0004
Fetch class attribute name0.00250.295970.0004
XML
Image XML parsing0.00220.267640.0006
class_abstraction
Instantiating content class attribute0.00000.001470.0000
General
dbfile0.01611.9306350.0005
String conversion0.00000.000930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs