ILIAS
Release_4_0_x_branch Revision 61816
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
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
}
46
50
public
function
factory
()
51
{
52
if
(isset(self::$instance) and self::$instance)
53
{
54
return
self::$instance
;
55
}
56
return
self::$instance =
new
ilSearchCommandQueue
();
57
}
58
62
public
function
store
(
ilSearchCommandQueueElement
$element)
63
{
64
global
$ilDB
;
65
66
$query
=
"SELECT obj_id, obj_type FROM search_command_queue "
.
67
"WHERE obj_id = "
.$ilDB->quote($element->
getObjId
() ,
'integer'
).
" "
.
68
"AND obj_type = "
.$ilDB->quote($element->
getObjType
() ,
'text'
);
69
$res
= $ilDB->query(
$query
);
70
if
(
$res
->numRows())
71
{
72
$this->
update
($element);
73
}
74
else
75
{
76
$this->
insert
($element);
77
}
78
}
79
83
protected
function
insert
(
ilSearchCommandQueueElement
$element)
84
{
85
global
$ilDB
;
86
87
$query
=
"INSERT INTO search_command_queue (obj_id,obj_type,sub_id,sub_type,command,last_update,finished) "
.
88
"VALUES( "
.
89
$ilDB->quote($element->
getObjId
() ,
'integer'
).
", "
.
90
$ilDB->quote($element->
getObjType
() ,
'text'
).
", "
.
91
"0, "
.
92
"'',"
.
93
$ilDB->quote($element->
getCommand
() ,
'text'
).
", "
.
94
$ilDB->now().
", "
.
95
"0 "
.
96
")"
;
97
$res
= $ilDB->manipulate(
$query
);
98
return
true
;
99
}
100
104
protected
function
update
(
ilSearchCommandQueueElement
$element)
105
{
106
global
$ilDB
;
107
108
$query
=
"UPDATE search_command_queue "
.
109
"SET command = "
.$ilDB->quote($element->
getCommand
() ,
'text'
).
", "
.
110
"last_update = "
.$ilDB->now().
", "
.
111
"finished = "
.$ilDB->quote(0 ,
'integer'
).
" "
.
112
"WHERE obj_id = "
.$ilDB->quote($element->
getObjId
() ,
'integer'
).
" "
.
113
"AND obj_type = "
.$ilDB->quote($element->
getObjType
() ,
'text'
);
114
$res
= $ilDB->manipulate(
$query
);
115
return
true
;
116
}
117
118
119
120
121
}
122
?>
Services
Search
classes
class.ilSearchCommandQueue.php
Generated on Wed Apr 27 2016 19:01:50 for ILIAS by
1.8.1.2 (using
Doxyfile
)