/** * From bootstrap/start.php, pass in an instance of $app to this method to * override C5's default method of persisting config settings to flat file * storage. * * @param \Concrete\Core\Application\Application $app */ public static function bindToApp(\Concrete\Core\Application\Application $app) { $fileSystem = new FileSystem(); $configLoader = new FileLoader($fileSystem); $configSaver = new self(); $app->instance('config', new ConfigRepository($configLoader, $configSaver, $app->environment())); }
/** * @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'; }); }