ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilSearchCommandQueue.php
Go to the documentation of this file.
1
<?php
2
/*
3
+-----------------------------------------------------------------------------+
4
| ILIAS open source |
5
+-----------------------------------------------------------------------------+
6
| Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7
| |
8
| This program is free software; you can redistribute it and/or |
9
| modify it under the terms of the GNU General Public License |
10
| as published by the Free Software Foundation; either version 2 |
11
| of the License, or (at your option) any later version. |
12
| |
13
| This program is distributed in the hope that it will be useful, |
14
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
| GNU General Public License for more details. |
17
| |
18
| You should have received a copy of the GNU General Public License |
19
| along with this program; if not, write to the Free Software |
20
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21
+-----------------------------------------------------------------------------+
22
*/
23
24
include_once
'./Services/Search/classes/class.ilSearchCommandQueueElement.php'
;
34
class
ilSearchCommandQueue
35
{
36
private
static
$instance
= null;
37
38
42
protected
function
__construct
()
43
{
44
}
45
49
public
static
function
factory
()
50
{
51
if
(isset(self::$instance) and self::$instance) {
52
return
self::$instance;
53
}
54
return
self::$instance =
new
ilSearchCommandQueue
();
55
}
56
60
public
function
store
(
ilSearchCommandQueueElement
$element)
61
{
62
global
$ilDB
;
63
64
$query
=
"SELECT obj_id, obj_type FROM search_command_queue "
.
65
"WHERE obj_id = "
. $ilDB->quote($element->
getObjId
(),
'integer'
) .
" "
.
66
"AND obj_type = "
. $ilDB->quote($element->
getObjType
(),
'text'
);
67
$res
= $ilDB->query(
$query
);
68
if
(
$res
->numRows()) {
69
$this->
update
($element);
70
}
else
{
71
$this->
insert
($element);
72
}
73
}
74
78
protected
function
insert
(
ilSearchCommandQueueElement
$element)
79
{
80
global
$ilDB
;
81
82
$query
=
"INSERT INTO search_command_queue (obj_id,obj_type,sub_id,sub_type,command,last_update,finished) "
.
83
"VALUES( "
.
84
$ilDB->quote($element->
getObjId
(),
'integer'
) .
", "
.
85
$ilDB->quote($element->
getObjType
(),
'text'
) .
", "
.
86
"0, "
.
87
"'',"
.
88
$ilDB->quote($element->
getCommand
(),
'text'
) .
", "
.
89
$ilDB->now() .
", "
.
90
"0 "
.
91
")"
;
92
$res
= $ilDB->manipulate(
$query
);
93
return
true
;
94
}
95
99
protected
function
update
(
ilSearchCommandQueueElement
$element)
100
{
101
global
$ilDB
;
102
103
$query
=
"UPDATE search_command_queue "
.
104
"SET command = "
. $ilDB->quote($element->
getCommand
(),
'text'
) .
", "
.
105
"last_update = "
. $ilDB->now() .
", "
.
106
"finished = "
. $ilDB->quote(0,
'integer'
) .
" "
.
107
"WHERE obj_id = "
. $ilDB->quote($element->
getObjId
(),
'integer'
) .
" "
.
108
"AND obj_type = "
. $ilDB->quote($element->
getObjType
(),
'text'
);
109
$res
= $ilDB->manipulate(
$query
);
110
return
true
;
111
}
112
}
ilSearchCommandQueueElement
Represents an entry for the search command queue.
Definition:
class.ilSearchCommandQueueElement.php:33
ilSearchCommandQueue\store
store(ilSearchCommandQueueElement $element)
update / save new entry
Definition:
class.ilSearchCommandQueue.php:60
ilSearchCommandQueue\$instance
static $instance
Definition:
class.ilSearchCommandQueue.php:36
ilSearchCommandQueueElement\getObjType
getObjType()
get obj_type
Definition:
class.ilSearchCommandQueueElement.php:80
ilSearchCommandQueueElement\getObjId
getObjId()
get obj_id
Definition:
class.ilSearchCommandQueueElement.php:64
ilSearchCommandQueue\insert
insert(ilSearchCommandQueueElement $element)
Insert new entry.
Definition:
class.ilSearchCommandQueue.php:78
ilSearchCommandQueue\factory
static factory()
get singleton instance
Definition:
class.ilSearchCommandQueue.php:49
ilSearchCommandQueue\update
update(ilSearchCommandQueueElement $element)
Update existing entry.
Definition:
class.ilSearchCommandQueue.php:99
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
$query
$query
Definition:
proxy_ylocal.php:13
ilSearchCommandQueueElement\getCommand
getCommand()
get command
Definition:
class.ilSearchCommandQueueElement.php:96
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilSearchCommandQueue
Definition:
class.ilSearchCommandQueue.php:34
ilSearchCommandQueue\__construct
__construct()
Constructor.
Definition:
class.ilSearchCommandQueue.php:42
Services
Search
classes
class.ilSearchCommandQueue.php
Generated on Sat Jan 18 2025 19:01:37 for ILIAS by
1.8.13 (using
Doxyfile
)