ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
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 28 of file class.ilSearchCommandQueue.php.

Constructor & Destructor Documentation

◆ __construct()

ilSearchCommandQueue::__construct ( )
protected

Constructor.

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

References $DIC.

38  {
39  global $DIC;
40 
41  $this->db = $DIC->database();
42  }
global $DIC
Definition: shib_login.php:26

Member Function Documentation

◆ factory()

static ilSearchCommandQueue::factory ( )
static

get singleton instance

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

Referenced by ilSearchAppEventListener\storeElement().

48  {
49  if (self::$instance instanceof ilSearchCommandQueue) {
50  return self::$instance;
51  }
52  return self::$instance = new ilSearchCommandQueue();
53  }
+ Here is the caller graph for this function:

◆ insert()

ilSearchCommandQueue::insert ( ilSearchCommandQueueElement  $element)
protected

Insert new entry.

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

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

Referenced by store().

74  : void
75  {
76  $query = "INSERT INTO search_command_queue (obj_id,obj_type,sub_id,sub_type,command,last_update,finished) " .
77  "VALUES( " .
78  $this->db->quote($element->getObjId(), 'integer') . ", " .
79  $this->db->quote($element->getObjType(), 'text') . ", " .
80  "0, " .
81  "''," .
82  $this->db->quote($element->getCommand(), 'text') . ", " .
83  $this->db->now() . ", " .
84  "0 " .
85  ")";
86  $res = $this->db->manipulate($query);
87  }
$res
Definition: ltiservices.php:66
+ 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 58 of file class.ilSearchCommandQueue.php.

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

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

◆ update()

ilSearchCommandQueue::update ( ilSearchCommandQueueElement  $element)
protected

Update existing entry.

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

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

Referenced by store().

92  : void
93  {
94  $query = "UPDATE search_command_queue " .
95  "SET command = " . $this->db->quote($element->getCommand(), 'text') . ", " .
96  "last_update = " . $this->db->now() . ", " .
97  "finished = " . $this->db->quote(0, 'integer') . " " .
98  "WHERE obj_id = " . $this->db->quote($element->getObjId(), 'integer') . " " .
99  "AND obj_type = " . $this->db->quote($element->getObjType(), 'text');
100  $res = $this->db->manipulate($query);
101  }
$res
Definition: ltiservices.php:66
+ 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 32 of file class.ilSearchCommandQueue.php.

◆ $instance

self ilSearchCommandQueue::$instance = null
staticprivate

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


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