Author Topic

Philippe VINCENT-ROYOL

Friday 18 April 2008 5:41:06 am

Comment49384

ok i promise this is the latest question !!

Source code was on a module. But i need to place it on a cronjob.

So i've create my_import.php file ..
this is the source code:

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

include_once( 'kernel/classes/ezscript.php' );


global $cli;


$cli =& eZCLI::instance();

$script =& eZScript::instance( array( 'description' => ( "Import  Database\n" .

                                                         "\n" .

                                                         "./bin/my_import.php" ),

                                      'debug-message' => '',
                                      'debug-output' => true,
                                      'use-session' => true,
                                      'use-module' => true,
                                      'use-extension' => true ) );



$script->startup();


$scriptOptions = $script->getOptions( "",

                                      "",

                                      array(),

                                      false,

                                      array( 'user' => true )

                                     );
                                     

$script->initialize();


include_once( 'lib/ezdb/classes/ezdb.php' );
include_once( 'kernel/classes/ezcontentobjecttreenode.php' );
include_once( 'kernel/classes/ezcontentfunctions.php' );

$params = array(	'server' => 'localhost',
			'user' => 'root',
			'password' => '',
			'database' => 'FHF',
			'use_slave_server' => 'false',
			'use_persistent_connection' => false
);

$db = eZDB::instance('ezmysql', $params, true);
		
$user = eZuser::fetch( 14 );
eZuser::setCurrentLyLoggedInUser( $user, $user->attribute( 'contentobject_id' ) );
		
$nodeID = "3051";		
$node = eZcontentObjectTreeNode::fetch( $nodeID );

$attribute_node = array( 'name' => 'test');
$param_node['creator_id'] = 14;
$param_node['parent_node_id'] = $nodeID;
$param_node['class_identifier'] = 'folder';
$param_node['attributes'] = $attribute_node;			
			
$object_node = eZContentFunctions::createAndPublishObject( $param_node );

$script->shutdown(0);

and i obtain this debug:

Fatal error: Exponential did not finish its request
The execution of Exponential was abruptly ended, the debug output is present below.
Notice: (eZMySQLDB::query(0.000 ms) query number per page:0)
SET NAMES 'utf8'

Error: (eZDebug::writeFile)
Cannot open log file 'var/log/notice.log' for writing
The web server must be allowed to modify the file.
File logging for 'var/log/notice.log' is disabled.

Error: (eZDebug::writeFile)
Cannot open log file 'var/log/error.log' for writing
The web server must be allowed to modify the file.
File logging for 'var/log/error.log' is disabled.

Notice: (eZMySQLDB::query(0.000 ms) query number per page:0)
SET NAMES 'utf8'

Warning: (PHP)
Invalid argument supplied for foreach() in /var/www/hopital.fr/hopital.hopital.fr/html/lib/ezutils/classes/ezmoduleoperationinfo.php on line 70

Error: (eZDebug::writeFile)
Cannot open log file 'var/log/warning.log' for writing
The web server must be allowed to modify the file.
File logging for 'var/log/warning.log' is disabled.

Warning: (PHP)
Undefined variable:  definitionFile in /var/www/hopital.fr/hopital.hopital.fr/html/lib/ezutils/classes/ezmoduleoperationinfo.php on line 77

Error: (eZModuleOperationInfo::loadDefinition)
Missing operation definition file for module: content

Error: (eZOperationHandler::execute)
Cannot execute operation 'publish' in module 'content', no valid data

No timing points defined
Group ini_load: 
Load cache: 0.0060 sec (2.5871%), 0.0010 avg sec (6)
FindInputFiles: 0.0022 sec (0.9720%), 0.0004 avg sec (6)
Group Mysql Total: 
Mysql_queries: 0.0135 sec (5.8531%), 0.0005 avg sec (30)
Looping result: 0.0007 sec (0.3210%), 0.0001 avg sec (13)
Group class_abstraction: 
Instantiating content class attribute: 0.0010 sec (0.4349%), 0.0001 avg sec (20)
Group General: 
String conversion: 0.0000 sec (0.0186%), 0.0000 avg sec (1)

Total script time: 0.2314 sec

I've forget to initialise something? It works on module and not here :/

Thanks in advance,
Philippe

Certified Developer (4.1): http://auth.ez.no/certification/verify/272607
Certified Developer (4.4): http://auth.ez.no/certification/verify/377321

G+ : http://plus.tl/dspe
Twitter : http://twitter.com/dspe