/** * Updates the current object to the database. * Only the value is updated!!! * * @param bool $strPrevId * * @return bool */ public function updateObjectToDb($strPrevId = false) { $objChangelog = new class_module_system_changelog(); $objChangelog->createLogEntry($this, class_module_system_changelog::$STR_ACTION_EDIT); self::$arrInstanceCache = null; if (!class_module_system_setting::checkConfigExisting($this->getStrName())) { class_logger::getInstance()->addLogRow("new constant " . $this->getStrName() . " with value " . $this->getStrValue(), class_logger::$levelInfo); $strQuery = "INSERT INTO " . _dbprefix_ . "system_config\n (system_config_id, system_config_name, system_config_value, system_config_type, system_config_module) VALUES\n (?, ?, ?, ?, ?)"; return $this->objDB->_pQuery($strQuery, array(generateSystemid(), $this->getStrName(), $this->getStrValue(), (int) $this->getIntType(), (int) $this->getIntModule())); } else { class_logger::getInstance()->addLogRow("updated constant " . $this->getStrName() . " to value " . $this->getStrValue(), class_logger::$levelInfo); $strQuery = "UPDATE " . _dbprefix_ . "system_config\n SET system_config_value = ?\n WHERE system_config_name = ?"; return $this->objDB->_pQuery($strQuery, array($this->getStrValue(), $this->getStrName())); } }
/** * Registers a constant to load at system-startup * * @param string $strName * @param string $strValue * @param int $intType @link class_module_system_setting::int_TYPE_XX * @param int $intModule * @return bool */ public function registerConstant($strName, $strValue, $intType, $intModule) { //register to current runtime env? if (!defined($strName)) { define($strName, $strValue); } if (!class_module_system_setting::checkConfigExisting($strName)) { $objConstant = new class_module_system_setting(); $objConstant->setStrName($strName); $objConstant->setStrValue($strValue); $objConstant->setIntType($intType); $objConstant->setIntModule($intModule); $bitReturn = $objConstant->updateObjectToDb(); $this->objDB->flushQueryCache(); return $bitReturn; } else { return false; } }