当前位置: 首页>>代码示例>>PHP>>正文


PHP AppKernel::getRootDir方法代码示例

本文整理汇总了PHP中AppKernel::getRootDir方法的典型用法代码示例。如果您正苦于以下问题:PHP AppKernel::getRootDir方法的具体用法?PHP AppKernel::getRootDir怎么用?PHP AppKernel::getRootDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AppKernel的用法示例。


在下文中一共展示了AppKernel::getRootDir方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: AppKernel

<?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();
开发者ID:swissviet,项目名称:heb-4,代码行数:29,代码来源:install.php

示例2: AppKernel

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);
开发者ID:redelivre,项目名称:login-cidadao,代码行数:31,代码来源:app_dev.php

示例3: getParametersPath

 /**
  * @return string
  */
 protected function getParametersPath()
 {
     return $this->kernel->getRootDir() . '/config/parameters.yml';
 }
开发者ID:Codixis,项目名称:CSBill,代码行数:7,代码来源:SettingsLoader.php

示例4: realpath

    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");
开发者ID:gitter-badger,项目名称:diamantedesk-application,代码行数:31,代码来源:bootstrap.php

示例5: getFilePath

 /**
  * 
  * @param type $filename
  * @return type
  */
 protected function getFilePath($filename)
 {
     return sprintf("%s/%s", $this->kernel->getRootDir(), $filename);
 }
开发者ID:andou,项目名称:gancin,代码行数:9,代码来源:ConfigurationManager.php

示例6: header

<?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>';
开发者ID:raulfraile,项目名称:internals-desymfony2012,代码行数:31,代码来源:app_dev.php

示例7: AppKernel

 * 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();
开发者ID:siggj,项目名称:standard-edition,代码行数:31,代码来源:install.php


注:本文中的AppKernel::getRootDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。