$replies = $interactiveQuestion->askQuestionMultipleChoices( 'Choose publisher folders you want to purge', $folders, 'validateReplyMultiple', true ); } if ( !empty( $replies ) ) { foreach ( $replies as $key ) { try { $publisherFolderPath = $folders[$key]; $publisherFolderNode = PublisherFolderTool::getPublisherFolderNodeFromPath ( $publisherFolderPath ); if ( !($publisherFolderNode instanceof eZContentObjectTreeNode) ) { $cli->error("Publisher folder $publisherFolderPath doesn't exist in eZPublish"); continue; } $offset = 0; $limit = 50; $i = 0; $j = 0; $cli->notice("Starting purge of publisher folder $publisherFolderPath."); while( true )
/** * @param string $publisherFolderPath * @param integer $priority * @return array */ public static function indexContent( $publisherFolderPath, $priority = 10 ) { try { $publisherFolderNode = PublisherFolderTool::getPublisherFolderNodeFromPath ( $publisherFolderPath ); if ( !($publisherFolderNode instanceof eZContentObjectTreeNode) ) { return array( 'errorCode' => 2, 'errorMsg' => "Publisher folder $publisherFolderPath doesn't exist in eZPublish" ); } $subtreePath = $publisherFolderNode->attribute('path_string'); $db = eZDB::instance(); $limit = 200; $offset = 0; $selectQuery = "SELECT contentobject_id from ezcontentobject_tree WHERE path_string LIKE '%s%%' LIMIT %s,%s"; $insertQuery = "INSERT INTO ezpending_actions (action, created, param, param_int) VALUES %s"; $i = 0; while ( true ) { $insertArray = array(); $results = $db->arrayQuery( sprintf( $selectQuery, $subtreePath, $offset, $limit ) ); if ( !$results || count($results) == 0 ) break; $i+= count($results); foreach ( $results as $result ) $insertArray[] = sprintf( "('index_object',%s,'%s', %s)", time(), $result['contentobject_id'], $priority ); if ( count($insertArray) > 0 ) $db->query( sprintf( $insertQuery, implode(',', $insertArray) ) ); $offset+= $limit; } eZContentObject::clearCache(); return array( 'errorCode' => 0, 'data' => $i ); } catch ( Exception $e ) { return array( 'errorCode' => 1, 'errorMsg' => $e->getTraceAsString() . "\n" . "Error : " . $e->getMessage() . "\n" ); } }