/**
* Do a minimal engine load
*
* @return void
*/
protected function setupSimplecache()
{
// we can't use Elgg\Config::get yet. It fails before the core is booted
$config = $this->config;
$config->loadSettingsFile();
if ($config->getVolatile('dataroot') && $config->getVolatile('simplecache_enabled') !== null) {
// we can work with these...
return;
}
$db = $this->application->getDb();
try {
$rows = $db->getData("\n\t\t\t\tSELECT `name`, `value`\n\t\t\t\tFROM {$db->getTablePrefix()}datalists\n\t\t\t\tWHERE `name` IN ('dataroot', 'simplecache_enabled')\n\t\t\t");
if (!$rows) {
$this->send403('Cache error: unable to get the data root');
}
} catch (\DatabaseException $e) {
if (0 === strpos($e->getMessage(), "Elgg couldn't connect")) {
$this->send403('Cache error: unable to connect to database server');
} else {
$this->send403('Cache error: unable to connect to Elgg database');
}
exit;
// unnecessary, but helps PhpStorm understand
}
foreach ($rows as $row) {
$config->set($row->name, $row->value);
}
if (!$config->getVolatile('dataroot')) {
$this->send403('Cache error: unable to get the data root');
}
}