Inheritance: implements App\Source\Interfaces\IModuleLoader
Exemplo n.º 1
1
 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());
             }
         }
     }
 }
Exemplo n.º 2
1
define('RESOURCE_PATH', ROOT_PATH . 'resource' . DIRECTORY_SEPARATOR);
define('MODULE_PATH', ROOT_PATH . 'modules' . DIRECTORY_SEPARATOR);
$classLoader = (require VENDOR_PATH . 'autoload.php');
require SLIM_PATH . 'Helpers' . DIRECTORY_SEPARATOR . 'functions.php';
/**
 * Load the configuration
 */
$config = array('path.app' => APP_PATH, 'path.root' => ROOT_PATH, 'path.slim' => SLIM_PATH, 'path.cache' => CACHE_PATH, 'path.public' => PUBLIC_PATH, 'path.module' => MODULE_PATH, 'path.resource' => RESOURCE_PATH);
$clearCache = false;
if (isset($_REQUEST['clear_cache'])) {
    $clearCache = true;
}
/** include Config files */
$config += ConfigWorker::init($clearCache)->all();
if (!isset($config['slim'])) {
    $container = new Container(['debug' => true, 'use_log' => false, 'determineRouteBeforeAppMiddleware' => true, 'displayErrorDetails' => true]);
    $app = AppFactory::setInstance(new SlimCMS($container));
    ModuleLoader::bootEasyModule(new Modules\SystemInstaller\Module());
    return $app;
}
if ($config['slim']['settings']['debug']) {
    error_reporting(E_ALL ^ E_NOTICE);
}
$container = new Container($config['slim']);
$container->config = $config;
$app = AppFactory::setInstance(new SlimCMS($container));
$container->modules = new SModuleManager($clearCache);
$container->modules->loadModules(MODULE_PATH);
ModuleLoader::bootCore($container->modules->module('Core'));
ModuleLoader::bootLoadModules($container->modules);
return $app;
Exemplo n.º 3
0
 protected function initMicroModule($module)
 {
     $module->setConfig($this->getConfig());
     /*       if(){
                 $extended = function () use ($callable, $module) {
                     return new $callable($module);
                 };
             }*/
     ModuleLoader::bootEasyModule($module);
 }