19declare(strict_types=1);
47 $this->db =
$DIC->database();
48 $this->log =
$DIC->logger()->wsrv();
49 $this->eventHandler =
$DIC->event();
62 return self::$instances[$a_server_id] ?? (self::$instances[$a_server_id] =
90 $this->log->warning(
'Cannot start ecs task execution: ' . $exc->getMessage());
102 $this->event_reader->refresh();
111 if (!$event = $this->event_reader->shift()) {
112 $this->log->info(__METHOD__ .
': No more pending events found. DONE');
116 $this->log->info(
"Eventdump" . print_r($event,
true));
120 $event_ignored =
false;
121 switch ($event[
'type']) {
132 $this->log->debug(
"got handler " . get_class(
$handler));
134 $this->log->error(
"Could not get handler for :" . $event[
'type']);
139 $this->log->debug(
'Handling new cms tree event.');
152 $this->log->info(__METHOD__ .
': Ignoring event type in queue ' . $event[
'type']);
153 $event_ignored =
true;
162 $this->log->warning(
'Unknown type in queue, raising new event handling event: ' . $event[
'type']);
163 $event_ignored =
true;
165 $this->eventHandler->raise(
166 'components/ILIAS/WebServices/ECS',
168 array(
'event' => $event)
173 if ($event_ignored) {
174 $this->event_reader->deleteEvent($event[
'event_id']);
180 switch ($event[
'op']) {
189 $this->log->info(__METHOD__ .
': Handling delete. DONE');
194 $this->log->info(__METHOD__ .
': Handling create. DONE');
199 $this->log->info(__METHOD__ .
': Handling update. DONE');
203 $this->log->info(__METHOD__ .
': Unknown event operation in queue ' . $event[
'op']);
208 $this->log->info(__METHOD__ .
': Processing of event done ' . $event[
'event_id']);
209 $this->event_reader->deleteEvent($event[
'event_id']);
211 $this->log->info(__METHOD__ .
': Processing of event failed ' . $event[
'event_id']);
221 $query =
"SELECT usr_id FROM usr_data WHERE auth_mode = 'ecs' " .
222 "AND time_limit_until < " . time() .
" " .
223 "AND time_limit_unlimited = 0 " .
224 "AND (time_limit_until - time_limit_from) < 7200";
225 $res = $this->db->query($query);
228 $this->log->info(__METHOD__ .
': Deleting deprecated ECS user account ' . $user_obj->getLogin());
238 $this->mids = array();
241 foreach ($reader->getCommunities() as $com) {
242 foreach ($com->getParticipants() as $part) {
243 if ($part->isSelf()) {
244 $this->mids[] = $part->getMID();
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 getInstanceByServerId(int $a_server_id)
Get singleton instance per server.
getServer()
Get server setting.
__construct(ilECSSetting $setting)
Singleton constructor.
startTaskExecution()
Start Tasks.
handleEvents()
Handle events.
ilAppEventHandler $eventHandler
static _getInstanceByServerId($a_server_id)
get singleton instance Private access use ilECSTaskScheduler::start() or ilECSTaskScheduler::startTas...
ilECSEventQueueReader $event_reader
handleDeprecatedAccounts()
Delete deprecate ECS accounts.
readMIDs()
Read MID's of this installation.
readEvents()
Read EContent.
Base class for ILIAS Exception handling.
Component logger with individual log levels by component id.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstanceByEventType(string $a_type)
Get instance by ilECSEvent(QueueReader) type.