63 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSettings.php');
103 $this->log->write(__METHOD__.
': Caught exception: '.$exc->getMessage());
119 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
121 $this->event_reader->refresh();
141 if(!$event = $this->event_reader->shift())
143 $this->log->write(__METHOD__.
': No more pending events found.');
164 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContentReader.php');
169 $this->log->write(__METHOD__.
': Cannot read Econtent. '.$e->getMessage());
175 $this->log->write(__METHOD__.
': Deleting deprecated remote course.');
181 $this->log->write(__METHOD__.
': Starting update of remote courses.');
191 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
192 include_once(
'./Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
193 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEContentReader.php');
194 include_once(
'./Services/WebServices/ECS/classes/class.ilECSReaderException.php');
195 include_once(
'./Services/WebServices/ECS/classes/class.ilECSContentWriter.php');
196 include_once(
'./Services/WebServices/ECS/classes/class.ilECSContentWriterException.php');
200 $econtent_id = $export->getEContentId();
206 foreach(
$reader->getEContent() as $econtent)
210 $ilLog->write(__METHOD__.
': Cannot create object instance. Aborting...');
214 $writer->setExportable(
false);
215 $writer->setOwnerId($econtent->getOwner());
216 $writer->setParticipantIds($econtent->getEligibleMembers());
220 $writer->setExportable(
true);
229 $ilLog->write(__METHOD__.
': Cannot handle create event. Message: '.$e1->getMessage());
234 $ilLog->write(__METHOD__.
': Cannot handle create event. Message: '.$e2->getMessage());
239 $ilLog->write(__METHOD__.
': Cannot handle create event. Message: '.$e2->getMessage());
255 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
265 foreach($obj_ids as $obj_id)
268 foreach($references as
$ref_id)
272 $this->log->write(__METHOD__.
': Deleting obsolete remote course: '.$tmp_obj->getTitle());
274 $tree->deleteTree($tree->getNodeData($ref_id));
295 include_once(
'./Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php');
298 $ilLog->write(
'Ignoring disabled participant. MID: '.$content->getOwner());
302 include_once(
'Services/WebServices/ECS/classes/class.ilECSImport.php');
305 foreach(array_intersect($this->mids,$content->getEligibleMembers()) as $mid)
311 if($remote->getType() !=
'rcrs')
313 $this->log->write(__METHOD__.
': Cannot instantiate remote course. Got object type '.$remote->getType());
316 $ilLog->write(__METHOD__.
': ... update called.');
317 $remote->updateFromECSContent($content);
321 $ilLog->write(__METHOD__.
': ... create called.');
322 include_once(
'./Modules/RemoteCourse/classes/class.ilObjRemoteCourse.php');
327 foreach(array_diff(
ilECSImport::_lookupMIDs($content->getEContentId()),$content->getEligibleMembers()) as $deprecated)
329 $this->
handleDelete($content->getEContentId(),$deprecated);
344 $query =
"SELECT usr_id FROM usr_data WHERE auth_mode = 'ecs' ".
345 "AND time_limit_until < ".time().
" ".
346 "AND time_limit_unlimited = 0 ".
347 "AND (time_limit_until - time_limit_from) < 7200";
353 $this->log->write(__METHOD__.
': Deleting deprecated ECS user account '.$user_obj->getLogin());
372 $this->mids = array();
374 include_once(
'./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
376 foreach(
$reader->getCommunities() as $com)
378 foreach($com->getParticipants() as $part)
382 $this->mids[] = $part->getMID();
383 $this->log->write(
'Fetch MID: '.$part->getMID());
405 if(!$this->settings->isEnabled())
410 if(!$this->settings->checkImportId())
412 $this->log->write(__METHOD__.
': Import ID is deleted or not of type "category". Aborting');
422 $time = $sett->get(
"next_execution");
423 if(time() < ($time + $this->settings->getPollingTime()))
429 $sett->set(
"next_execution", time() + $this->settings->getPollingTime());
431 $this->log->write(__METHOD__.
': Starting ECS tasks.');
437 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
439 $soap_client =
new ilSoapClient();
440 $soap_client->setTimeout(1);
441 $soap_client->setResponseTimeout(1);
442 $soap_client->enableWSDL(
true);
444 $ilLog->write(__METHOD__.
': Trying to call Soap client...');
448 if($soap_client->init())
450 $ilLog->write(__METHOD__.
': Calling soap handleECSTasks method...');
451 $res = $soap_client->call(
'handleECSTasks',array($new_session_id.
'::'.
$client_id));
455 $ilLog->write(__METHOD__.
': SOAP call failed. Calling clone method manually. ');
456 include_once(
'./webservice/soap/include/inc.soap_functions.php');