コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /**
  * 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;
 }