Saturday 14 July 2007 12:28:31 pm - 2 replies
Modified on Saturday 14 July 2007 12:28:59 pm by H-Works Agency
Kristof Coomans
Sunday 15 July 2007 5:10:41 am
Hello Martin
You probably need to log in as a user that haves the right policies to remove the nodes.
See http://ezpedia.org/wiki/en/ez/command_line_scripts for a generic script example. One option is to use
$useStandardOptions = array( 'user' => true );
Afterwards, you can specify login and password on the command line with --login and --password
If you want to run the script from cron, you're probably better off with the second option:
include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' ); $user = eZUser::fetchByName( 'admin' ); $userID = $user->attribute( 'contentobject_id' ); eZUser::setCurrentlyLoggedInUser( $user, $userID );
independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org
H-Works Agency
Monday 16 July 2007 5:08:26 am
Thanks - in fact it has to do with the rights management thru cronjobs.
I putted this code at the start of my script and it seems to work :
include_once('kernel/classes/datatypes/ezuser/ezuser.php'); $ini =& eZINI::instance(); $userCreatorID = $ini->variable( "UserSettings", "UserCreatorID" ); $user = eZUser::fetch($userCreatorID); if(!$user) { $cli->error("Cannot get user object by userID = '$userCreatorID'. See site.ini[UserSettings].UserCreatorID"); $script->shutdown(1); } // Login eZUser::setCurrentlyLoggedInUser($user, $userCreatorID);
EZP is Great
You must be logged in to post messages in this topic!