ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilECSEventQueueReader Class Reference

Reads ECS events and stores them in the database. More...

+ Collaboration diagram for ilECSEventQueueReader:

Public Member Functions

 __construct ($a_server_id)
 Constructor. More...
 
 getServer ()
 get server setting More...
 
 getEvents ()
 get all events More...
 
 deleteAll ()
 Delete all events. More...
 
 deleteAllEContentEvents (array $a_types)
 Delete all econtents. More...
 
 refresh ()
 Fetch events from fifo Using fifo public. More...
 
 shift ()
 get and delete the first event entry More...
 
 add ($a_type, $a_id, $a_op)
 add More...
 
 delete ($a_event_id)
 delete private More...
 
 read ()
 Read public. More...
 

Static Public Member Functions

static handleImportReset (ilECSSetting $server)
 Reread all imported econtent. More...
 
static handleExportReset (ilECSSetting $server)
 Handle export reset. More...
 
static deleteServer ($a_server_id)
 Delete by server id ilDB $ilDB. More...
 
static deleteByServerId ($a_server_id)
 

Data Fields

const TYPE_EXPORTED = 'exported'
 
const TYPE_DIRECTORY_TREES = 'directory_trees'
 
const TYPE_CMS_COURSES = 'courses'
 
const TYPE_CMS_COURSE_MEMBERS = 'course_members'
 
const TYPE_REMOTE_COURSE = 'rcrs'
 
const TYPE_REMOTE_CATEGORY = 'rcat'
 
const TYPE_REMOTE_FILE = 'rfil'
 
const TYPE_REMOTE_GLOSSARY = 'rglo'
 
const TYPE_REMOTE_GROUP = 'rgrp'
 
const TYPE_REMOTE_LEARNING_MODULE = 'rlm'
 
const TYPE_REMOTE_WIKI = 'rwik'
 
const TYPE_REMOTE_TEST = 'rtst'
 
const TYPE_COURSE_URLS = 'course_urls'
 
const TYPE_ENROLMENT_STATUS = 'member_status'
 

Protected Member Functions

 deleteAllExportedEvents ()
 Delete all exported events. More...
 

Static Protected Member Functions

static getEventTypeFromObjectType ($a_obj_type)
 Convert object type to event type. More...
 
static getAllEContentTypes ()
 All available content types. More...
 
static getAllResourceIds (ilECSSetting $server, array $a_types, $a_sender_only=false)
 Get all resource ids by resource type. More...
 

Protected Attributes

 $log
 
 $db
 
 $events = array()
 
 $econtent_ids = array()
 

Private Member Functions

 writeEventToDB (ilECSEvent $ev)
 Write event to db. More...
 
 update ($a_type, $a_id, $a_operation)
 update one entry More...
 

Detailed Description

Reads ECS events and stores them in the database.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 36 of file class.ilECSEventQueueReader.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSEventQueueReader::__construct (   $a_server_id)

Constructor.

public

Definition at line 64 of file class.ilECSEventQueueReader.php.

References $ilDB, $ilLog, ilECSSetting\getInstanceByServerId(), read(), and settings().

65  {
66  global $ilLog,$ilDB;
67 
68  include_once('Services/WebServices/ECS/classes/class.ilECSSetting.php');
69 
70  $this->settings = ilECSSetting::getInstanceByServerId($a_server_id);
71  $this->log = $ilLog;
72  $this->db = $ilDB;
73 
74  $this->read();
75  }
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
settings()
Definition: settings.php:2
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ add()

ilECSEventQueueReader::add (   $a_type,
  $a_id,
  $a_op 
)

add

public

Definition at line 516 of file class.ilECSEventQueueReader.php.

References $a_type, $ilDB, $query, $res, and getServer().

