Example #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;
 }
Example #2
0
 * 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';
        }
        // default config for local database
        $_dbConfig = array('connectionString' => 'mysql:host=localhost;port=3306;dbname=' . $_dbName, 'username' => 'dsp_user', 'password' => 'dsp_user', 'emulatePrepare' => true, 'charset' => 'utf8', 'enableProfiling' => defined('YII_DEBUG'), 'enableParamLogging' => defined('YII_DEBUG'), 'schemaCachingDuration' => 3600);
    }
}
/**
 * Load up the common configurations between the web and background apps,
 * setting globals whilst at it. REQUIRED file!
 */
/** @noinspection PhpIncludeInspection */
$_commonConfig = (require __DIR__ . COMMON_CONFIG_PATH);
//  Add in our new metadata
Example #3
0
 public function testFabric()
 {
     $this->assertTrue(is_string(Fabric::hostedPrivatePlatform(true)));
 }
Example #4
0
//	Where the log files go and the name...
$_logFilePath = $_basePath . '/log';
$_logFileName = basename(\Kisma::get('app.log_file'));
//	Our app's name
$_appName = 'Portal Sandbox Test Suite';
/**
 * Aliases
 */
file_exists(__DIR__ . ALIASES_CONFIG_PATH) && (require __DIR__ . ALIASES_CONFIG_PATH);
/**
 * Application Paths
 */
\Kisma::set('app.app_name', $_appName);
\Kisma::set('app.doc_root', $_docRoot);
\Kisma::set('app.log_path', $_logFilePath);
\Kisma::set('app.vendor_path', $_vendorPath);
\Kisma::set('app.log_file_name', $_logFileName);
\Kisma::set('app.project_root', $_basePath);
/**
 * Database Caching
 */
$_dbCache = $_dbCacheEnabled ? array('class' => 'CDbCache', 'connectionID' => 'db', 'cacheTableName' => 'df_sys_cache', 'autoCreateCacheTable' => true) : null;
/**
 * Set up and return the common settings...
 */
if (Fabric::fabricHosted()) {
    $_instanceSettings = array('storage_base_path' => '/data/storage/' . \Kisma::get('platform.storage_key'), 'storage_path' => '/data/storage/' . \Kisma::get('platform.storage_key') . '/blob', 'private_path' => \Kisma::get('platform.private_path'), 'snapshot_path' => \Kisma::get('platform.private_path') . '/snapshots', 'applications_path' => '/data/storage/' . \Kisma::get('platform.storage_key') . '/blob/applications', 'library_path' => '/data/storage/' . \Kisma::get('platform.storage_key') . '/blob/lib', 'plugins_path' => '/data/storage/' . \Kisma::get('platform.storage_key') . '/blob/plugins', 'dsp_name' => \Kisma::get('platform.dsp_name'), 'dsp.storage_id' => \Kisma::get('platform.storage_key'), 'dsp.private_storage_id' => \Kisma::get('platform.private_storage_key'));
} else {
    $_instanceSettings = array('storage_base_path' => $_basePath . '/storage', 'storage_path' => $_basePath . '/storage', 'private_path' => $_basePath . '/storage/.private', 'snapshot_path' => $_basePath . '/storage/.private/snapshots', 'applications_path' => $_basePath . '/storage/applications', 'library_path' => $_basePath . '/storage/lib', 'plugins_path' => $_basePath . '/storage/plugins', 'dsp_name' => gethostname(), 'dsp.storage_id' => null, 'dsp.private_storage_id' => null);
}
return array_merge($_instanceSettings, array('base_path' => $_basePath, 'dsp.version' => DSP_VERSION, 'dsp.name' => $_instanceSettings['dsp_name'], 'dsp.auth_endpoint' => DEFAULT_INSTANCE_AUTH_ENDPOINT, 'cloud.endpoint' => DEFAULT_CLOUD_API_ENDPOINT, 'oauth.salt' => 'rW64wRUk6Ocs+5c7JwQ{69U{]MBdIHqmx9Wj,=C%S#cA%+?!cJMbaQ+juMjHeEx[dlSe%h%kcI', 'dsp.allow_remote_logins' => true, 'dsp.allow_admin_remote_logins' => true, 'adminEmail' => DEFAULT_SUPPORT_EMAIL, 'dsp.service_config' => require __DIR__ . SERVICES_CONFIG_PATH, 'dsp.service_location_map' => array(), 'dsp.default_services' => array(array('api_name' => 'user', 'name' => 'User Login'), array('api_name' => 'system', 'name' => 'System Configuration'), array('api_name' => 'api_docs', 'name' => 'API Documentation')), 'dsp.default_app' => '/launchpad/index.html', 'dsp.confirm_invite_url' => '/confirm_invite.html', 'dsp.confirm_register_url' => '/confirm_reg.html', 'dsp.confirm_reset_url' => '/confirm_reset.html', 'dsp.db_max_records_returned' => 1000, 'admin.resource_schema' => require __DIR__ . DEFAULT_ADMIN_RESOURCE_SCHEMA, 'admin.default_theme' => 'united'));