42 $this->cache = $cache;
44 $this->logger = $logger;
45 $this->
table = $table;
66 $this->logger->error(
"The name length for configuration variables cannot be greater than 255");
70 return $this->cache->get(
$name,
function() use (
$name) {
71 $escaped_name = $this->db->sanitizeString(
$name);
72 $result = $this->db->getDataRow(
"SELECT * FROM {$this->table} WHERE name = '$escaped_name'");
98 $this->logger->error(
"The name length for configuration variables cannot be greater than 255");
103 $escaped_name = $this->db->sanitizeString(
$name);
104 $escaped_value = $this->db->sanitizeString(
$value);
105 $success = $this->db->insertData(
"INSERT INTO {$this->table}" 106 .
" SET name = '$escaped_name', value = '$escaped_value'" 107 .
" ON DUPLICATE KEY UPDATE value = '$escaped_value'");
125 $result = $this->db->getData(
"SELECT * FROM {$this->table}");
129 $map[$row->name] = $row->value;
130 $this->cache->put($row->name, $row->value);
165 $lastupdated = $this->
get($functionname);
167 $lastupdated = (int) $lastupdated;
168 } elseif ($lastupdated !==
false) {
174 if (is_callable($functionname) && $lastupdated <= $timelastupdatedcheck) {
176 $this->
set($functionname, time());
__construct(Pool $cache, Database $db, Logger $logger, $table)
Constructor.
if($guid==elgg_get_logged_in_user_guid()) $name
elgg_strlen()
Wrapper function for mb_strlen().
loadAll()
Load entire datalist in memory.
runFunctionOnce($functionname, $timelastupdatedcheck=0)
Run a function one time per installation.