ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSearchCommandQueue Class Reference
+ Collaboration diagram for ilSearchCommandQueue:

Public Member Functions

 store (ilSearchCommandQueueElement $element)
 update / save new entry More...
 

Static Public Member Functions

static factory ()
 get singleton instance More...
 

Protected Member Functions

 __construct ()
 Constructor. More...
 
 insert (ilSearchCommandQueueElement $element)
 Insert new entry. More...
 
 update (ilSearchCommandQueueElement $element)
 Update existing entry. More...
 

Protected Attributes

ilDBInterface $db
 

Static Private Attributes

static self $instance = null
 

Detailed Description

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

Definition at line 34 of file class.ilSearchCommandQueue.php.

Constructor & Destructor Documentation

◆ __construct()

ilSearchCommandQueue::__construct ( )
protected

Constructor.

Definition at line 43 of file class.ilSearchCommandQueue.php.

References $DIC.

44  {
45  global $DIC;
46 
47  $this->db = $DIC->database();
48  }
global $DIC
Definition: feed.php:28

Member Function Documentation

◆ factory()

static ilSearchCommandQueue::factory ( )
static

get singleton instance

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

Referenced by ilSearchAppEventListener\storeElement().

54  {
55  if (self::$instance instanceof ilSearchCommandQueue) {
56  return self::$instance;
57  }
58  return self::$instance = new ilSearchCommandQueue();
59  }
+ Here is the caller graph for this function:

◆ insert()

ilSearchCommandQueue::insert ( ilSearchCommandQueueElement  $element)
protected

Insert new entry.

Definition at line 80 of file class.ilSearchCommandQueue.php.

References $query, $res, ilSearchCommandQueueElement\getCommand(), ilSearchCommandQueueElement\getObjId(), and ilSearchCommandQueueElement\getObjType().

Referenced by store().

80  : void
81  {
82  $query = "INSERT INTO search_command_queue (obj_id,obj_type,sub_id,sub_type,command,last_update,finished) " .
83  "VALUES( " .
84  $this->db->quote($element->getObjId(), 'integer') . ", " .
85  $this->db->quote($element->getObjType(), 'text') . ", " .
86  "0, " .
87  "''," .
88  $this->db->quote($element->getCommand(), 'text') . ", " .
89  $this->db->now() . ", " .
90  "0 " .
91  ")";
92  $res = $this->db->manipulate($query);
93  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ store()

ilSearchCommandQueue::store ( ilSearchCommandQueueElement  $element)

update / save new entry

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

References $query, $res, ilSearchCommandQueueElement\getObjId(), ilSearchCommandQueueElement\getObjType(), insert(), and update().

64  : void
65  {
66  $query = "SELECT obj_id, obj_type FROM search_command_queue " .
67  "WHERE obj_id = " . $this->db->quote($element->getObjId(), 'integer') . " " .
68  "AND obj_type = " . $this->db->quote($element->getObjType(), 'text');
69  $res = $this->db->query($query);
70  if ($res->numRows()) {
71  $this->update($element);
72  } else {
73  $this->insert($element);
74  }
75  }
$res
Definition: ltiservices.php:69
insert(ilSearchCommandQueueElement $element)
Insert new entry.
update(ilSearchCommandQueueElement $element)
Update existing entry.
$query
+ Here is the call graph for this function:

◆ update()

ilSearchCommandQueue::update ( ilSearchCommandQueueElement  $element)
protected

Update existing entry.

Definition at line 98 of file class.ilSearchCommandQueue.php.

References $query, $res, ilSearchCommandQueueElement\getCommand(), ilSearchCommandQueueElement\getObjId(), and ilSearchCommandQueueElement\getObjType().

Referenced by store().

98  : void
99  {
100  $query = "UPDATE search_command_queue " .
101  "SET command = " . $this->db->quote($element->getCommand(), 'text') . ", " .
102  "last_update = " . $this->db->now() . ", " .
103  "finished = " . $this->db->quote(0, 'integer') . " " .
104  "WHERE obj_id = " . $this->db->quote($element->getObjId(), 'integer') . " " .
105  "AND obj_type = " . $this->db->quote($element->getObjType(), 'text');
106  $res = $this->db->manipulate($query);
107  }
$res
Definition: ltiservices.php:69
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilSearchCommandQueue::$db
protected

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

◆ $instance

self ilSearchCommandQueue::$instance = null
staticprivate

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


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