517  {
518  global $ilDB;
519 
520  $next_id = $ilDB->nextId('ecs_events');
521  $query = "INSERT INTO ecs_events (event_id,type,id,op,server_id) " .
522  "VALUES (" .
523  $ilDB->quote($next_id, 'integer') . ", " .
524  $this->db->quote($a_type, 'text') . ", " .
525  $this->db->quote($a_id, 'integer') . ", " .
526  $this->db->quote($a_op, 'text') . ", " .
527  $ilDB->quote($this->getServer()->getServerId(), 'integer') . ' ' .
528  ")";
529  $res = $ilDB->manipulate($query);
530 
531  $new_event['event_id'] = $next_id;
532  $new_event['type'] = $a_type;
533  $new_event['id'] = $a_id;
534  $new_event['op'] = $a_op;
535 
536  $this->events[] = $new_event;
537  $this->econtent_ids[$a_id] = $a_id;
538  return true;
539  }
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ delete()

ilECSEventQueueReader::delete (   $a_event_id)

delete private

Parameters
intevent id

Definition at line 565 of file class.ilECSEventQueueReader.php.

References $ilDB, $query, $res, and getServer().

566  {
567  global $ilDB;
568 
569  $query = "DELETE FROM ecs_events " .
570  "WHERE event_id = " . $this->db->quote($a_event_id, 'integer') . " " .
571  'AND server_id = ' . $ilDB->quote($this->getServer()->getServerId(), 'integer');
572  $res = $ilDB->manipulate($query);
573  unset($this->econtent_ids[$a_event_id]);
574  return true;
575  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ deleteAll()

ilECSEventQueueReader::deleteAll ( )

Delete all events.

public

Definition at line 276 of file class.ilECSEventQueueReader.php.

References $ilDB, $query, $res, and getServer().

277  {
278  global $ilDB;
279 
280  $query = "DELETE FROM ecs_events " .
281  'WHERE server_id = ' . $ilDB->quote($this->getServer()->getServerId(), 'integer');
282  $res = $ilDB->manipulate($query);
283  return true;
284  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ deleteAllEContentEvents()

ilECSEventQueueReader::deleteAllEContentEvents ( array  $a_types)

Delete all econtents.

public

Parameters
array$a_types

Definition at line 292 of file class.ilECSEventQueueReader.php.

References $ilDB, $query, $res, and getServer().

Referenced by handleImportReset().

293  {
294  global $ilDB;
295 
296  $query = "DELETE FROM ecs_events " .
297  "WHERE " . $this->db->in("type", $a_types, "", "text") . ' ' .
298  'AND server_id = ' . $ilDB->quote($this->getServer()->getServerId(), 'integer');
299  $res = $ilDB->manipulate($query);
300  return true;
301  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAllExportedEvents()

ilECSEventQueueReader::deleteAllExportedEvents ( )
protected

Delete all exported events.

public

Definition at line 308 of file class.ilECSEventQueueReader.php.

References $ilDB, $query, $res, and getServer().

Referenced by handleExportReset().

309  {
310  global $ilDB;
311 
312  $query = "DELETE FROM ecs_events " .
313  "WHERE type = " . $this->db->quote(self::TYPE_EXPORTED, 'text') . ' ' .
314  'AND server_id = ' . $ilDB->quote($this->getServer()->getServerId(), 'integer');
315  $res = $ilDB->manipulate($query);
316  return true;
317  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteByServerId()

static ilECSEventQueueReader::deleteByServerId (   $a_server_id)
static

Definition at line 603 of file class.ilECSEventQueueReader.php.

References $ilDB, and $query.

Referenced by ilECSSetting\delete().

604  {
605  global $ilDB;
606 
607  $query = 'DELETE FROM ecs_events' .
608  ' WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer');
609  $ilDB->manipulate($query);
610  return true;
611  }
$query
global $ilDB
+ Here is the caller graph for this function:

◆ deleteServer()

static ilECSEventQueueReader::deleteServer (   $a_server_id)
static

Delete by server id ilDB $ilDB.

Parameters
int$a_server_id

Definition at line 363 of file class.ilECSEventQueueReader.php.

References $ilDB, and $query.

Referenced by ilECSSettingsGUI\doDelete().

364  {
365  global $ilDB;
366 
367  $query = 'DELETE FROM ecs_events ' .
368  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer');
369  $ilDB->manipulate($query);
370  }
$query
global $ilDB
+ Here is the caller graph for this function:

◆ getAllEContentTypes()

static ilECSEventQueueReader::getAllEContentTypes ( )
staticprotected

All available content types.

Returns
array

Definition at line 94 of file class.ilECSEventQueueReader.php.

References array.

95  {
96  return array(self::TYPE_REMOTE_COURSE, self::TYPE_REMOTE_CATEGORY,
97  self::TYPE_REMOTE_FILE, self::TYPE_REMOTE_GLOSSARY, self::TYPE_REMOTE_GROUP,
98  self::TYPE_REMOTE_LEARNING_MODULE, self::TYPE_REMOTE_WIKI, self::TYPE_REMOTE_TEST);
99  }
Create styles array
The data for the language used.

◆ getAllResourceIds()

static ilECSEventQueueReader::getAllResourceIds ( ilECSSetting  $server,
array  $a_types,
  $a_sender_only = false 
)
staticprotected

Get all resource ids by resource type.

Parameters
ilECSSetting$server
array$a_types
bool$a_sender_only
Returns
array type => ids

Definition at line 109 of file class.ilECSEventQueueReader.php.

References $list, $type, array, and ilRemoteObjectBase\getInstanceByEventType().

110  {
111  include_once 'Services/WebServices/ECS/classes/class.ilRemoteObjectBase.php';
112  $list = array();
113  foreach ($a_types as $type) {
115  if ($robj) {
116  $list[$type] = $robj->getAllResourceIds($server, $a_sender_only);
117  }
118  }
119 
120  return $list;
121  }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
$type
static getInstanceByEventType($a_type)
Get instance by ilECSEvent(QueueReader) type.
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getEvents()

ilECSEventQueueReader::getEvents ( )

get all events

public

Definition at line 266 of file class.ilECSEventQueueReader.php.

References array.

267  {
268  return $this->events ? $this->events : array();
269  }
Create styles array
The data for the language used.

◆ getEventTypeFromObjectType()

static ilECSEventQueueReader::getEventTypeFromObjectType (   $a_obj_type)
staticprotected

Convert object type to event type.

Parameters
string$a_obj_type
Returns
string

Definition at line 83 of file class.ilECSEventQueueReader.php.

84  {
85  // currently they are the same for all resource types
86  return $a_obj_type;
87  }

◆ getServer()

ilECSEventQueueReader::getServer ( )

get server setting

Returns
ilECSSetting

Definition at line 254 of file class.ilECSEventQueueReader.php.

Referenced by add(), delete(), deleteAll(), deleteAllEContentEvents(), deleteAllExportedEvents(), read(), refresh(), update(), and writeEventToDB().

255  {
256  return $this->settings;
257  }
+ Here is the caller graph for this function:

◆ handleExportReset()

static ilECSEventQueueReader::handleExportReset ( ilECSSetting  $server)
static

Handle export reset.

Delete exported econtent and create it again

Returns
bool throws ilException, ilECSConnectorException

Definition at line 215 of file class.ilECSEventQueueReader.php.

References $GLOBALS, $list, ilECSExport\_deleteEContentIds(), ilECSExport\_getAllEContentIds(), array, deleteAllExportedEvents(), and ilECSSetting\getServerId().

Referenced by ilECSSettingsGUI\readAll().

216  {
217  include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
218 
219  // Delete all export events
220  $queue = new ilECSEventQueueReader($server->getServerId());
221  $queue->deleteAllExportedEvents();
222 
223  // Read all local export info
224  $local_econtent_ids = ilECSExport::_getAllEContentIds($server->getServerId());
225 
226  $types = self::getAllEContentTypes();
227  $list = self::getAllResourceIds($server, $types, true);
228 
229 
230  // merge in one array
231  $all_remote_ids = array();
232  foreach ($list as $resource_type => $remote_ids) {
233  $all_remote_ids = array_merge($all_remote_ids, (array) $remote_ids);
234  }
235  $all_remote_ids = array_unique($all_remote_ids);
236 
237  $GLOBALS['ilLog']->write(__METHOD__ . ': Resources = ' . print_r($all_remote_ids, true));
238  $GLOBALS['ilLog']->write(__METHOD__ . ': Local = ' . print_r($local_econtent_ids, true));
239  foreach ($local_econtent_ids as $local_econtent_id => $local_obj_id) {
240  if (!in_array($local_econtent_id, $all_remote_ids)) {
241  // Delete this deprecated info
242  $GLOBALS['ilLog']->write(__METHOD__ . ': Deleting deprecated econtent id ' . $local_econtent_id);
243  ilECSExport::_deleteEContentIds($server->getServerId(), array($local_econtent_id));
244  }
245  }
246  return true;
247  }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
static _getAllEContentIds($a_server_id)
get all exported econtent ids per server
getServerId()
Get current server id.
static _deleteEContentIds($a_server_id, $a_ids)
Delete econtent ids for server.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
deleteAllExportedEvents()
Delete all exported events.
Reads ECS events and stores them in the database.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleImportReset()

static ilECSEventQueueReader::handleImportReset ( ilECSSetting  $server)
static

Reread all imported econtent.

Returns
bool throws ilException, ilECSConnectorException

Definition at line 130 of file class.ilECSEventQueueReader.php.

References $GLOBALS, $ilLog, $list, $type, ilObject\_lookupType(), array, ilECSEvent\CREATED, deleteAllEContentEvents(), ilECSEvent\DESTROYED, ilECSImport\getAllImportedRemoteObjects(), ilECSUtils\getPossibleRemoteTypes(), ilECSSetting\getServerId(), and ilECSEvent\UPDATED.

Referenced by ilECSSettingsGUI\readAll().

131  {
132  global $ilLog;
133 
134  include_once('Services/WebServices/ECS/classes/class.ilECSConnector.php');
135  include_once('Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
136 
137  try {
138  include_once('./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
139  include_once('./Services/WebServices/ECS/classes/class.ilECSImport.php');
140  include_once('./Services/WebServices/ECS/classes/class.ilECSExport.php');
141 
142  $types = self::getAllEContentTypes();
143 
144  $event_queue = new ilECSEventQueueReader($server->getServerId());
145  $event_queue->deleteAllEContentEvents($types);
146 
147  $list = self::getAllResourceIds($server, $types);
149 
150  $GLOBALS['ilLog']->write(__METHOD__ . ': Imported = ' . print_r($imported, true));
151  $GLOBALS['ilLog']->write(__METHOD__ . ': List = ' . print_r($list, true));
152 
153  foreach ($list as $resource_type => $link_ids) {
154  if (!in_array($resource_type, ilECSUtils::getPossibleRemoteTypes())) {
155  $GLOBALS['ilLog']->write(__METHOD__ . ': Ignoring resource type ' . $resource_type);
156  continue;
157  }
158 
159 
160  foreach ((array) $link_ids as $link_id) {
161  if (!isset($imported[$link_id])) {
162  // Add create event for not imported econtent
163  $event_queue->add(
164  $resource_type,
165  $link_id,
167  );
168  } else {
169  // Add update event for already existing events
170  $event_queue->add(
171  $resource_type,
172  $link_id,
174  );
175  }
176 
177  if (isset($imported[$link_id])) {
178  unset($imported[$link_id]);
179  }
180  }
181  }
182 
183  if (is_array($imported)) {
184  // Delete event for deprecated econtent
185  include_once 'Services/WebServices/ECS/classes/class.ilECSObjectSettings.php';
186  foreach ($imported as $econtent_id => $obj_id) {
187  $type = self::getEventTypeFromObjectType(ilObject::_lookupType($obj_id));
188  if ($type) {
189  $event_queue->add(
190  $type,
191  $econtent_id,
193  );
194  }
195  }
196  }
197  } catch (ilECSConnectorException $e1) {
198  $ilLog->write('Cannot connect to ECS server: ' . $e1->getMessage());
199  throw $e1;
200  } catch (ilException $e2) {
201  $ilLog->write('Update failed: ' . $e2->getMessage());
202  throw $e2;
203  }
204  return true;
205  }
static getAllImportedRemoteObjects($a_server_id)
get all imported links
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
static getPossibleRemoteTypes($a_with_captions=false)
Get all possible remote object types.
$type
getServerId()
Get current server id.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
deleteAllEContentEvents(array $a_types)
Delete all econtents.
Reads ECS events and stores them in the database.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilECSEventQueueReader::read ( )

Read public.

Definition at line 581 of file class.ilECSEventQueueReader.php.

References $counter, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, and getServer().

Referenced by __construct().

582  {
583  global $ilDB;
584 
585  $query = "SELECT * FROM ecs_events " .
586  'WHERE server_id = ' . $ilDB->quote($this->getServer()->getServerId(), 'integer') . ' ' .
587  'ORDER BY event_id';
588 
589  $res = $this->db->query($query);
590  $counter = 0;
591  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
592  $this->events[$counter]['event_id'] = $row->event_id;
593  $this->events[$counter]['type'] = $row->type;
594  $this->events[$counter]['id'] = $row->id;
595  $this->events[$counter]['op'] = $row->op;
596 
597  $this->econtent_ids[$row->event_id] = $row->event_id;
598  ++$counter;
599  }
600  return true;
601  }
$counter
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ refresh()

ilECSEventQueueReader::refresh ( )

Fetch events from fifo Using fifo public.

Exceptions
ilECSConnectorException

Definition at line 325 of file class.ilECSEventQueueReader.php.

References $GLOBALS, $res, $result, getServer(), and writeEventToDB().

326  {
327  try {
328  include_once('Services/WebServices/ECS/classes/class.ilECSConnector.php');
329  include_once('Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
330 
331  $connector = new ilECSConnector($this->getServer());
332  while (true) {
333  $res = $connector->readEventFifo(false);
334 
335  if (!count($res->getResult())) {
336  return true;
337  }
338 
339  foreach ($res->getResult() as $result) {
340  include_once './Services/WebServices/ECS/classes/class.ilECSEvent.php';
341  $event = new ilECSEvent($result);
342 
343  $GLOBALS['ilLog']->write(__METHOD__ . ' ---------------------------- Handling new event ');
344  $GLOBALS['ilLog']->write(__METHOD__ . print_r($event, true));
345  $GLOBALS['ilLog']->write(__METHOD__ . ' ---------------------------- Done! ');
346 
347  // Fill command queue
348  $this->writeEventToDB($event);
349  }
350  // Delete from fifo
351  $connector->readEventFifo(true);
352  }
353  } catch (ilECSConnectorException $e) {
354  $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot read event fifo. Aborting');
355  }
356  }
$result
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
foreach($_POST as $key=> $value) $res
writeEventToDB(ilECSEvent $ev)
Write event to db.
+ Here is the call graph for this function:

◆ shift()

ilECSEventQueueReader::shift ( )

get and delete the first event entry

public

Returns
array event data or an empty array if the queue is empty

Definition at line 498 of file class.ilECSEventQueueReader.php.

References array.

499  {
500  $event = array_shift($this->events);
501  if ($event == null) {
502  return array();
503  } else {
504 
505  #$this->delete($event['event_id']);
506  return $event;
507  }
508  }
Create styles array
The data for the language used.

◆ update()

ilECSEventQueueReader::update (   $a_type,
  $a_id,
  $a_operation 
)
private

update one entry

private

Definition at line 547 of file class.ilECSEventQueueReader.php.

References $a_type, $ilDB, $query, $res, and getServer().

548  {
549  global $ilDB;
550 
551  $query = "UPDATE ecs_events " .
552  "SET op = " . $this->db->quote($a_operation, 'text') . " " .
553  "WHERE type = " . $this->db->quote($a_type, 'text') . " " .
554  "AND id = " . $this->db->quote($a_id, 'integer') . " " .
555  'AND server_id = ' . $ilDB->quote($this->getServer()->getServerId(), 'integer');
556  $res = $ilDB->manipulate($query);
557  }
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ writeEventToDB()

ilECSEventQueueReader::writeEventToDB ( ilECSEvent  $ev)
private

Write event to db.

Definition at line 375 of file class.ilECSEventQueueReader.php.

References $ilDB, $query, $res, $row, $type, ilECSEvent\CREATED, ilECSEvent\DESTROYED, ilDBConstants\FETCHMODE_OBJECT, ilECSEvent\getRessourceId(), ilECSEvent\getRessourceType(), getServer(), ilECSEvent\getStatus(), and ilECSEvent\UPDATED.

Referenced by refresh().

376  {
377  global $ilDB;
378 
379  // this should probably be moved elsewhere
380  switch ($ev->getRessourceType()) {
381  case 'directory_trees':
382  $type = self::TYPE_DIRECTORY_TREES;
383  break;
384 
385  case 'course_members':
386  $type = self::TYPE_CMS_COURSE_MEMBERS;
387  break;
388 
389  case 'courses':
390  $type = self::TYPE_CMS_COURSES;
391  break;
392 
393  case 'courselinks':
394  $type = self::TYPE_REMOTE_COURSE;
395  break;
396 
397  case 'categories':
398  $type = self::TYPE_REMOTE_CATEGORY;
399  break;
400 
401  case 'files':
402  $type = self::TYPE_REMOTE_FILE;
403  break;
404 
405  case 'glossaries':
406  $type = self::TYPE_REMOTE_GLOSSARY;
407  break;
408 
409  case 'groups':
410  $type = self::TYPE_REMOTE_GROUP;
411  break;
412 
413  case 'learningmodules':
414  $type = self::TYPE_REMOTE_LEARNING_MODULE;
415  break;
416 
417  case 'wikis':
418  $type = self::TYPE_REMOTE_WIKI;
419  break;
420 
421  case 'tests':
422  $type = self::TYPE_REMOTE_TEST;
423  break;
424 
425  case 'course_urls':
426  $type = self::TYPE_COURSE_URLS;
427  break;
428 
429  case 'member_status':
430  $type = self::TYPE_ENROLMENT_STATUS;
431  break;
432 
433  default:
434  // write custom event type
435  $type = $ev->getRessourceType();
436  break;
437  }
438 
439  $query = "SELECT * FROM ecs_events " .
440  "WHERE type = " . $ilDB->quote($type, 'integer') . " " .
441  "AND id = " . $ilDB->quote($ev->getRessourceId(), 'integer') . " " .
442  'AND server_id = ' . $ilDB->quote($this->getServer()->getServerId(), 'integer');
443  $res = $ilDB->query($query);
444 
445  $event_id = 0;
446  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
447  $event_id = $row->event_id;
448  }
449 
450  if (!$event_id) {
451  // No previous entry exists => perform insert
452  $query = "INSERT ecs_events (event_id,type,id,op,server_id) " .
453  "VALUES( " .
454  $ilDB->quote($ilDB->nextId('ecs_events'), 'integer') . ',' .
455  $ilDB->quote($type, 'text') . ', ' .
456  $ilDB->quote($ev->getRessourceId(), 'integer') . ', ' .
457  $ilDB->quote($ev->getStatus(), 'text') . ', ' .
458  $ilDB->quote($this->getServer()->getServerId(), 'integer') . ' ' .
459  ')';
460  $ilDB->manipulate($query);
461  return true;
462  }
463  // Do update
464  $do_update = false;
465  switch ($ev->getStatus()) {
466  case ilECSEvent::CREATED:
467  // Do update, although impossible
468  $do_update = true;
469  break;
470 
472  $do_update = true;
473  break;
474 
475  case ilECSEvent::UPDATED:
476  // Do nothing. Old status is ok.
477  break;
478  }
479 
480  if (!$do_update) {
481  return true;
482  }
483  $query = "UPDATE ecs_events " .
484  "SET op = " . $ilDB->quote($ev->getStatus(), 'text') . " " .
485  "WHERE event_id = " . $ilDB->quote($event_id, 'integer') . ' ' .
486  'AND type = ' . $ilDB->quote($type) . ' ' .
487  'AND server_id = ' . $ilDB->quote($this->getServer()->getServerId(), 'integer');
488  $ilDB->manipulate($query);
489  return true;
490  }
getStatus()
get title
$type
getRessourceType()
Get ressource type.
getRessourceId()
Get ressource id.
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilECSEventQueueReader::$db
protected

Definition at line 54 of file class.ilECSEventQueueReader.php.

◆ $econtent_ids

ilECSEventQueueReader::$econtent_ids = array()
protected

Definition at line 57 of file class.ilECSEventQueueReader.php.

◆ $events

ilECSEventQueueReader::$events = array()
protected

Definition at line 56 of file class.ilECSEventQueueReader.php.

◆ $log

ilECSEventQueueReader::$log
protected

Definition at line 53 of file class.ilECSEventQueueReader.php.

◆ TYPE_CMS_COURSE_MEMBERS

const ilECSEventQueueReader::TYPE_CMS_COURSE_MEMBERS = 'course_members'

Definition at line 41 of file class.ilECSEventQueueReader.php.

Referenced by ilECSTaskScheduler\handleEvents().

◆ TYPE_CMS_COURSES

const ilECSEventQueueReader::TYPE_CMS_COURSES = 'courses'

Definition at line 40 of file class.ilECSEventQueueReader.php.

Referenced by ilECSTaskScheduler\handleEvents().

◆ TYPE_COURSE_URLS

const ilECSEventQueueReader::TYPE_COURSE_URLS = 'course_urls'

Definition at line 50 of file class.ilECSEventQueueReader.php.

Referenced by ilECSTaskScheduler\handleEvents().

◆ TYPE_DIRECTORY_TREES

const ilECSEventQueueReader::TYPE_DIRECTORY_TREES = 'directory_trees'

◆ TYPE_ENROLMENT_STATUS

const ilECSEventQueueReader::TYPE_ENROLMENT_STATUS = 'member_status'

Definition at line 51 of file class.ilECSEventQueueReader.php.

Referenced by ilECSTaskScheduler\handleEvents().

◆ TYPE_EXPORTED

const ilECSEventQueueReader::TYPE_EXPORTED = 'exported'

Definition at line 38 of file class.ilECSEventQueueReader.php.

◆ TYPE_REMOTE_CATEGORY

const ilECSEventQueueReader::TYPE_REMOTE_CATEGORY = 'rcat'

◆ TYPE_REMOTE_COURSE

const ilECSEventQueueReader::TYPE_REMOTE_COURSE = 'rcrs'

◆ TYPE_REMOTE_FILE

const ilECSEventQueueReader::TYPE_REMOTE_FILE = 'rfil'

◆ TYPE_REMOTE_GLOSSARY

const ilECSEventQueueReader::TYPE_REMOTE_GLOSSARY = 'rglo'

◆ TYPE_REMOTE_GROUP

const ilECSEventQueueReader::TYPE_REMOTE_GROUP = 'rgrp'

◆ TYPE_REMOTE_LEARNING_MODULE

const ilECSEventQueueReader::TYPE_REMOTE_LEARNING_MODULE = 'rlm'

◆ TYPE_REMOTE_TEST

const ilECSEventQueueReader::TYPE_REMOTE_TEST = 'rtst'

◆ TYPE_REMOTE_WIKI

const ilECSEventQueueReader::TYPE_REMOTE_WIKI = 'rwik'

The documentation for this class was generated from the following file: