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 =
"DELETE FROM settings WHERE module = ".$ilDB->quote($this->module,
"text").
160 " AND ".$ilDB->like(
"keyword",
"text", $a_like);
161 $ilDB->manipulate(
$query);
173 function delete($a_keyword)
177 $st = $ilDB->manipulate(
"DELETE FROM settings WHERE keyword = ".
178 $ilDB->quote($a_keyword,
"text").
" AND module = ".
179 $ilDB->quote($this->module,
"text"));
181 unset($this->setting[$a_keyword]);
205 function set($a_key, $a_val)
209 $this->
delete($a_key);
211 if (!isset(self::$value_type))
216 if (self::$value_type ==
'text' and strlen($a_val) >= 4000)
219 $a_val = substr($a_val, 0, 4000);
222 $ilDB->insert(
"settings", array(
223 "module" => array(
"text", $this->module),
224 "keyword" => array(
"text", $a_key),
225 "value" => array(self::$value_type, $a_val)));
227 $this->setting[$a_key] = $a_val;
236 $ilDB->query(
"UPDATE sahs_lm SET debug = 'n'");
246 $query =
"SELECT value FROM settings WHERE module = %s AND keyword = %s";
247 $res = $ilDB->queryF(
$query, array(
'text',
'text'), array($a_module, $a_keyword));
249 return $data[
'value'];
259 include_once (
'./Services/Database/classes/class.ilDBAnalyzer.php');
263 if ($info[
'value'][
'type'] ==
'clob')
286 if ($a_new_type == $old_type)
290 elseif ($a_new_type ==
'clob')
292 $ilDB->addTableColumn(
'settings',
'value2',
293 array(
"type" =>
"clob",
297 $ilDB->query(
"UPDATE settings SET value2 = value");
298 $ilDB->dropTableColumn(
'settings',
'value');
299 $ilDB->renameTableColumn(
'settings',
'value2',
'value');
303 elseif ($a_new_type ==
'text')
305 $ilDB->addTableColumn(
'settings',
'value2',
306 array(
"type" =>
"text",
311 $ilDB->query(
"UPDATE settings SET value2 = value");
312 $ilDB->dropTableColumn(
'settings',
'value');
313 $ilDB->renameTableColumn(
'settings',
'value2',
'value');
336 $query =
"SELECT * FROM settings WHERE LENGTH(value) > "
337 . $ilDB->quote($a_limit,
'integer');