Exemplo n.º 1
0
 public function __construct()
 {
     if ($this->config === null) {
         $this->config = config::getConfig(__CLASS__);
     }
     $this->config['cookie.user'] .= ':' . crc32(environment::getCurrentEnvironment());
 }
Exemplo n.º 2
0
 public function __construct()
 {
     $config = config::getConfig(__CLASS__);
     $this->cookie = $config['cookie'];
     $this->cookie['name'] .= ':' . crc32(environment::getCurrentEnvironment());
     $aclClass = $config['acl_class'];
     $this->aclManager = new $aclClass();
     if (!$this->aclManager instanceof aclManagerInterface) {
         throw new aclException("{$aclClass} is not implements aclManagerInterface");
     }
 }
Exemplo n.º 3
0
 protected function initialize()
 {
     $initCacheKey = 'auth/groups/init/' . environment::getCurrentEnvironment();
     if (!cache::getCached($initCacheKey)) {
         foreach ($this->getDefaultGroups() as $defaultGroup) {
             if (!$this->_getBy([self::FIELD__GROUP_ALIAS => $defaultGroup[self::FIELD__GROUP_ALIAS]])) {
                 $this->_create($defaultGroup);
             }
         }
         cache::setCached($initCacheKey, true);
     }
 }
Exemplo n.º 4
0
 protected function initialize($force = false)
 {
     $initCacheKey = 'auth/users/init/' . environment::getCurrentEnvironment();
     if ($force || !cache::getCached($initCacheKey)) {
         foreach ($this->getDefaultUsers() as $defaultUser) {
             $defaultUser = $this->convertDataFromForm($defaultUser);
             if (!$this->_getBy([self::FIELD__LOGIN => $defaultUser[self::FIELD__LOGIN]])) {
                 $this->_create($defaultUser);
             }
         }
         cache::setCached($initCacheKey, true);
     }
 }
Exemplo n.º 5
0
<?php

namespace mpcmf;

use mpcmf\system\configuration\environment;
environment::setCurrentEnvironment(environment::ENV_PRODUCTION);
$localEnvironmentFile = APP_ROOT . '/environment.local.php';
if (file_exists($localEnvironmentFile)) {
    require_once $localEnvironmentFile;
}
if (!defined('MPCMF_DEBUG')) {
    define('MPCMF_DEBUG', false);
}
if (!defined('MPCMF_LL_DEBUG')) {
    define('MPCMF_LL_DEBUG', false);
}
Exemplo n.º 6
0
<?php

namespace mpcmf;

use mpcmf\system\configuration\environment;
environment::setCurrentEnvironment(environment::ENV_DEBUG);
define('MPCMF_DEBUG', true);
Exemplo n.º 7
0
 public static function getConfig($name, $environment = null)
 {
     static $currentEnvironment, $baseEnvironment;
     profiler::addStack('config::get');
     if ($currentEnvironment === null) {
         $currentEnvironment = environment::getCurrentEnvironment();
         MPCMF_LL_DEBUG && error_log("Initialize config current environment: {$currentEnvironment}");
     }
     if ($baseEnvironment === null) {
         $baseEnvironment = environment::getBaseEnvironment();
         MPCMF_LL_DEBUG && error_log("Initialize config base environment: {$baseEnvironment}");
     }
     if ($environment === null) {
         $environment = $currentEnvironment;
     }
     MPCMF_LL_DEBUG && error_log("Input environment: {$environment}");
     $packageName = self::getPackageName($name);
     class_exists('log') && log::factory()->addDebug("Loading config for {$packageName}");
     if (!isset(self::$loaded[$packageName])) {
         self::loadPackageConfig($packageName);
     }
     class_exists('log') && log::factory()->addDebug("Set by name: {$name} / env: {$environment}");
     if ($environment !== environment::ENV_DEFAULT) {
         if (isset(self::$loaded[$packageName][$currentEnvironment])) {
             MPCMF_LL_DEBUG && error_log("Return requested config [{$packageName}] {$currentEnvironment}");
             return self::$loaded[$packageName][$currentEnvironment];
         } elseif ($baseEnvironment !== environment::ENV_DEFAULT && isset(self::$loaded[$packageName][$baseEnvironment])) {
             MPCMF_LL_DEBUG && error_log("Use base config [{$packageName}] {$baseEnvironment}");
             return self::$loaded[$packageName][$baseEnvironment];
         } else {
             MPCMF_LL_DEBUG && error_log("Return default config [{$packageName}] {$currentEnvironment}");
             return self::$loaded[$packageName][environment::ENV_DEFAULT];
         }
     }
     MPCMF_LL_DEBUG && error_log("Return config [{$packageName}] " . environment::ENV_DEFAULT);
     return self::$loaded[$packageName][environment::ENV_DEFAULT];
 }