59 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSetting.php');
60 $this->settings = $setting;
77 if(self::$instances[$a_server_id])
79 return self::$instances[$a_server_id];
81 include_once
'./Services/WebServices/ECS/classes/class.ilECSSetting.php';
82 return self::$instances[$a_server_id] =
93 include_once
'./Services/Context/classes/class.ilContext.php';
99 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
101 foreach($servers->getServers() as
$server)
104 if($sched->checkNextExecution())
106 $sched->initNextExecution();
116 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
121 $sched->startTaskExecution();
155 $this->log->write(__METHOD__.
': Caught exception: '.$exc->getMessage());
171 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
173 $this->event_reader->refresh();
189 include_once
'./Services/WebServices/ECS/classes/class.ilECSEvent.php';
193 if(!$event = $this->event_reader->shift())
195 $this->log->write(__METHOD__.
': No more pending events found. DONE');
199 $this->log->write(print_r($event,
true));
203 $event_ignored =
false;
204 switch($event[
'type'])
214 include_once
'Services/WebServices/ECS/classes/class.ilRemoteObjectBase.php';
216 $this->log->write(
"got handler ".get_class($handler));
220 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsTreeCommandQueueHandler.php';
225 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCmsCourseCommandQueueHandler.php';
230 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCmsCourseMemberCommandQueueHandler.php';
235 $this->log->write(__METHOD__.
': Ignoring event type in queue '.$event[
'type']);
236 $event_ignored =
true;
240 include_once
'./Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatusCommandQueueHandler.php';
245 $this->log->write(__METHOD__.
': Unknown event type in queue '.$event[
'type']);
246 $event_ignored =
true;
252 $this->event_reader->delete($event[
'event_id']);
266 $res = $handler->handleDelete($this->
getServer(), $event[
'id'],$this->mids);
267 $this->log->write(__METHOD__.
': Handling delete. DONE');
271 $res = $handler->handleCreate($this->
getServer(), $event[
'id'], $this->mids);
272 $this->log->write(__METHOD__.
': Handling create. DONE');
276 $res = $handler->handleUpdate($this->
getServer(), $event[
'id'], $this->mids);
277 $this->log->write(__METHOD__.
': Handling update. DONE');
281 $this->log->write(__METHOD__.
': Unknown event operation in queue '.$event[
'op']);
286 $this->log->write(__METHOD__.
': Processing of event done '.$event[
'event_id']);
287 $this->event_reader->delete($event[
'event_id']);
291 $this->log->write(__METHOD__.
': Processing of event failed '.$event[
'event_id']);
306 $query =
"SELECT usr_id FROM usr_data WHERE auth_mode = 'ecs' ".
307 "AND time_limit_until < ".time().
" ".
308 "AND time_limit_unlimited = 0 ".
309 "AND (time_limit_until - time_limit_from) < 7200";
315 $this->log->write(__METHOD__.
': Deleting deprecated ECS user account '.$user_obj->getLogin());
334 $this->mids = array();
336 include_once(
'./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
338 foreach(
$reader->getCommunities() as $com)
340 foreach($com->getParticipants() as $part)
344 $this->mids[] = $part->getMID();
345 #$this->log->write('Fetch MID: '.$part->getMID());
368 if(!$this->settings->isEnabled())
373 if(!$this->settings->checkImportId())
375 $this->log->write(__METHOD__.
': Import ID is deleted or not of type "category". Aborting');
382 $query =
'UPDATE settings SET '.
383 'value = '.$ilDB->quote(time() + $this->settings->getPollingTime(),
'text').
' '.
384 'WHERE module = '.$ilDB->quote(
'ecs',
'text').
' '.
385 'AND keyword = '.$ilDB->quote(
'next_execution_'.$this->settings->getServerId(),
'text').
' '.
386 'AND value < '.$ilDB->quote(time(),
'text');
387 $affected_rows = $ilDB->manipulate(
$query);
408 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
411 $soap_client->setResponseTimeout(1);
412 $soap_client->enableWSDL(
true);
414 #$ilLog->write(__METHOD__.': Trying to call Soap client...');
418 if($soap_client->init() and 0)
420 $ilLog->write(__METHOD__.
': Calling soap handleECSTasks method...');
421 $res = $soap_client->call(
'handleECSTasks',array($new_session_id.
'::'.
$client_id,$this->settings->getServerId()));
425 $ilLog->write(__METHOD__.
': SOAP call failed. Calling clone method manually. ');
426 include_once(
'./webservice/soap/include/inc.soap_functions.php');