/** * Reread all imported econtent. * * @return bool * @static * throws ilException, ilECSConnectorException */ public static function handleImportReset(ilECSSetting $server) { global $ilLog; include_once 'Services/WebServices/ECS/classes/class.ilECSConnector.php'; include_once 'Services/WebServices/ECS/classes/class.ilECSConnectorException.php'; try { include_once './Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php'; include_once './Services/WebServices/ECS/classes/class.ilECSImport.php'; include_once './Services/WebServices/ECS/classes/class.ilECSExport.php'; $types = self::getAllEContentTypes(); $event_queue = new ilECSEventQueueReader($server->getServerId()); $event_queue->deleteAllEContentEvents($types); $list = self::getAllResourceIds($server, $types); $imported = ilECSImport::_getAllImportedLinks($server->getServerId()); foreach ($list as $resource_type => $link_ids) { foreach ($links_ids as $link_id) { if (!isset($imported[$link_id])) { // Add create event for not imported econtent $event_queue->add($resource_type, $link_id, ilECSEvent::CREATED); } else { // Add update event for already existing events $event_queue->add($resource_type, $link_id, ilECSEvent::UPDATED); } if (isset($imported[$link_id])) { unset($imported[$link_id]); } } } if (is_array($imported)) { // Delete event for deprecated econtent include_once 'Services/WebServices/ECS/classes/class.ilECSObjectSettings.php'; foreach ($imported as $econtent_id => $obj_id) { $type = self::getEventTypeFromObjectType(ilObject::_lookupType($obj_id)); if ($type) { $event_queue->add($type, $econtent_id, ilECSEvent::DESTROYED); } } } } catch (ilECSConnectorException $e1) { $ilLog->write('Cannot connect to ECS server: ' . $e1->getMessage()); throw $e1; } catch (ilException $e2) { $ilLog->write('Update failed: ' . $e2->getMessage()); throw $e2; } return true; }