protected function setInstallStatus()
{
if (!is_readable($this->getSettingsPath())) {
return;
}
$this->loadSettingsFile();
$this->status['config'] = TRUE;
// must be able to connect to database to jump install steps
$dbSettingsPass = $this->checkDatabaseSettings($this->CONFIG->dbuser, $this->CONFIG->dbpass, $this->CONFIG->dbname, $this->CONFIG->dbhost);
if ($dbSettingsPass == FALSE) {
return;
}
if (!(include_once \Elgg\Application::elggDir()->getPath("engine/lib/database.php"))) {
throw new InstallationException(_elgg_services()->translator->translate('InstallationException:MissingLibrary', array('database.php')));
}
// check that the config table has been created
$query = "show tables";
$result = _elgg_services()->db->getData($query);
if ($result) {
foreach ($result as $table) {
$table = (array) $table;
if (in_array("{$this->CONFIG->dbprefix}config", $table)) {
$this->status['database'] = TRUE;
}
}
if ($this->status['database'] == FALSE) {
return;
}
} else {
// no tables
return;
}
// check that the config table has entries
$query = "SELECT COUNT(*) AS total FROM {$this->CONFIG->dbprefix}config";
$result = _elgg_services()->db->getData($query);
if ($result && $result[0]->total > 0) {
$this->status['settings'] = TRUE;
} else {
return;
}
// check that the users entity table has an entry
$query = "SELECT COUNT(*) AS total FROM {$this->CONFIG->dbprefix}users_entity";
$result = _elgg_services()->db->getData($query);
if ($result && $result[0]->total > 0) {
$this->status['admin'] = TRUE;
} else {
return;
}
}