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';
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']) {
268 $res = $handler->handleDelete($this->
getServer(), $event[
'id'], $this->mids);
269 $this->log->write(__METHOD__ .
': Handling delete. DONE');
273 $res = $handler->handleCreate($this->
getServer(), $event[
'id'], $this->mids);
274 $this->log->write(__METHOD__ .
': Handling create. DONE');
278 $res = $handler->handleUpdate($this->
getServer(), $event[
'id'], $this->mids);
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']);
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();
362 if (!$this->
settings->isEnabled()) {
366 if (!$this->
settings->checkImportId()) {
367 $this->log->warning(
'Import ID is deleted or not of type "category". Aborting');
374 $query =
'UPDATE settings SET ' .
375 'value = ' .
$ilDB->quote(time() + $this->
settings->getPollingTime(),
'text') .
' ' .
376 'WHERE module = ' .
$ilDB->quote(
'ecs',
'text') .
' ' .
377 'AND keyword = ' .
$ilDB->quote(
'next_execution_' . $this->
settings->getServerId(),
'text') .
' ' .
378 'AND value < ' .
$ilDB->quote(time(),
'text');
383 if (!$affected_rows) {
401 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
404 $soap_client->setResponseTimeout(1);
405 $soap_client->enableWSDL(
true);
410 if ($soap_client->init() and 0) {
411 $this->log->info(
'Calling soap handleECSTasks method...');
412 $res = $soap_client->call(
'handleECSTasks', array($new_session_id .
'::' .
$client_id,$this->
settings->getServerId()));
414 $this->log->info(
'SOAP call failed. Calling clone method manually. ');
415 include_once(
'./webservice/soap/include/inc.soap_functions.php');
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
static getType()
Get context type.
Synchronize member assignments.
Reads ECS events and stores them in the database.
const TYPE_REMOTE_GLOSSARY
const TYPE_REMOTE_LEARNING_MODULE
const TYPE_DIRECTORY_TREES
const TYPE_REMOTE_CATEGORY
const TYPE_CMS_COURSE_MEMBERS
const TYPE_ENROLMENT_STATUS
static getInstance()
Get singleton instance.
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
getServer()
Get server setting.
__construct(ilECSSetting $setting)
Singleton constructor.
initNextExecution()
Call next task scheduler run.
startTaskExecution()
Start Tasks.
handleEvents()
Handle events.
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
static start()
Start task scheduler for each server instance.
handleDeprecatedAccounts()
Delete deprecate ECS accounts.
static startExecution()
Static version iterates over all active instances.
readMIDs()
Read MID's of this installation.
readEvents()
Read EContent.
checkNextExecution()
Start.
Base class for ILIAS Exception handling.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstanceByEventType($a_type)
Get instance by ilECSEvent(QueueReader) type.
static _duplicate($a_session_id)
Duplicate session.
static handleECSTasks($sid, $a_server_id)
foreach($_POST as $key=> $value) $res