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.