mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/13616] Uses symfony/proxy-manager-bridge to lazy load twig lexer
PHPBB3-13616
This commit is contained in:
parent
e8762ce3cb
commit
5cdbef860d
8 changed files with 316 additions and 28 deletions
|
@ -443,6 +443,13 @@
|
|||
<delete file="${dir}/vendor/symfony/http-kernel/README.md" />
|
||||
<delete file="${dir}/vendor/symfony/http-kernel/phpunit.xml.dist" />
|
||||
|
||||
<delete dir="${dir}/vendor/symfony/proxy-manager-bridge/.git" />
|
||||
<delete dir="${dir}/vendor/symfony/proxy-manager-bridge/Tests" />
|
||||
<delete file="${dir}/vendor/symfony/proxy-manager-bridge/.gitignore" />
|
||||
<delete file="${dir}/vendor/symfony/proxy-manager-bridge/CHANGELOG.md" />
|
||||
<delete file="${dir}/vendor/symfony/proxy-manager-bridge/README.md" />
|
||||
<delete file="${dir}/vendor/symfony/proxy-manager-bridge/phpunit.xml.dist" />
|
||||
|
||||
<delete dir="${dir}/vendor/symfony/routing/.git" />
|
||||
<delete dir="${dir}/vendor/symfony/routing/Tests" />
|
||||
<delete file="${dir}/vendor/symfony/routing/.gitignore" />
|
||||
|
@ -473,6 +480,15 @@
|
|||
<delete file="${dir}/vendor/twig/twig/CHANGELOG" />
|
||||
<delete file="${dir}/vendor/twig/twig/phpunit.xml.dist" />
|
||||
<delete file="${dir}/vendor/twig/twig/README.rst" />
|
||||
|
||||
<delete dir="${dir}/vendor/zendframework/zend-code/doc" />
|
||||
<delete file="${dir}/vendor/zendframework/zend-code/CHANGELOG.md" />
|
||||
<delete file="${dir}/vendor/zendframework/zend-code/CONTRIBUTING.md" />
|
||||
<delete file="${dir}/vendor/zendframework/zend-code/README.md" />
|
||||
|
||||
<delete file="${dir}/vendor/zendframework/zend-eventmanager/CHANGELOG.md" />
|
||||
<delete file="${dir}/vendor/zendframework/zend-eventmanager/CONTRIBUTING.md" />
|
||||
<delete file="${dir}/vendor/zendframework/zend-eventmanager/README.md" />
|
||||
</target>
|
||||
|
||||
<target name="clean-diff-dir">
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
"symfony/finder": "2.8.*",
|
||||
"symfony/http-foundation": "2.8.*",
|
||||
"symfony/http-kernel": "2.8.*",
|
||||
"symfony/proxy-manager-bridge": "2.8.*",
|
||||
"symfony/routing": "2.8.*",
|
||||
"symfony/twig-bridge": "2.8.*",
|
||||
"symfony/yaml": "2.8.*",
|
||||
|
@ -64,5 +65,10 @@
|
|||
"branch-alias": {
|
||||
"dev-master": "3.2.x-dev"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "5.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
280
phpBB/composer.lock
generated
280
phpBB/composer.lock
generated
|
@ -4,8 +4,8 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "9cbb41222e71eb86e0ef9118baafc691",
|
||||
"content-hash": "03a990fa2d088c89afe4824d2d53e873",
|
||||
"hash": "b82925c74b2b12ce589973243a9fab68",
|
||||
"content-hash": "fee6d87604f3053b51c0947ded841cfe",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bantu/ini-get-wrapper",
|
||||
|
@ -401,6 +401,69 @@
|
|||
],
|
||||
"time": "2015-08-21 11:40:30"
|
||||
},
|
||||
{
|
||||
"name": "ocramius/proxy-manager",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Ocramius/ProxyManager.git",
|
||||
"reference": "57e9272ec0e8deccf09421596e0e2252df440e11"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/57e9272ec0e8deccf09421596e0e2252df440e11",
|
||||
"reference": "57e9272ec0e8deccf09421596e0e2252df440e11",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"zendframework/zend-code": ">2.2.5,<3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-phar": "*",
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"squizlabs/php_codesniffer": "1.5.*"
|
||||
},
|
||||
"suggest": {
|
||||
"ocramius/generated-hydrator": "To have very fast object to array to object conversion for ghost objects",
|
||||
"zendframework/zend-json": "To have the JsonRpc adapter (Remote Object feature)",
|
||||
"zendframework/zend-soap": "To have the Soap adapter (Remote Object feature)",
|
||||
"zendframework/zend-stdlib": "To use the hydrator proxy",
|
||||
"zendframework/zend-xmlrpc": "To have the XmlRpc adapter (Remote Object feature)"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"ProxyManager\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marco Pivetta",
|
||||
"email": "ocramius@gmail.com",
|
||||
"homepage": "http://ocramius.github.com/"
|
||||
}
|
||||
],
|
||||
"description": "A library providing utilities to generate, instantiate and generally operate with Object Proxies",
|
||||
"homepage": "https://github.com/Ocramius/ProxyManager",
|
||||
"keywords": [
|
||||
"aop",
|
||||
"lazy loading",
|
||||
"proxy",
|
||||
"proxy pattern",
|
||||
"service proxies"
|
||||
],
|
||||
"time": "2015-08-09 04:28:19"
|
||||
},
|
||||
{
|
||||
"name": "paragonie/random_compat",
|
||||
"version": "v1.2.2",
|
||||
|
@ -1341,6 +1404,60 @@
|
|||
],
|
||||
"time": "2016-01-20 09:13:37"
|
||||
},
|
||||
{
|
||||
"name": "symfony/proxy-manager-bridge",
|
||||
"version": "v2.8.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/proxy-manager-bridge.git",
|
||||
"reference": "713ed53cf1da3f41288c608d2d0ddb44d6b07304"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/713ed53cf1da3f41288c608d2d0ddb44d6b07304",
|
||||
"reference": "713ed53cf1da3f41288c608d2d0ddb44d6b07304",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ocramius/proxy-manager": "~0.4|~1.0|~2.0",
|
||||
"php": ">=5.3.9",
|
||||
"symfony/dependency-injection": "~2.8|~3.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/config": "~2.3|~3.0.0"
|
||||
},
|
||||
"type": "symfony-bridge",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.8-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Bridge\\ProxyManager\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony ProxyManager Bridge",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-03-04 07:54:35"
|
||||
},
|
||||
{
|
||||
"name": "symfony/routing",
|
||||
"version": "v2.8.3",
|
||||
|
@ -1606,6 +1723,160 @@
|
|||
"templating"
|
||||
],
|
||||
"time": "2016-01-25 21:22:18"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-code",
|
||||
"version": "2.5.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-code.git",
|
||||
"reference": "5d998f261ec2a55171c71da57a11622745680153"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-code/zipball/5d998f261ec2a55171c71da57a11622745680153",
|
||||
"reference": "5d998f261ec2a55171c71da57a11622745680153",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.23",
|
||||
"zendframework/zend-eventmanager": "~2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/common": ">=2.1",
|
||||
"fabpot/php-cs-fixer": "1.7.*",
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"zendframework/zend-stdlib": "~2.5",
|
||||
"zendframework/zend-version": "~2.5"
|
||||
},
|
||||
"suggest": {
|
||||
"doctrine/common": "Doctrine\\Common >=2.1 for annotation features",
|
||||
"zendframework/zend-stdlib": "Zend\\Stdlib component"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev",
|
||||
"dev-develop": "2.6-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Zend\\Code\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"description": "provides facilities to generate arbitrary code using an object oriented interface",
|
||||
"homepage": "https://github.com/zendframework/zend-code",
|
||||
"keywords": [
|
||||
"code",
|
||||
"zf2"
|
||||
],
|
||||
"time": "2015-06-03 15:31:59"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-eventmanager",
|
||||
"version": "2.5.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-eventmanager.git",
|
||||
"reference": "d94a16039144936f107f906896349900fd634443"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/d94a16039144936f107f906896349900fd634443",
|
||||
"reference": "d94a16039144936f107f906896349900fd634443",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.23",
|
||||
"zendframework/zend-stdlib": "~2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"fabpot/php-cs-fixer": "1.7.*",
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev",
|
||||
"dev-develop": "2.6-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Zend\\EventManager\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"homepage": "https://github.com/zendframework/zend-eventmanager",
|
||||
"keywords": [
|
||||
"eventmanager",
|
||||
"zf2"
|
||||
],
|
||||
"time": "2015-06-03 15:32:01"
|
||||
},
|
||||
{
|
||||
"name": "zendframework/zend-stdlib",
|
||||
"version": "2.5.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zendframework/zend-stdlib.git",
|
||||
"reference": "cc8e90a60dd5d44b9730b77d07b97550091da1ae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cc8e90a60dd5d44b9730b77d07b97550091da1ae",
|
||||
"reference": "cc8e90a60dd5d44b9730b77d07b97550091da1ae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.23"
|
||||
},
|
||||
"require-dev": {
|
||||
"fabpot/php-cs-fixer": "1.7.*",
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"zendframework/zend-config": "~2.5",
|
||||
"zendframework/zend-eventmanager": "~2.5",
|
||||
"zendframework/zend-filter": "~2.5",
|
||||
"zendframework/zend-inputfilter": "~2.5",
|
||||
"zendframework/zend-serializer": "~2.5",
|
||||
"zendframework/zend-servicemanager": "~2.5"
|
||||
},
|
||||
"suggest": {
|
||||
"zendframework/zend-eventmanager": "To support aggregate hydrator usage",
|
||||
"zendframework/zend-filter": "To support naming strategy hydrator usage",
|
||||
"zendframework/zend-serializer": "Zend\\Serializer component",
|
||||
"zendframework/zend-servicemanager": "To support hydrator plugin manager usage"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.5-dev",
|
||||
"dev-develop": "2.6-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Zend\\Stdlib\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"homepage": "https://github.com/zendframework/zend-stdlib",
|
||||
"keywords": [
|
||||
"stdlib",
|
||||
"zf2"
|
||||
],
|
||||
"time": "2015-06-03 15:32:03"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
@ -3003,5 +3274,8 @@
|
|||
"platform": {
|
||||
"php": ">=5.4,<7.1"
|
||||
},
|
||||
"platform-dev": []
|
||||
"platform-dev": [],
|
||||
"platform-overrides": {
|
||||
"php": "5.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,14 +8,16 @@ services:
|
|||
- '@config'
|
||||
- '@filesystem'
|
||||
- '@path_helper'
|
||||
- '@service_container'
|
||||
- '%core.template.cache_path%'
|
||||
- '@ext.manager'
|
||||
- '@template.twig.loader'
|
||||
- []
|
||||
calls:
|
||||
- [setLexer, ['@template.twig.lexer']]
|
||||
|
||||
template.twig.lexer:
|
||||
class: phpbb\template\twig\lexer
|
||||
lazy: true
|
||||
arguments:
|
||||
- '@template.twig.environment'
|
||||
|
||||
|
|
|
@ -81,11 +81,12 @@ services:
|
|||
- '@config'
|
||||
- '@filesystem'
|
||||
- '@path_helper'
|
||||
- '@service_container'
|
||||
- '%core.template.cache_path%'
|
||||
- null
|
||||
- '@template.twig.loader'
|
||||
- []
|
||||
calls:
|
||||
- [setLexer, ['@template.twig.lexer']]
|
||||
|
||||
console.exception_subscriber:
|
||||
class: phpbb\console\exception_subscriber
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
namespace phpbb\di;
|
||||
|
||||
use phpbb\filesystem\filesystem;
|
||||
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;
|
||||
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
|
||||
use Symfony\Component\Config\ConfigCache;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
@ -460,7 +462,10 @@ class container_builder
|
|||
{
|
||||
try
|
||||
{
|
||||
$dumper = new PhpDumper($this->container);
|
||||
$dumper = new PhpDumper($this->container);
|
||||
$proxy_dumper = new ProxyDumper();
|
||||
$dumper->setProxyDumper($proxy_dumper);
|
||||
|
||||
$cached_container_dump = $dumper->dump(array(
|
||||
'class' => 'phpbb_cache_container',
|
||||
'base_class' => 'Symfony\\Component\\DependencyInjection\\ContainerBuilder',
|
||||
|
@ -483,6 +488,7 @@ class container_builder
|
|||
protected function create_container(array $extensions)
|
||||
{
|
||||
$container = new ContainerBuilder(new ParameterBag($this->get_core_parameters()));
|
||||
$container->setProxyInstantiator(new RuntimeInstantiator());
|
||||
|
||||
$extensions_alias = array();
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class core extends Extension
|
|||
|
||||
// Set the Twig options if defined in the environment
|
||||
$definition = $container->getDefinition('template.twig.environment');
|
||||
$twig_environment_options = $definition->getArgument(7);
|
||||
$twig_environment_options = $definition->getArgument(6);
|
||||
if ($config['twig']['debug'])
|
||||
{
|
||||
$twig_environment_options['debug'] = true;
|
||||
|
@ -81,8 +81,8 @@ class core extends Extension
|
|||
$twig_environment_options['auto_reload'] = true;
|
||||
}
|
||||
|
||||
// Replace the 8th argument, the options passed to the environment
|
||||
$definition->replaceArgument(7, $twig_environment_options);
|
||||
// Replace the 7th argument, the options passed to the environment
|
||||
$definition->replaceArgument(6, $twig_environment_options);
|
||||
|
||||
if ($config['twig']['enable_debug_extension'])
|
||||
{
|
||||
|
|
|
@ -50,20 +50,18 @@ class environment extends \Twig_Environment
|
|||
* @param \phpbb\config\config $phpbb_config The phpBB configuration
|
||||
* @param \phpbb\filesystem\filesystem $filesystem
|
||||
* @param \phpbb\path_helper $path_helper phpBB path helper
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container The dependency injection container
|
||||
* @param string $cache_path The path to the cache directory
|
||||
* @param \phpbb\extension\manager $extension_manager phpBB extension manager
|
||||
* @param \Twig_LoaderInterface $loader Twig loader interface
|
||||
* @param array $options Array of options to pass to Twig
|
||||
*/
|
||||
public function __construct(\phpbb\config\config $phpbb_config, \phpbb\filesystem\filesystem $filesystem, \phpbb\path_helper $path_helper, \Symfony\Component\DependencyInjection\ContainerInterface $container, $cache_path, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, $options = array())
|
||||
public function __construct(\phpbb\config\config $phpbb_config, \phpbb\filesystem\filesystem $filesystem, \phpbb\path_helper $path_helper, $cache_path, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, $options = array())
|
||||
{
|
||||
$this->phpbb_config = $phpbb_config;
|
||||
|
||||
$this->filesystem = $filesystem;
|
||||
$this->phpbb_path_helper = $path_helper;
|
||||
$this->extension_manager = $extension_manager;
|
||||
$this->container = $container;
|
||||
|
||||
$this->phpbb_root_path = $this->phpbb_path_helper->get_phpbb_root_path();
|
||||
$this->web_root_path = $this->phpbb_path_helper->get_web_root_path();
|
||||
|
@ -77,24 +75,9 @@ class environment extends \Twig_Environment
|
|||
'autoescape' => false,
|
||||
), $options);
|
||||
|
||||
return parent::__construct($loader, $options);
|
||||
parent::__construct($loader, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLexer()
|
||||
{
|
||||
if (null === $this->lexer)
|
||||
{
|
||||
$this->lexer = $this->container->get('template.twig.lexer');
|
||||
$this->lexer->set_environment($this);
|
||||
}
|
||||
|
||||
return $this->lexer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of enabled phpBB extensions
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue