function set($name, $value)
{
$name = trim($name);
// cannot store anything longer than 255 characters in db, so catch before we set
if (elgg_strlen($name) > 255) {
$this->logger->error("The name length for configuration variables cannot be greater than 255");
return false;
}
$this->CONFIG->{$name} = $value;
$dbprefix = $this->CONFIG->dbprefix;
$sql = "\n\t\t\tINSERT INTO {$dbprefix}config\n\t\t\tSET name = :name,\n\t\t\t\tvalue = :value\n\t\t\tON DUPLICATE KEY UPDATE value = :value\n\t\t";
$params = [':name' => $name, ':value' => serialize($value)];
$version = (int) $this->CONFIG->version;
if (!empty($version) && $version < 2016102500) {
// need to do this the old way as long as site_guid columns have not been dropped
$sql = "\n\t\t\t\tINSERT INTO {$dbprefix}config\n\t\t\t\tSET name = :name,\n\t\t\t\t\tvalue = :value,\n\t\t\t\t\tsite_guid = :site_guid\n\t\t\t\tON DUPLICATE KEY UPDATE value = :value\n\t\t\t";
$params[':site_guid'] = 1;
}
$result = $this->db->insertData($sql, $params);
$this->boot->invalidateCache();
return $result !== false;
}