/**
  * @param Application $app
  */
 private function initializeEnvironmentDetection(Application $app)
 {
     $db_config = array();
     if (file_exists(DIR_APPLICATION . '/config/database.php')) {
         $db_config = (include DIR_APPLICATION . '/config/database.php');
     }
     $environment = $app->environment();
     $app->detectEnvironment(function () use($db_config, $environment, $app) {
         try {
             $installed = $app->isInstalled();
             return $installed;
         } catch (\Exception $e) {
         }
         return isset($db_config['default-connection']) ? $environment : 'install';
     });
 }
Example #2
0
<?php

use Concrete\Core\Application\Application;
/*
 * ----------------------------------------------------------------------------
 * Instantiate concrete5
 * ----------------------------------------------------------------------------
 */
$app = new Application();
/*
 * ----------------------------------------------------------------------------
 * Detect the environment based on the hostname of the server
 * ----------------------------------------------------------------------------
 */
$app->detectEnvironment(array('local' => array('hostname'), 'production' => array('live.site')));
return $app;