Author Topic

Jack Rackham

Thursday 29 September 2005 6:05:09 am

Comment32268

It's a praise error on line 46 in your latest version of this script

"v 2" works

#!/usr/bin/env php
<?php
include_once( 'kernel/classes/ezcontentobjecttreenode.php' );
include_once( 'kernel/classes/ezcontentobject.php' );
include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' );

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

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

$script->startup();

$script->initialize();

/**
 * @param array $classID
 * @param int $parentNodeID
 * @param int $depth
 */
function &deleteNodes ( $classID, $parentNodeID, $depth )
{	
	eZUser::loginUser( 'admin', '1234' );
	
	$deleteIDArray = array();

	$nodeArray =& eZContentObjectTreeNode::subTree(  array(
															'ClassFilterType' => 'include',
															'ClassFilterArray' => $classID,
															'Depth' => $depth,
															), $parentNodeID
													);
	foreach ( $nodeArray as $node )
	{
		$deleteIDArray[] = $node->attribute( 'main_node_id' );
	}

	eZContentObjectTreeNode::removeSubtrees( $deleteIDArray, false );
}


deleteNodes ( array( 2 ), 2, 1 );

$script->shutdown();
?>