60 public function __construct($a_module =
"common", $a_disabled_cache =
false)
64 $this->db = $DIC->database();
65 $ilDB = $DIC->database();
67 $this->cache_disabled = $a_disabled_cache;
68 $this->module = $a_module;
70 if (!is_object(
$ilDB)) {
71 die(
"Fatal Error: ilSettings object instantiated without DB initialisation.");
95 if (!$this->cache_disabled) {
96 if (isset(self::$settings_cache[$this->module])) {
100 $this->setting = array();
105 $query =
"SELECT * FROM settings WHERE module=" .
$ilDB->quote($this->module,
"text");
109 $this->setting[$row[
"keyword"]] = $row[
"value"];
123 public function get($a_keyword, $a_default_value =
false)
125 if ($a_keyword ==
"ilias_version") {
129 if (isset($this->setting[$a_keyword])) {
130 return $this->setting[$a_keyword];
132 return $a_default_value;
146 $query =
"DELETE FROM settings WHERE module = " .
$ilDB->quote($this->module,
"text");
149 $this->setting = array();
164 $query =
"SELECT keyword FROM settings" .
165 " WHERE module = " .
$ilDB->quote($this->module,
"text") .
166 " AND " .
$ilDB->like(
"keyword",
"text", $a_like);
169 $this->
delete($row[
"keyword"]);
181 public function delete($a_keyword)
185 $st =
$ilDB->manipulate(
"DELETE FROM settings WHERE keyword = " .
186 $ilDB->quote($a_keyword,
"text") .
" AND module = " .
187 $ilDB->quote($this->module,
"text"));
189 unset($this->setting[$a_keyword]);
213 public function set($a_key, $a_val)
217 $this->
delete($a_key);
219 if (!isset(self::$value_type)) {
220 self::$value_type = self::_getValueType();
223 if (self::$value_type ==
'text' and strlen($a_val) >= 4000) {
227 $a_val = substr($a_val, 0, 4000);
230 $ilDB->insert(
"settings", array(
231 "module" => array(
"text", $this->module),
232 "keyword" => array(
"text", $a_key),
233 "value" => array(self::$value_type, $a_val)));
235 $this->setting[$a_key] = $a_val;
244 $ilDB->query(
"UPDATE sahs_lm SET debug = 'n'");
254 $ilDB = $DIC->database();
256 $query =
"SELECT value FROM settings WHERE module = %s AND keyword = %s";
257 $res =
$ilDB->queryF(
$query, array(
'text',
'text'), array($a_module, $a_keyword));
259 return $data[
'value'];
271 $info = $analyzer->getFieldInformation(
'settings');
273 if ($info[
'value'][
'type'] ==
'clob') {
291 $ilDB = $DIC->database();
293 $old_type = self::_getValueType();
295 if ($a_new_type == $old_type) {
297 } elseif ($a_new_type ==
'clob') {
298 $ilDB->addTableColumn(
301 array(
"type" =>
"clob",
306 $ilDB->query(
"UPDATE settings SET value2 = value");
307 $ilDB->dropTableColumn(
'settings',
'value');
308 $ilDB->renameTableColumn(
'settings',
'value2',
'value');
311 } elseif ($a_new_type ==
'text') {
312 $ilDB->addTableColumn(
315 array(
"type" =>
"text",
321 $ilDB->query(
"UPDATE settings SET value2 = value");
322 $ilDB->dropTableColumn(
'settings',
'value');
323 $ilDB->renameTableColumn(
'settings',
'value2',
'value');
342 $ilDB = $DIC->database();
346 $query =
"SELECT * FROM settings WHERE LENGTH(value) > " 347 .
$ilDB->quote($a_limit,
'integer');
set($a_key, $a_val)
write one value to db-table settings public
setScormDebug($a_key, $a_val)
static _getLongerSettings($a_limit='4000')
get a list of setting records with values loger than a limit
static _changeValueType($a_new_type='text')
change the type of the value column in the database
static _getValueType()
Get the type of the value column in the database.
__construct($a_module="common", $a_disabled_cache=false)
Initialize settings.
getAll()
read all values from settingstable public
static $settings_cache
cache for the read settings ilSetting is instantiated more than once per request for some modules The...
static _lookupValue($a_module, $a_keyword)
foreach($_POST as $key=> $value) $res
read()
Read settings data.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
deleteAll()
Delete all settings of a current module.
This class gives all kind of DB information using the database manager and reverse module...
getModule()
Get currernt module.
static $value_type
the type of settings value field in database This is determined in the set method to get a correct DB...
deleteLike($a_like)
Delete all settings corresponding to a like string.