62 $this->log =
$GLOBALS[
'DIC']->logger()->wsrv();
64 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSetting.php');
82 if(self::$instances[$a_server_id])
84 return self::$instances[$a_server_id];
86 include_once
'./Services/WebServices/ECS/classes/class.ilECSSetting.php';
87 return self::$instances[$a_server_id] =
98 include_once
'./Services/Context/classes/class.ilContext.php';
104 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
106 foreach($servers->getServers() as
$server)
109 if($sched->checkNextExecution())
111 $sched->initNextExecution();
121 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
126 $sched->startTaskExecution();
160 $this->log->warning(
'Cannot start ecs task execution: ' . $exc->getMessage());
176 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
178 $this->event_reader->refresh();
194 include_once
'./Services/WebServices/ECS/classes/class.ilECSEvent.php';
196 for($i = 0;$i < self::MAX_TASKS;$i++)
198 if(!$event = $this->event_reader->shift())
200 $this->log->write(__METHOD__.
': No more pending events found. DONE');
204 $this->log->write(print_r($event,
true));
208 $event_ignored =
false;
209 switch($event[
'type'])
219 include_once
'Services/WebServices/ECS/classes/class.ilRemoteObjectBase.php';
221 $this->log->write(
"got handler ".get_class($handler));
225 $this->log->debug(
'Handling new cms tree event.');
226 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsTreeCommandQueueHandler.php';
231 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCmsCourseCommandQueueHandler.php';
236 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCmsCourseMemberCommandQueueHandler.php';
241 $this->log->write(__METHOD__.
': Ignoring event type in queue '.$event[
'type']);
242 $event_ignored =
true;
246 include_once
'./Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatusCommandQueueHandler.php';
252 $this->log->warning(
'Unknown type in queue, raising new event handling event: '. $event[
'type']);
253 $event_ignored =
true;
255 $GLOBALS[
'ilAppEventHandler']->raise(
256 'Services/WebServices/ECS',
258 array(
'event' => $event)
265 $this->event_reader->delete($event[
'event_id']);
279 $res = $handler->handleDelete($this->
getServer(), $event[
'id'],$this->mids);
280 $this->log->write(__METHOD__.
': Handling delete. DONE');
284 $res = $handler->handleCreate($this->
getServer(), $event[
'id'], $this->mids);
285 $this->log->write(__METHOD__.
': Handling create. DONE');
289 $res = $handler->handleUpdate($this->
getServer(), $event[
'id'], $this->mids);
290 $this->log->write(__METHOD__.
': Handling update. DONE');
294 $this->log->write(__METHOD__.
': Unknown event operation in queue '.$event[
'op']);
299 $this->log->write(__METHOD__.
': Processing of event done '.$event[
'event_id']);
300 $this->event_reader->delete($event[
'event_id']);
304 $this->log->write(__METHOD__.
': Processing of event failed '.$event[
'event_id']);
319 $query =
"SELECT usr_id FROM usr_data WHERE auth_mode = 'ecs' ".
320 "AND time_limit_until < ".time().
" ".
321 "AND time_limit_unlimited = 0 ".
322 "AND (time_limit_until - time_limit_from) < 7200";
328 $this->log->write(__METHOD__.
': Deleting deprecated ECS user account '.$user_obj->getLogin());
347 $this->mids =
array();
349 include_once(
'./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
351 foreach(
$reader->getCommunities() as $com)
353 foreach($com->getParticipants() as $part)
357 $this->mids[] = $part->getMID();
385 if(!$this->
settings->checkImportId())
387 $this->log->warning(
'Import ID is deleted or not of type "category". Aborting');
394 $query =
'UPDATE settings SET '.
395 'value = '.$ilDB->quote(
time() + $this->
settings->getPollingTime(),
'text').
' '.
396 'WHERE module = '.$ilDB->quote(
'ecs',
'text').
' '.
397 'AND keyword = '.$ilDB->quote(
'next_execution_'.$this->
settings->getServerId(),
'text').
' '.
398 'AND value < '.$ilDB->quote(
time(),
'text');
399 $affected_rows = $ilDB->manipulate(
$query);
420 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
423 $soap_client->setResponseTimeout(1);
424 $soap_client->enableWSDL(
true);
429 if($soap_client->init()
and 0)
431 $this->log->info(
'Calling soap handleECSTasks method...');
432 $res = $soap_client->call(
'handleECSTasks',
array($new_session_id.
'::'.
$client_id,$this->settings->getServerId()));
436 $this->log->info(
'SOAP call failed. Calling clone method manually. ');
437 include_once(
'./webservice/soap/include/inc.soap_functions.php');
const TYPE_REMOTE_CATEGORY
static startExecution()
Static version iterates over all active instances.
Base class for ILIAS Exception handling.
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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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
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
Create styles array
The data for the language used.
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.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static getType()
Get context type.
const TYPE_ENROLMENT_STATUS