Exemplo n.º 1
0
/**
 * Aetolos - Database Initialization
 *
 * Initialize configuration database
 *
 * @copyright Noumenia (C) 2015 - All rights reserved - Software Development - www.noumenia.gr
 * @license GNU GPL v3.0
 * @package aetolos
 * @subpackage databaseinit
 */
// No direct access - loadable only
if (!defined('AET_IN')) {
    die("No Access");
}
// Open database
$db = new DatabaseSqlite3();
$rc = $db->open();
if ($rc === false) {
    echo "[ERROR] Encountered an error while opening the database.\n";
    exit(9);
}
// Load global configuration from database
$rc = Config::loadDatabase($db);
if ($rc === false) {
    echo "[ERROR] Encountered an error while loading the global configuration. If this is a new installation, please run the setup to initialize the database.\n";
    exit(9);
}
// Check database version
$rc = Config::read('aetolos|dbversion');
if (AET_DB_VER !== $rc) {
    echo "[ERROR] Database mismatch error. Please run the setup to update the database.\n";
Exemplo n.º 2
0
/**
 * Aetolos - Setup
 *
 * Perform first time installation or setup existing system
 *
 * @copyright Noumenia (C) 2015 - All rights reserved - Software Development - www.noumenia.gr
 * @license GNU GPL v3.0
 * @package aetolos
 * @subpackage setup
 */
// No direct access - loadable only
if (!defined('AET_IN')) {
    die("No Access");
}
// Open a database connection
$db = new DatabaseSqlite3();
$rc = $db->open();
if ($rc === false) {
    return false;
}
// Perform database setup
$rc = Config::setupDatabase($db);
if ($rc === false) {
    return false;
}
// Perform operating system setup
$setup = new SetupCentOS7();
$rc = $setup->run($db);
if ($rc === false) {
    echo "[ERROR] Encountered an error while performing system setup.\n";
}