예제 #1
0
 public function __construct($configEnvironment = NULL, $configFilePath = NULL, $autoStart = FALSE)
 {
     Saf_Kickstart::go();
     try {
         $this->_config = Saf_Config::load(!is_null($configFilePath) ? $configFilePath : APPLICATION_CONFIG, !is_null($configEnvironment) ? $configEnvironment : APPLICATION_ENV);
     } catch (Saf_Config_Exception_InvalidEnv $e) {
         Saf_Debug::out("Requested configutation section \"{$configEnvironment}\" not found, trying default...");
         $this->_config = Saf_Config::load($configFilePath, 'default');
     }
     $this->_applyConfig();
     if ('install' == APPLICATION_STATUS && !array_key_exists('install', $_REQUEST)) {
         //#TODO how to access install
         $e = new Exception('This application is Install Mode and currently unavailable.');
         Saf_Status::set(Saf_Status::STATUS_503_UNAVAILABLE);
         Saf_Kickstart::exceptionDisplay($e);
     }
     if ('down' == APPLICATION_STATUS) {
         $e = new Exception('This application is in Maintenance Mode and currently unavailable.');
         Saf_Status::set(Saf_Status::STATUS_503_UNAVAILABLE);
         Saf_Kickstart::exceptionDisplay($e);
     }
     if ('online' != APPLICATION_STATUS) {
         $e = new Exception('This application is an unrecognized mode: ' . APPLICATION_STATUS . ' and currently unavailable.');
         Saf_Status::set(Saf_Status::STATUS_503_UNAVAILABLE);
         Saf_Kickstart::exceptionDisplay($e);
     }
     if ($autoStart) {
         $this->start();
     }
 }
예제 #2
0
 public function __construct($configEnvironment = NULL, $configFilePath = NULL, $autoStart = FALSE)
 {
     Saf_Kickstart::go();
     try {
         $this->_config = Saf_Config::load(!is_null($configFilePath) ? $configFilePath : APPLICATION_CONF, !is_null($configEnvironment) ? $configEnvironment : APPLICATION_ENV);
     } catch (Saf_Config_Exception_InvalidEnv $e) {
         Saf_Debug::out("Requested configutation section \"{$configEnvironment}\" not found, trying default...");
         $this->_config = Saf_Config::load($configFilePath, 'default');
     }
     $this->_autoLoad = $this->_config->getOptional('autoLoad', FALSE);
     $this->_debugMode = $this->_config->getOptional('debug:mode', Saf_Debug::DEBUG_MODE_OFF);
     $this->_errorMode = $this->_config->getOptional('error:mode', Saf_Debug::ERROR_MODE_INTERNAL);
     Saf_Debug::init($this->_debugMode, $this->_errorMode, FALSE);
     Saf_Kickstart::initializeAutoloader($this->_autoLoad);
     //#TODO #2.0.0 bootstrap config
     //#TODO #2.0.0 init plugins
     // loggingf
     // db
     // etc.
     if ($this->_config->has('plugins')) {
         foreach ($this->_config->get('plugins:+') as $pluginName => $pluginConfig) {
         }
         print_r(array('plugins', gettype($this->_config->get('plugins:+')), $this->_config->get('plugins:+')));
         print_r(array('plugins2', gettype($this->_config->get('plugins2:+')), $this->_config->get('plugins2')));
     }
     /*
      foreach() {
      
      }
      * 
      if(
      		'install' == APPLICATION_STATUS
      		&& !array_key_exists('install', $_REQUEST)
      ) {
     $e = new Exception('This application is Install Mode and currently unavailable.');
     Saf_Status::set(Saf_Status::STATUS_503_UNAVAILABLE);
     Saf_Kickstart::exceptionDisplay($e);
     }
     
     if('down' == APPLICATION_STATUS) {
     $e = new Exception('This application is in Maintenance Mode and currently unavailable.');
     Saf_Status::set(Saf_Status::STATUS_503_UNAVAILABLE);
     Saf_Kickstart::exceptionDisplay($e);
     }
     */
     if ($autoStart) {
         $this->start($autoStart);
     }
 }