Exemple #1
0
 /**
  * Perform the appropriate action based on the current DSP state
  *
  * @param int $state
  *
  * @return bool
  */
 protected function _handleAction($state)
 {
     Platform::setPlatformState('ready', $state);
     switch ($state) {
         case PlatformStates::INIT_REQUIRED:
             $this->actionInitSystem();
             break;
         case PlatformStates::SCHEMA_REQUIRED:
             $this->actionUpgradeSchema();
             break;
         case PlatformStates::UPGRADE_REQUIRED:
             $this->actionUpgrade();
             break;
         case PlatformStates::ADMIN_REQUIRED:
             if (Fabric::fabricHosted()) {
                 $this->actionActivate();
             } else {
                 $this->actionInitAdmin();
             }
             break;
         case PlatformStates::DATA_REQUIRED:
             $this->actionInitData();
             break;
         case PlatformStates::WELCOME_REQUIRED:
             $this->actionWelcome();
             break;
         default:
             return false;
     }
     return true;
 }
Exemple #2
0
        foreach ($_envConfig as $_key => $_value) {
            if (!is_string($_value)) {
                $_value = json_encode($_value);
            }
            if (false === putenv($_key . '=' . $_value)) {
                Log::error('Error setting environment variable: ' . $_key . ' = ' . $_value);
            }
        }
    }
}
/**
 * Load up the database configuration, free edition, private hosted, or others.
 * Look for non-default database config to override.
 */
if (false === ($_dbConfig = Pii::includeIfExists(__DIR__ . DATABASE_CONFIG_PATH, true))) {
    if (Fabric::fabricHosted()) {
        $_fabricHosted = true;
        list($_dbConfig, $_metadata) = Fabric::initialize();
    } else {
        /**
         * Database names vary by type of DSP:
         *
         *        1. Free Edition/Hosted:   DSP name
         *        2. Hosted Private:        hpp_<DSP Name>
         *        3. All others:            dreamfactory or whatever is in non-default config.
         */
        if (false !== ($_host = Fabric::hostedPrivatePlatform(true))) {
            $_dbName = 'hpp_' . str_ireplace(array('.dreamfactory.com', '-', '.cloud', '.'), array(null, '_', null, '_'), $_host);
        } else {
            $_dbName = 'dreamfactory';
        }