[FrameworkBundle] added 'document_root' option for File objects
This commit is contained in:
parent
bdc7ae8c52
commit
acb19bc43f
@ -85,6 +85,12 @@ class FrameworkExtension extends Extension
|
||||
$container->setParameter('debug.file_link_format', $pattern);
|
||||
}
|
||||
|
||||
foreach (array('document_root', 'document-root') as $key) {
|
||||
if (isset($config[$key])) {
|
||||
$container->setParameter('document_root', $config[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$container->hasDefinition('event_dispatcher')) {
|
||||
$loader = new XmlFileLoader($container, array(__DIR__.'/../Resources/config', __DIR__.'/Resources/config'));
|
||||
$loader->load('services.xml');
|
||||
|
@ -23,6 +23,7 @@ use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddClassesToCach
|
||||
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslatorPass;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
/**
|
||||
@ -43,6 +44,10 @@ class FrameworkBundle extends Bundle
|
||||
$container->get('error_handler');
|
||||
}
|
||||
|
||||
if ($this->container->hasParameter('document_root')) {
|
||||
File::setDocumentRoot($this->container->getParameter('document_root'));
|
||||
}
|
||||
|
||||
// the session ID should always be included in the CSRF token, even
|
||||
// if default CSRF protection is not enabled
|
||||
if ($container->has('form.default_context') && $container->has('session')) {
|
||||
|
Reference in New Issue
Block a user