Wednesday 29 June 2011 2:47:59 pm
By : Steven E. Bailey
I had to find objects that had multiple locations for a client. This is what I came up with:
<?php require 'autoload.php'; $cli = eZCLI::instance(); $script = eZScript::instance( array( 'description' => ( "finds double-published objects" ), 'use-session' => true, 'use-modules' => true, 'use-extensions' => true ) ); $script->startup(); $options = $script->getOptions( "", "[topNodeID]", array() ); $script->initialize(); $params['MainNodeOnly'] = true; $params['IgnoreVisibility'] = true; $topNodeID = ctype_digit($options["arguments"][0]) ? $options["arguments"][0] : 2; $objects = eZContentObjectTreeNode::subTreeByNodeID( $params, $topNodeID ); foreach($objects as $object) { $parents=eZContentObjectTreeNode::getParentNodeIdListByContentObjectID( $object->ContentObject->ID ); if (count($parents) != 1 ) { echo $object->attribute( 'path_identification_string')."\n"; } } $script->shutdown(); ?>