getProjectDir().'/var/cache/'.$this->environment; } /** * @return string */ public function getLogDir() { return $this->getProjectDir().'/var/log'; } /** * @return \Generator|\Symfony\Component\HttpKernel\Bundle\BundleInterface[] */ public function registerBundles() { $contents = require $this->getProjectDir().'/config/bundles.php'; foreach ($contents as $class => $envs) { if (isset($envs['all']) || isset($envs[$this->environment])) { yield new $class(); } } } /** * @return string */ public function getRootDir() { if (null === $this->rootDir) { $r = new \ReflectionObject($this); $this->rootDir = str_replace('\\', '/', dirname($r->getFileName())); } return $this->rootDir; } /** * Returns the real root path. * * @return string */ public function getRealRootDir() { return realpath($this->getRootDir().'/../').'/'; } /** * Returns the data path. * * @return string */ public function getDataDir() { return $this->getRealRootDir().'data/'; } /** * @return string */ public function getAppDir() { return $this->getRealRootDir().'app/'; } /** * @return string */ public function getConfigDir() { return $this->getRealRootDir().'app/config/'; } /** * @return string */ public function getConfigurationFile() { return $this->getRealRootDir().'config/configuration.php'; } /** * @param array $configuration */ public function setApi(array $configuration) { new ChamiloApi($configuration); } /** * Check if system is installed * Checks the APP_INSTALLED env value. * * @return bool */ public function isInstalled() { return !empty($this->getContainer()->getParameter('installed')); } /** * @return string */ public function getUrlAppend() { return $this->getContainer()->getParameter('url_append'); } /** * @param ContainerBuilder $container * @param LoaderInterface $loader * * @throws \Exception */ protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader) { $container->setParameter('container.autowiring.strict_mode', true); $container->setParameter('container.dumper.inline_class_loader', true); $confDir = $this->getProjectDir().'/config'; $loader->load($confDir.'/packages/*'.self::CONFIG_EXTS, 'glob'); if (is_dir($confDir.'/packages/'.$this->environment)) { $loader->load($confDir.'/packages/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob'); } $loader->load($confDir.'/services'.self::CONFIG_EXTS, 'glob'); $loader->load($confDir.'/services_'.$this->environment.self::CONFIG_EXTS, 'glob'); } /** * @param RouteCollectionBuilder $routes * * @throws \Symfony\Component\Config\Exception\FileLoaderLoadException */ protected function configureRoutes(RouteCollectionBuilder $routes) { $confDir = $this->getProjectDir().'/config'; if (is_dir($confDir.'/routes/')) { $routes->import($confDir.'/routes/*'.self::CONFIG_EXTS, '/', 'glob'); } if (is_dir($confDir.'/routes/'.$this->environment)) { $routes->import($confDir.'/routes/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); } $routes->import($confDir.'/routes'.self::CONFIG_EXTS, '/', 'glob'); } }