65 $this->log =
$GLOBALS[
'DIC']->logger()->wsrv();
67 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSetting.php');
85 if (self::$instances[$a_server_id]) {
86 return self::$instances[$a_server_id];
88 include_once
'./Services/WebServices/ECS/classes/class.ilECSSetting.php';
89 return self::$instances[$a_server_id] =
100 include_once
'./Services/Context/classes/class.ilContext.php';
105 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
107 foreach ($servers->getServers() as
$server) {
109 if ($sched->checkNextExecution()) {
110 $sched->initNextExecution();
120 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
124 $sched->startTaskExecution();
157 $this->log->warning(
'Cannot start ecs task execution: ' . $exc->getMessage());
172 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
174 $this->event_reader->refresh();
188 include_once
'./Services/WebServices/ECS/classes/class.ilECSEvent.php';
190 for (
$i = 0;
$i < self::MAX_TASKS;
$i++) {
191 if (!$event = $this->event_reader->shift()) {
192 $this->log->write(__METHOD__ .
': No more pending events found. DONE');
196 $this->log->write(print_r($event,
true));
200 $event_ignored =
false;
201 switch ($event[
'type']) {
210 include_once
'Services/WebServices/ECS/classes/class.ilRemoteObjectBase.php';
212 $this->log->write(
"got handler " . get_class(
$handler));
216 $this->log->debug(
'Handling new cms tree event.');
217 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsTreeCommandQueueHandler.php';
222 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCmsCourseCommandQueueHandler.php';
227 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCmsCourseMemberCommandQueueHandler.php';
232 $this->log->write(__METHOD__ .
': Ignoring event type in queue ' . $event[
'type']);
233 $event_ignored =
true;
237 include_once
'./Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatusCommandQueueHandler.php';
243 $this->log->warning(
'Unknown type in queue, raising new event handling event: ' . $event[
'type']);
244 $event_ignored =
true;
246 $GLOBALS[
'DIC'][
'ilAppEventHandler']->raise(
247 'Services/WebServices/ECS',
249 array(
'event' => $event)
254 if ($event_ignored) {
255 $this->event_reader->delete($event[
'event_id']);
260 switch ($event[
'op']) {
269 $this->log->write(__METHOD__ .
': Handling delete. DONE');
274 $this->log->write(__METHOD__ .
': Handling create. DONE');
279 $this->log->write(__METHOD__ .
': Handling update. DONE');
283 $this->log->write(__METHOD__ .
': Unknown event operation in queue ' . $event[
'op']);
287 $this->log->write(__METHOD__ .
': Processing of event done ' . $event[
'event_id']);
288 $this->event_reader->delete($event[
'event_id']);
290 $this->log->write(__METHOD__ .
': Processing of event failed ' . $event[
'event_id']);
305 $ilDB = $DIC[
'ilDB'];
307 $query =
"SELECT usr_id FROM usr_data WHERE auth_mode = 'ecs' " .
308 "AND time_limit_until < " . time() .
" " .
309 "AND time_limit_unlimited = 0 " .
310 "AND (time_limit_until - time_limit_from) < 7200";
314 $this->log->write(__METHOD__ .
': Deleting deprecated ECS user account ' . $user_obj->getLogin());
332 $this->mids = array();
334 include_once(
'./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
336 foreach (
$reader->getCommunities() as $com) {
337 foreach ($com->getParticipants() as $part) {
338 if ($part->isSelf()) {
339 $this->mids[] = $part->getMID();
359 $ilDB = $DIC[
'ilDB'];
362 if (!$this->
settings->isEnabled()) {
366 if (!$this->
settings->checkImportId()) {
367 $this->log->warning(
'Import ID is deleted or not of type "category". Aborting');
370 if (!$this->
settings->getPollingTime()) {
377 $query =
'UPDATE settings SET ' .
378 'value = ' .
$ilDB->quote(time() + $this->
settings->getPollingTime(),
'text') .
' ' .
379 'WHERE module = ' .
$ilDB->quote(
'ecs',
'text') .
' ' .
380 'AND keyword = ' .
$ilDB->quote(
'next_execution_' . $this->
settings->getServerId(),
'text') .
' ' .
381 'AND value < ' .
$ilDB->quote(time(),
'text');
386 if (!$affected_rows) {
404 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
407 $soap_client->setResponseTimeout(1);
408 $soap_client->enableWSDL(
true);
413 if ($soap_client->init()
and 0) {
414 $this->log->info(
'Calling soap handleECSTasks method...');
415 $res = $soap_client->call(
'handleECSTasks', array($new_session_id .
'::' .
$client_id,$this->
settings->getServerId()));
417 $this->log->info(
'SOAP call failed. Calling clone method manually. ');
418 include_once(
'./webservice/soap/include/inc.soap_functions.php');
const TYPE_REMOTE_CATEGORY
static startExecution()
Static version iterates over all active instances.
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
readMIDs()
Read MID's of this installation.
getServer()
Get server setting.
static getInstance()
Get singleton instance.
static handleECSTasks($sid, $a_server_id)
readEvents()
Read EContent.
static getInstanceByEventType($a_type)
Get instance by ilECSEvent(QueueReader) type.
handleEvents()
Handle events.
startTaskExecution()
Start Tasks.
handleDeprecatedAccounts()
Delete deprecate ECS accounts.
Synchronize member assignments.
static start()
Start task scheduler for each server instance.
const TYPE_DIRECTORY_TREES
foreach($_POST as $key=> $value) $res
Reads ECS events and stores them in the database.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
const TYPE_REMOTE_LEARNING_MODULE
initNextExecution()
Call next task scheduler run.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
checkNextExecution()
Start.
const TYPE_CMS_COURSE_MEMBERS
const TYPE_REMOTE_GLOSSARY
static _duplicate($a_session_id)
Duplicate session.
__construct(ilECSSetting $setting)
Singleton constructor.
static getType()
Get context type.
const TYPE_ENROLMENT_STATUS
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.