55 function ilSetting($a_module =
"common", $a_disabled_cache =
false)
59 $this->cache_disabled = $a_disabled_cache;
60 $this->module = $a_module;
62 if (!is_object($ilDB))
64 die (
"Fatal Error: ilSettings object instantiated without DB initialisation.");
80 if (!$this->cache_disabled)
82 if (isset(self::$settings_cache[$this->module]))
89 $this->setting = array();
94 $query =
"SELECT * FROM settings WHERE module=".$ilDB->quote($this->module,
"text");
97 while (
$row = $ilDB->fetchAssoc(
$res))
99 $this->setting[
$row[
"keyword"]] = $row[
"value"];
114 function get($a_keyword, $a_default_value =
false)
116 if ($a_keyword ==
"ilias_version")
121 if (isset($this->setting[$a_keyword]))
123 return $this->setting[$a_keyword];
127 return $a_default_value;
141 $query =
"DELETE FROM settings WHERE module = ".$ilDB->quote($this->module,
"text");
142 $ilDB->manipulate(
$query);
144 $this->setting = array();
159 $query =
"SELECT keyword FROM settings".
160 " WHERE module = ".$ilDB->quote($this->module,
"text").
161 " AND ".$ilDB->like(
"keyword",
"text", $a_like);
163 while(
$row = $ilDB->fetchAssoc(
$res))
165 $this->
delete(
$row[
"keyword"]);
177 function delete($a_keyword)
181 $st = $ilDB->manipulate(
"DELETE FROM settings WHERE keyword = ".
182 $ilDB->quote($a_keyword,
"text").
" AND module = ".
183 $ilDB->quote($this->module,
"text"));
185 unset($this->setting[$a_keyword]);
209 function set($a_key, $a_val)
213 $this->
delete($a_key);
215 if (!isset(self::$value_type))
220 if (self::$value_type ==
'text' and strlen($a_val) >= 4000)
223 $a_val = substr($a_val, 0, 4000);
226 $ilDB->insert(
"settings", array(
227 "module" => array(
"text", $this->module),
228 "keyword" => array(
"text", $a_key),
229 "value" => array(self::$value_type, $a_val)));
231 $this->setting[$a_key] = $a_val;
240 $ilDB->query(
"UPDATE sahs_lm SET debug = 'n'");
250 $query =
"SELECT value FROM settings WHERE module = %s AND keyword = %s";
251 $res = $ilDB->queryF(
$query, array(
'text',
'text'), array($a_module, $a_keyword));
253 return $data[
'value'];
263 include_once (
'./Services/Database/classes/class.ilDBAnalyzer.php');
267 if ($info[
'value'][
'type'] ==
'clob')
290 if ($a_new_type == $old_type)
294 elseif ($a_new_type ==
'clob')
296 $ilDB->addTableColumn(
'settings',
'value2',
297 array(
"type" =>
"clob",
301 $ilDB->query(
"UPDATE settings SET value2 = value");
302 $ilDB->dropTableColumn(
'settings',
'value');
303 $ilDB->renameTableColumn(
'settings',
'value2',
'value');
307 elseif ($a_new_type ==
'text')
309 $ilDB->addTableColumn(
'settings',
'value2',
310 array(
"type" =>
"text",
315 $ilDB->query(
"UPDATE settings SET value2 = value");
316 $ilDB->dropTableColumn(
'settings',
'value');
317 $ilDB->renameTableColumn(
'settings',
'value2',
'value');
340 $query =
"SELECT * FROM settings WHERE LENGTH(value) > "
341 . $ilDB->quote($a_limit,
'integer');