protected function installSystem($arParams)
{
$arConfig = [];
$dbConfig = [];
if ($arParams['dbType'] == 'mysql') {
$dbConfig[$arParams['dbType']] = ['driver' => $arParams['dbType'], 'host' => $arParams['dbHost'], 'database' => $arParams['dbName'], 'username' => $arParams['dbLogin'], 'password' => $arParams['dbPassword'], 'charset' => 'utf8', 'collation' => 'utf8_general_ci', 'prefix' => ''];
} elseif ($arParams['dbType'] == 'sqlite') {
$file = RESOURCE_PATH . 'database/' . strtolower($arParams['dbFileName']) . '.sqlite';
FileWorker::saveFile($file, '');
$dbConfig[$arParams['dbType']] = ['driver' => $arParams['dbType'], 'database' => $file, 'prefix' => ''];
}
$arConfig['db'] = $dbConfig;
$arConfig['slim']['settings'] = ['db_driver' => $arParams['dbType'], 'displayErrorDetails' => $arParams['displayErrorDetails'], 'debug' => $arParams['debug'], 'use_log' => $arParams['use_log'], 'log_system' => $arParams['log_system'], 'log_filename' => 'app.log', 'register_log' => $arParams['register_log'], 'determineRouteBeforeAppMiddleware' => true, 'protect_double_route_register' => true];
$arConfig['view'] = ['template_path' => APP_PATH . 'templates', 'twig' => ['cache' => CACHE_PATH . 'twig', 'debug' => $arParams['debug'], 'auto_reload' => $arParams['debug']]];
$arConfig['cache'] = array('cache.default' => 'files', 'cache.stores.files' => array('driver' => 'file', 'path' => CACHE_PATH . 'slimcms'));
FileWorker::savePhpReturnFile(APP_PATH . 'config/local/autoconfig.php', $arConfig);
$this->registerDB($dbConfig[$arParams['dbType']]);
if (isset($this->specialData['coreClassName']) && class_exists($this->specialData['coreClassName'])) {
$cl = $this->specialData['coreClassName'];
ModuleLoader::install(new $cl());
} else {
ModuleLoader::install(new \Modules\Core\Module());
}
if ($arParams['modules'] && is_array($arParams['modules'])) {
foreach ($arParams['modules'] as $module) {
$cl = '\\Modules\\' . $module . '\\Module';
if (class_exists($cl)) {
ModuleLoader::install(new $cl());
}
}
}
}