Esempio n. 1
0
$_POST['uPasswordConfirm'] = $cliconfig['admin-password'];
$_POST['uEmail'] = $cliconfig['admin-email'];
if ($e->has()) {
    foreach ($e->getList() as $ei) {
        print "ERROR: " . $ei . "\n";
    }
    exit(1);
}
$cnt->configure($e);
if ($e->has()) {
    foreach ($e->getList() as $ei) {
        print "ERROR: " . $ei . "\n";
    }
    exit(1);
} else {
    $spl = StartingPointPackage::getClass($cliconfig['starting-point']);
    require DIR_CONFIG_SITE . '/site_install.php';
    require DIR_CONFIG_SITE . '/site_install_user.php';
    $routines = $spl->getInstallRoutines();
    try {
        foreach ($routines as $r) {
            print $r->getProgress() . '%: ' . $r->getText() . "\n";
            call_user_func(array($spl, $r->getMethod()));
        }
    } catch (Exception $ex) {
        print "ERROR: " . $ex->getMessage() . "\n";
        $cnt->reset();
    }
    if ($cliconfig['default-locale']) {
        \Config::save('concrete.locale', $cliconfig['default-locale']);
    }
$cliconfig = array_merge($_defaults, $cliArguments);
// Configurations
require $cliconfig['core'] . "/bootstrap/configure.php";
// Autoloader
require $cliconfig['core'] . "/bootstrap/autoload.php";
// CMS
$cms = (require $cliconfig['core'] . "/bootstrap/start.php");
// Database connection
\Database::extend('install', function () use($cliconfig) {
    return \Database::getFactory()->createConnection(array('host' => $cliconfig['db-server'], 'user' => $cliconfig['db-username'], 'password' => $cliconfig['db-password'], 'database' => $cliconfig['db-database']));
});
\Database::setDefaultConnection('install');
$cms['config']['database.connections.install'] = array();
// Disable all caches
Cache::disableAll();
// Install data setup
$passHash = new PasswordHash(Config::get('concrete.user.password.hash_cost_log2'), Config::get('concrete.user.password.hash_portable'));
define('INSTALL_USER_EMAIL', $cliconfig['admin-email']);
define('INSTALL_USER_PASSWORD_HASH', $passHash->HashPassword($cliconfig['admin-password']));
define('INSTALL_STARTING_POINT', $cliconfig['starting-point']);
define('SITE', $cliconfig['site']);
$startingPoint = StartingPointPackage::getClass(INSTALL_STARTING_POINT);
$routines = $startingPoint->getInstallRoutines();
// Redefine the error handlers, overriding any registered by C5
set_error_handler('customErrorHandler');
foreach ($routines as $r) {
    fwrite(STDOUT, sprintf("%s: %s \n", $r->getProgress(), $r->getText()));
    call_user_func(array($startingPoint, $r->getMethod()));
}
fwrite(STDOUT, "!!!!!! Installation Complete: OK !!!!!!\n");
exit(0);