62 $this->log =
$GLOBALS[
'DIC']->logger()->wsrv();
64 include_once(
'./Services/WebServices/ECS/classes/class.ilECSSetting.php');
82 if (self::$instances[$a_server_id]) {
83 return self::$instances[$a_server_id];
85 include_once
'./Services/WebServices/ECS/classes/class.ilECSSetting.php';
86 return self::$instances[$a_server_id] =
97 include_once
'./Services/Context/classes/class.ilContext.php';
102 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
104 foreach ($servers->getServers() as
$server) {
106 if ($sched->checkNextExecution()) {
107 $sched->initNextExecution();
117 include_once
'./Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
121 $sched->startTaskExecution();
152 $this->log->warning(
'Cannot start ecs task execution: ' . $exc->getMessage());
167 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
169 $this->event_reader->refresh();
183 include_once
'./Services/WebServices/ECS/classes/class.ilECSEvent.php';
186 if (!$event = $this->event_reader->shift()) {
187 $this->log->write(__METHOD__ .
': No more pending events found. DONE');
191 $this->log->write(print_r($event,
true));
195 $event_ignored =
false;
196 switch ($event[
'type']) {
205 include_once
'Services/WebServices/ECS/classes/class.ilRemoteObjectBase.php';
207 $this->log->write(
"got handler " . get_class(
$handler));
211 $this->log->debug(
'Handling new cms tree event.');
212 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsTreeCommandQueueHandler.php';
217 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCmsCourseCommandQueueHandler.php';
222 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCmsCourseMemberCommandQueueHandler.php';
227 $this->log->write(__METHOD__ .
': Ignoring event type in queue ' . $event[
'type']);
228 $event_ignored =
true;
232 include_once
'./Services/WebServices/ECS/classes/Connectors/class.ilECSEnrolmentStatusCommandQueueHandler.php';
238 $this->log->warning(
'Unknown type in queue, raising new event handling event: ' . $event[
'type']);
239 $event_ignored =
true;
241 $GLOBALS[
'ilAppEventHandler']->raise(
242 'Services/WebServices/ECS',
244 array(
'event' => $event)
249 if ($event_ignored) {
250 $this->event_reader->delete($event[
'event_id']);
255 switch ($event[
'op']) {
264 $this->log->write(__METHOD__ .
': Handling delete. DONE');
269 $this->log->write(__METHOD__ .
': Handling create. DONE');
274 $this->log->write(__METHOD__ .
': Handling update. DONE');
278 $this->log->write(__METHOD__ .
': Unknown event operation in queue ' . $event[
'op']);
282 $this->log->write(__METHOD__ .
': Processing of event done ' . $event[
'event_id']);
283 $this->event_reader->delete($event[
'event_id']);
285 $this->log->write(__METHOD__ .
': Processing of event failed ' . $event[
'event_id']);
300 $query =
"SELECT usr_id FROM usr_data WHERE auth_mode = 'ecs' " .
301 "AND time_limit_until < " . time() .
" " .
302 "AND time_limit_unlimited = 0 " .
303 "AND (time_limit_until - time_limit_from) < 7200";
307 $this->log->write(__METHOD__ .
': Deleting deprecated ECS user account ' . $user_obj->getLogin());
325 $this->mids = array();
327 include_once(
'./Services/WebServices/ECS/classes/class.ilECSCommunityReader.php');
329 foreach (
$reader->getCommunities() as $com) {
330 foreach ($com->getParticipants() as $part) {
331 if ($part->isSelf()) {
332 $this->mids[] = $part->getMID();
353 if (!$this->
settings->isEnabled()) {
357 if (!$this->
settings->checkImportId()) {
358 $this->log->warning(
'Import ID is deleted or not of type "category". Aborting');
365 $query =
'UPDATE settings SET ' .
366 'value = ' .
$ilDB->quote(time() + $this->
settings->getPollingTime(),
'text') .
' ' .
367 'WHERE module = ' . $ilDB->quote(
'ecs',
'text') .
' ' .
368 'AND keyword = ' .
$ilDB->quote(
'next_execution_' . $this->
settings->getServerId(),
'text') .
' ' .
369 'AND value < ' . $ilDB->quote(time(),
'text');
374 if (!$affected_rows) {
390 include_once
'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
393 $soap_client->setResponseTimeout(1);
394 $soap_client->enableWSDL(
true);
399 if ($soap_client->init() and 0) {
400 $this->log->info(
'Calling soap handleECSTasks method...');
401 $res = $soap_client->call(
'handleECSTasks', array($new_session_id .
'::' .
$client_id,$this->
settings->getServerId()));
403 $this->log->info(
'SOAP call failed. Calling clone method manually. ');
404 include_once(
'./webservice/soap/include/inc.soap_functions.php');
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)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
foreach($_POST as $key=> $value) $res