<?php /** * This file is part of Contao. * * Copyright (c) 2005-2015 Leo Feyer * * @license LGPL-3.0+ */ use Contao\Config; use Contao\InstallationBundle\ClassLoader\LibraryLoader; use Contao\InstallationBundle\Controller\InstallationController; use Contao\InstallationBundle\DependencyInjection\ContainerFactory; error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED); $loader = (require_once __DIR__ . '/../vendor/autoload.php'); require_once __DIR__ . '/../app/AppKernel.php'; require_once __DIR__ . '/../vendor/contao/core-bundle/src/Resources/contao/helper/functions.php'; $kernel = new AppKernel('prod', false); // Register the class loader $libraryLoader = new LibraryLoader($kernel->getRootDir()); $libraryLoader->register(); Config::preload(); // Create the container $container = ContainerFactory::create($kernel->getRootDir()); // Run the controller $controller = new InstallationController(); $controller->setContainer($container); $response = $controller->indexAction(); $response->send();
use Symfony\Component\HttpFoundation\Request; use LoginCidadao\CoreBundle\Security\Compatibility\RamseyUuidFeatureSet; // If you don't want to setup permissions the proper way, just uncomment the following PHP line // read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information //umask(0000); $loader = (require_once __DIR__ . '/../app/bootstrap.php.cache'); Debug::enable(); require_once __DIR__ . '/../app/AppKernel.php'; $kernel = new AppKernel('dev', true); $uuidFactory = new \Ramsey\Uuid\UuidFactory(new RamseyUuidFeatureSet()); \Ramsey\Uuid\Uuid::setFactory($uuidFactory); $generator = new \Qandidate\Stack\UuidRequestIdGenerator(); $stack = new \Qandidate\Stack\RequestId($kernel, $generator); $kernel->loadClassCache(); try { $path = implode(DIRECTORY_SEPARATOR, array($kernel->getRootDir(), 'config', 'parameters.yml')); $params = Yaml::parse(file_get_contents($path)); Request::setTrustedProxies($params['parameters']['trusted_proxies']); } catch (Exception $ex) { http_response_code(500); exit('Invalid configuration'); } $request = Request::createFromGlobals(); $allowed = $params['parameters']['dev_allowed']; if (!IpUtils::checkIp($request->getClientIp(), $allowed)) { header('HTTP/1.0 403 Forbidden'); exit('You are not allowed to access this file.'); } $response = $stack->handle($request); $response->send(); $kernel->terminate($request, $response);
/** * @return string */ protected function getParametersPath() { return $this->kernel->getRootDir() . '/config/parameters.yml'; }
throw new \LogicException('Run "composer install --dev" to create autoloader.'); } // Set kernel folder path dynamically to avoid absolute path in config file $_SERVER['KERNEL_DIR'] = realpath(__DIR__ . getenv('KERNEL_DIR')); $loader = (require $autoload); $output = new ConsoleOutput(); AnnotationRegistry::registerLoader(array($loader, 'loadClass')); $autoloadFlag = getenv('AUTOLOAD_FIXTURES'); if (true === (bool) $autoloadFlag) { $kernelDir = $_SERVER['KERNEL_DIR']; $appKernelClass = $kernelDir . DIRECTORY_SEPARATOR . 'AppKernel.php'; require $appKernelClass; $kernel = new AppKernel('test', true); $kernel->boot(); $application = new Application($kernel); $kernelDir = $kernel->getRootDir(); $loadCommand = new LoadDataFixturesDoctrineCommand(); $purgeCommand = new FixturesPurgeCommand(); $application->add($purgeCommand); $purgeInput = new ArrayInput(array('command' => 'diamante:fixtures:purge', '--no-interaction' => true)); $application->add($loadCommand); $input = new ArrayInput(array('command' => 'doctrine:fixtures:load', '--fixtures' => "{$kernelDir}/../src/Diamante/EmbeddedFormBundle/DataFixtures/Test", '--append' => true, '--no-interaction' => true)); try { $output->writeln("[32m[1mRemoving previously loaded test fixtures[0m"); $purgeCommand->run($purgeInput, $output); $output->writeln("Loading fixtures...\n"); $loadCommand->run($input, $output); } catch (\Exception $e) { $output->writeln("\n"); $output->writeln("Failed to load fixtures. Error: " . $e->getMessage()); $output->writeln("\n");
/** * * @param type $filename * @return type */ protected function getFilePath($filename) { return sprintf("%s/%s", $this->kernel->getRootDir(), $filename); }
<?php // if you don't want to setup permissions the proper way, just uncomment the following PHP line // read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information //umask(0000); // this check prevents access to debug front controllers that are deployed by accident to production servers. // feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) { header('HTTP/1.0 403 Forbidden'); exit('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.'); } require_once __DIR__ . '/../app/bootstrap.php.cache'; require_once __DIR__ . '/../app/AppKernel.php'; use Symfony\Component\HttpFoundation\Request; $kernel = new AppKernel('dev', true); require_once $kernel->getRootDir() . '/../vendor/ladybug/lib/Ladybug/Autoloader.php'; Ladybug\Autoloader::register(); ladybug_set('object.max_nesting_level', 4); echo '<h2>Autoload:</h2>'; ld($loader); echo '<blockquote>'; echo '$loader->findFile(\'Symfony\\Component\\HttpFoundation\\Request\');<br/>'; echo $loader->findFile('Symfony\\Component\\HttpFoundation\\Request'); echo '</blockquote>'; echo '<h2>AppKernel:</h2>'; ld($kernel); //ob_flush(); $kernel->loadClassCache(); $request = Request::createFromGlobals(); echo '<hr/>'; echo '<h2>HTTP Request:</h2>';
* Copyright (c) 2005-2015 Leo Feyer * * @license LGPL-3.0+ */ use Contao\ClassLoader; use Contao\Config; use Contao\InstallationBundle\ClassLoader\LibraryLoader; use Contao\InstallationBundle\Controller\InstallationController; use Contao\InstallationBundle\DependencyInjection\ContainerFactory; use Contao\System; error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED); $loader = (require_once __DIR__ . '/../vendor/autoload.php'); require_once __DIR__ . '/../app/AppKernel.php'; require_once __DIR__ . '/../vendor/contao/core-bundle/src/Resources/contao/config/constants.php'; require_once __DIR__ . '/../vendor/contao/core-bundle/src/Resources/contao/helper/functions.php'; $kernel = new AppKernel('prod', false); // Un-normalize the path (see #208) $rootDir = strtr($kernel->getRootDir(), '/', DIRECTORY_SEPARATOR); // Register the class loader $libraryLoader = new LibraryLoader($rootDir); $libraryLoader->register(); Config::preload(); // Create the container $container = ContainerFactory::create($rootDir); System::setContainer($container); ClassLoader::scanAndRegister(); // Run the controller $controller = new InstallationController(); $controller->setContainer($container); $response = $controller->indexAction(); $response->send();