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.");
88 if (!$this->cache_disabled)
90 if (isset(self::$settings_cache[$this->module]))
97 $this->setting = array();
102 $query =
"SELECT * FROM settings WHERE module=".$ilDB->quote($this->module,
"text");
105 while (
$row = $ilDB->fetchAssoc(
$res))
107 $this->setting[
$row[
"keyword"]] = $row[
"value"];
122 function get($a_keyword, $a_default_value =
false)
124 if ($a_keyword ==
"ilias_version")
129 if (isset($this->setting[$a_keyword]))
131 return $this->setting[$a_keyword];
135 return $a_default_value;
149 $query =
"DELETE FROM settings WHERE module = ".$ilDB->quote($this->module,
"text");
150 $ilDB->manipulate(
$query);
152 $this->setting = array();
167 $query =
"SELECT keyword FROM settings".
168 " WHERE module = ".$ilDB->quote($this->module,
"text").
169 " AND ".$ilDB->like(
"keyword",
"text", $a_like);
171 while(
$row = $ilDB->fetchAssoc(
$res))
173 $this->
delete(
$row[
"keyword"]);
185 function delete($a_keyword)
189 $st = $ilDB->manipulate(
"DELETE FROM settings WHERE keyword = ".
190 $ilDB->quote($a_keyword,
"text").
" AND module = ".
191 $ilDB->quote($this->module,
"text"));
193 unset($this->setting[$a_keyword]);
217 function set($a_key, $a_val)
221 $this->
delete($a_key);
223 if (!isset(self::$value_type))
228 if (self::$value_type ==
'text' and strlen($a_val) >= 4000)
231 $a_val = substr($a_val, 0, 4000);
234 $ilDB->insert(
"settings", array(
235 "module" => array(
"text", $this->module),
236 "keyword" => array(
"text", $a_key),
237 "value" => array(self::$value_type, $a_val)));
239 $this->setting[$a_key] = $a_val;
248 $ilDB->query(
"UPDATE sahs_lm SET debug = 'n'");
258 $query =
"SELECT value FROM settings WHERE module = %s AND keyword = %s";
259 $res = $ilDB->queryF(
$query, array(
'text',
'text'), array($a_module, $a_keyword));
260 $data = $ilDB->fetchAssoc(
$res);
261 return $data[
'value'];
271 include_once (
'./Services/Database/classes/class.ilDBAnalyzer.php');
275 if ($info[
'value'][
'type'] ==
'clob')
298 if ($a_new_type == $old_type)
302 elseif ($a_new_type ==
'clob')
304 $ilDB->addTableColumn(
'settings',
'value2',
305 array(
"type" =>
"clob",
309 $ilDB->query(
"UPDATE settings SET value2 = value");
310 $ilDB->dropTableColumn(
'settings',
'value');
311 $ilDB->renameTableColumn(
'settings',
'value2',
'value');
315 elseif ($a_new_type ==
'text')
317 $ilDB->addTableColumn(
'settings',
'value2',
318 array(
"type" =>
"text",
323 $ilDB->query(
"UPDATE settings SET value2 = value");
324 $ilDB->dropTableColumn(
'settings',
'value');
325 $ilDB->renameTableColumn(
'settings',
'value2',
'value');
348 $query =
"SELECT * FROM settings WHERE LENGTH(value) > "
349 . $ilDB->quote($a_limit,
'integer');