/**
  * Do delete
  */
 protected function doDelete()
 {
     $this->initSettings($_REQUEST['server_id']);
     $this->settings->delete();
     // Delete communities
     include_once './Services/WebServices/ECS/classes/class.ilECSCommunitiesCache.php';
     ilECSCommunitiesCache::delete((int) $_REQUEST['server_id']);
     include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php';
     ilECSDataMappingSettings::delete((int) $_REQUEST['server_id']);
     include_once './Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
     ilECSEventQueueReader::deleteServer((int) $_REQUEST['server_id']);
     include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
     ilECSExport::deleteByServer((int) $_REQUEST['server_id']);
     include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
     ilECSImport::deleteByServer((int) $_REQUEST['server_id']);
     include_once './Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
     ilECSParticipantSettings::deleteByServer((int) $_REQUEST['server_id']);
     ilUtil::sendSuccess($this->lng->txt('ecs_setting_deleted'), true);
     $this->ctrl->redirect($this, 'overview');
 }
 /**
  * Handle export reset.
  * Delete exported econtent and create it again 
  *
  * @return bool
  * @static
  * throws ilException, ilECSConnectorException
  */
 public static function handleExportReset(ilECSSetting $server)
 {
     include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
     // Delete all export events
     $queue = new ilECSEventQueueReader($server->getServerId());
     $queue->deleteAllExportedEvents();
     // Read all local export info
     $local_econtent_ids = ilECSExport::_getAllEContentIds($server->getServerId());
     $types = self::getAllEContentTypes();
     $list = self::getAllResourceIds($server, $types, true);
     // merge in one array
     $all_remote_ids = array();
     foreach ($list as $resource_type => $remote_ids) {
         $all_remote_ids = array_merge($all_remote_ids, (array) $remote_ids);
     }
     $all_remote_ids = array_unique($all_remote_ids);
     $GLOBALS['ilLog']->write(__METHOD__ . ': Resources = ' . print_r($all_remote_ids, true));
     $GLOBALS['ilLog']->write(__METHOD__ . ': Local = ' . print_r($local_econtent_ids, true));
     foreach ($local_econtent_ids as $local_econtent_id => $local_obj_id) {
         if (!in_array($local_econtent_id, $all_remote_ids)) {
             // Delete this deprecated info
             $GLOBALS['ilLog']->write(__METHOD__ . ': Deleting deprecated econtent id ' . $local_econtent_id);
             ilECSExport::_deleteEContentIds($server->getServerId(), array($local_econtent_id));
         }
     }
     return true;
 }
Exemplo n.º 3
0
 /**
  * Delete
  */
 public function delete()
 {
     global $ilDB;
     // --- cascading delete
     include_once 'Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
     ilECSCmsData::deleteByServerId($this->getServerId());
     include_once 'Services/WebServices/ECS/classes/class.ilECSCommunityCache.php';
     ilECSCommunityCache::deleteByServerId($this->getServerId());
     include_once 'Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
     ilECSDataMappingSetting::deleteByServerId($this->getServerId());
     include_once 'Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
     ilECSEventQueueReader::deleteByServerId($this->getServerId());
     include_once 'Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
     ilECSNodeMappingAssignment::deleteByServerId($this->getServerId());
     include_once 'Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
     ilECSParticipantSetting::deleteByServerId($this->getServerId());
     include_once 'Services/WebServices/ECS/classes/class.ilECSExport.php';
     ilECSExport::deleteByServerId($this->getServerId());
     // resetting server id to flag items in imported list
     include_once 'Services/WebServices/ECS/classes/class.ilECSImport.php';
     ilECSImport::resetServerId($this->getServerId());
     $ilDB->manipulate('DELETE FROM ecs_server ' . 'WHERE server_id = ' . $ilDB->quote($this->getServerId(), 'integer'));
     $this->server_id = NULL;
     return true;
 }
 protected function dSynchronizeTrees()
 {
     include_once './Services/WebServices/ECS/classes/Tree/class.ilECSDirectoryTreeConnector.php';
     try {
         $connector = new ilECSDirectoryTreeConnector($this->getServer());
         $res = $connector->getDirectoryTrees();
         foreach ((array) $res->getLinkIds() as $cms_id) {
             include_once './Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
             include_once './Services/WebServices/ECS/classes/class.ilECSEvent.php';
             $event = new ilECSEventQueueReader($this->getServer()->getServerId());
             $event->add(ilECSEventQueueReader::TYPE_DIRECTORY_TREES, $cms_id, ilECSEvent::UPDATED);
         }
         $this->ctrl->redirect($this, 'dTrees');
     } catch (Exception $e) {
         ilUtil::sendFailure($e->getMessage(), true);
         $this->ctrl->redirect($this, 'dTrees');
     }
 }
 /**
  * Handle export reset.
  * Delete exported econtent and create it again 
  *
  * @return bool
  * @static
  * throws ilException, ilECSConnectorException
  */
 public static function handleExportReset(ilECSSetting $server)
 {
     include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
     // Delete all export events
     $queue = new ilECSEventQueueReader($server->getServerId());
     $queue->deleteAllExportedEvents();
     // Read all local export info
     $local_econtent_ids = ilECSExport::_getAllEContentIds($server->getServerId());
     $types = self::getAllEContentTypes();
     $list = self::getAllResourceIds($server, $types, true);
     // Delete all deprecated local export info
     foreach ($list as $resource_type => $remote_econtent_ids) {
         if ($remote_econtent_ids) {
             foreach ($local_econtent_ids as $econtent_id => $obj_id) {
                 if (!in_array($econtent_id, $remote_econtent_ids)) {
                     ilECSExport::_deleteEContentIds($server->getServerId(), array($econtent_id));
                 }
             }
             // Delete all with deprecated remote info
             foreach ($remote_econtent_ids as $econtent_id) {
                 if (!isset($local_econtent_ids[$econtent_id])) {
                     ilECSExport::_deleteEContentIds($server->getServerId(), array($econtent_id));
                 }
             }
         }
     }
     return true;
 }