8 require_once(CH_DIRECTORY_PATH_CLASSES .
'ChWsbCacheFile.php');
28 $this->_sCacheFile =
'sys_options_' . md5(
$site[
'ver'] .
$site[
'build'] .
$site[
'url']) .
'.php';
31 $this->_oCache =
new ChWsbCacheFile();
32 $this->_aParams = $this->_oCache->getData($this->_sCacheFile);
34 if (
empty($this->_aParams) && $this->_oDb !=
null)
40 return isset($this->_aParams[$sKey]);
43 function get($sKey, $bFromCache =
true)
47 if ($bFromCache && $this->
isInCache($sKey))
48 return $this->_aParams[$sKey];
50 return $this->_oDb->getOne(
"SELECT `VALUE` FROM `sys_options` WHERE `Name`= ? LIMIT 1", [$sKey]);
53 function set($sKey, $mixedValue)
56 $this->_oDb->query(
"UPDATE `sys_options` SET `VALUE`= ? WHERE `Name`= ? LIMIT 1", [$mixedValue, $sKey]);
62 $oAlert =
new ChWsbAlerts(
'system',
'set_param', 0, 0, array(
'name' => $sKey,
'value' => $mixedValue));
68 $this->_aParams = $this->_oDb->getPairs(
"SELECT `Name`, `VALUE` FROM `sys_options`",
"Name",
"VALUE");
69 if (
empty($this->_aParams)) {
70 $this->_aParams = array ();
74 return $this->_oCache->setData($this->_sCacheFile, $this->_aParams);
79 $this->_oCache->delData($this->_sCacheFile);