diff options
| author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-09-05 13:56:57 -0500 |
|---|---|---|
| committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-09-05 13:56:57 -0500 |
| commit | e8ab8fe0bc7d087fe3c9b5d2a3e545f228bb3096 (patch) | |
| tree | 6a053afa0a156204112b480707608cac60770ac5 /phpBB/includes/di | |
| parent | abaa53b0b295358efcf591587485c01a027cd5cb (diff) | |
| parent | dd86e8d0ae0179cf50076cdb1a8020266b6432a5 (diff) | |
| download | forums-e8ab8fe0bc7d087fe3c9b5d2a3e545f228bb3096.tar forums-e8ab8fe0bc7d087fe3c9b5d2a3e545f228bb3096.tar.gz forums-e8ab8fe0bc7d087fe3c9b5d2a3e545f228bb3096.tar.bz2 forums-e8ab8fe0bc7d087fe3c9b5d2a3e545f228bb3096.tar.xz forums-e8ab8fe0bc7d087fe3c9b5d2a3e545f228bb3096.zip | |
Merge branch 'develop' of github.com:phpbb/phpbb3 into ticket/8323
# By Joas Schilling (613) and others
# Via Andreas Fischer (214) and others
* 'develop' of github.com:phpbb/phpbb3: (2494 commits)
[ticket/11825] Move schema_data.php into includes/ instead of phpbb/
[ticket/11215] Remove unnecessary comment
[ticket/11755] MySQL upgrader out of date
[prep-release-3.0.12] Update Changelog for 3.0.12-RC3 release.
[prep-release-3.0.12] Bumping version number for 3.0.12-RC3.
[ticket/11823] Set up nginx server to match PHP files with characters after .php
[ticket/11812] Fix empty define
[ticket/11818] Update Symfony dependencies to 2.3.*
[ticket/11791] Load adm/ events from styles/adm/event/
[ticket/11215] Fix helper_url_test.php tests
[ticket/11215] Add newline back to .htaccess, fix wording
[ticket/11215] Update comment in .htaccess
[ticket/11215] Uncomment rewrite rules in .htaccess
[ticket/11215] Make controller helper url() method use correct format
[ticket/11215] Add commented-out URL rewrite capability to .htaccess
[ticket/11821] Fix comma usage next to "You are receiving this notification".
[ticket/11769] Allow using 0 as poster name
[ticket/11769] Allow '0' as username
[ticket/11215] Use new URL structure for controllers
[ticket/11215] Everything appears to be working...
...
Conflicts:
phpBB/includes/functions_privmsgs.php
Diffstat (limited to 'phpBB/includes/di')
| -rw-r--r-- | phpBB/includes/di/extension/config.php | 83 | ||||
| -rw-r--r-- | phpBB/includes/di/extension/core.php | 69 | ||||
| -rw-r--r-- | phpBB/includes/di/extension/ext.php | 69 | ||||
| -rw-r--r-- | phpBB/includes/di/pass/collection_pass.php | 46 | ||||
| -rw-r--r-- | phpBB/includes/di/pass/kernel_pass.php | 68 | ||||
| -rw-r--r-- | phpBB/includes/di/service_collection.php | 49 |
6 files changed, 0 insertions, 384 deletions
diff --git a/phpBB/includes/di/extension/config.php b/phpBB/includes/di/extension/config.php deleted file mode 100644 index fb5ca90070..0000000000 --- a/phpBB/includes/di/extension/config.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\Config\FileLocator; - -/** -* Container config extension -*/ -class phpbb_di_extension_config extends Extension -{ - public function __construct($config_file) - { - $this->config_file = $config_file; - } - - /** - * Loads a specific configuration. - * - * @param array $config An array of configuration values - * @param ContainerBuilder $container A ContainerBuilder instance - * - * @throws InvalidArgumentException When provided tag is not defined in this extension - */ - public function load(array $config, ContainerBuilder $container) - { - require($this->config_file); - - $container->setParameter('core.table_prefix', $table_prefix); - $container->setParameter('cache.driver.class', $this->fix_acm_type($acm_type)); - $container->setParameter('dbal.driver.class', 'dbal_'.$dbms); - $container->setParameter('dbal.dbhost', $dbhost); - $container->setParameter('dbal.dbuser', $dbuser); - $container->setParameter('dbal.dbpasswd', $dbpasswd); - $container->setParameter('dbal.dbname', $dbname); - $container->setParameter('dbal.dbport', $dbport); - $container->setParameter('dbal.new_link', defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK); - } - - /** - * Returns the recommended alias to use in XML. - * - * This alias is also the mandatory prefix to use when using YAML. - * - * @return string The alias - */ - public function getAlias() - { - return 'config'; - } - - /** - * Convert old (3.0) values to 3.1 class names - * - * @param style $acm_type ACM type - * @return ACM type class - */ - protected function fix_acm_type($acm_type) - { - if (preg_match('#^[a-z]+$#', $acm_type)) - { - return 'phpbb_cache_driver_'.$acm_type; - } - - return $acm_type; - } -} diff --git a/phpBB/includes/di/extension/core.php b/phpBB/includes/di/extension/core.php deleted file mode 100644 index 9c36ba2fc4..0000000000 --- a/phpBB/includes/di/extension/core.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\Config\FileLocator; - -/** -* Container core extension -*/ -class phpbb_di_extension_core extends Extension -{ - /** - * phpBB Root path - * @var string - */ - protected $root_path; - - /** - * Constructor - * - * @param string $root_path Root path - */ - public function __construct($root_path) - { - $this->root_path = $root_path; - } - - /** - * Loads a specific configuration. - * - * @param array $config An array of configuration values - * @param ContainerBuilder $container A ContainerBuilder instance - * - * @throws InvalidArgumentException When provided tag is not defined in this extension - */ - public function load(array $config, ContainerBuilder $container) - { - $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->root_path . 'config'))); - $loader->load('services.yml'); - } - - /** - * Returns the recommended alias to use in XML. - * - * This alias is also the mandatory prefix to use when using YAML. - * - * @return string The alias - */ - public function getAlias() - { - return 'core'; - } -} diff --git a/phpBB/includes/di/extension/ext.php b/phpBB/includes/di/extension/ext.php deleted file mode 100644 index 7d9b433751..0000000000 --- a/phpBB/includes/di/extension/ext.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\Config\FileLocator; - -/** -* Container ext extension -*/ -class phpbb_di_extension_ext extends Extension -{ - protected $paths = array(); - - public function __construct($enabled_extensions) - { - foreach ($enabled_extensions as $ext => $path) - { - $this->paths[] = $path; - } - } - - /** - * Loads a specific configuration. - * - * @param array $config An array of configuration values - * @param ContainerBuilder $container A ContainerBuilder instance - * - * @throws InvalidArgumentException When provided tag is not defined in this extension - */ - public function load(array $config, ContainerBuilder $container) - { - foreach ($this->paths as $path) - { - if (file_exists($path . '/config/services.yml')) - { - $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($path . '/config'))); - $loader->load('services.yml'); - } - } - } - - /** - * Returns the recommended alias to use in XML. - * - * This alias is also the mandatory prefix to use when using YAML. - * - * @return string The alias - */ - public function getAlias() - { - return 'ext'; - } -} diff --git a/phpBB/includes/di/pass/collection_pass.php b/phpBB/includes/di/pass/collection_pass.php deleted file mode 100644 index 63a5c7dfc4..0000000000 --- a/phpBB/includes/di/pass/collection_pass.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; - -/** -* Appends an add method call to the definition of each collection service for -* the services tagged with the appropriate name defined in the collection's -* service_collection tag. -*/ -class phpbb_di_pass_collection_pass implements CompilerPassInterface -{ - /** - * Modify the container before it is passed to the rest of the code - * - * @param ContainerBuilder $container ContainerBuilder object - * @return null - */ - public function process(ContainerBuilder $container) - { - foreach ($container->findTaggedServiceIds('service_collection') as $id => $data) - { - $definition = $container->getDefinition($id); - - foreach ($container->findTaggedServiceIds($data[0]['tag']) as $service_id => $service_data) - { - $definition->addMethodCall('add', array($service_id)); - } - } - } -} diff --git a/phpBB/includes/di/pass/kernel_pass.php b/phpBB/includes/di/pass/kernel_pass.php deleted file mode 100644 index a701ebcfa6..0000000000 --- a/phpBB/includes/di/pass/kernel_pass.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; - -class phpbb_di_pass_kernel_pass implements CompilerPassInterface -{ - /** - * Modify the container before it is passed to the rest of the code - * - * @param ContainerBuilder $container ContainerBuilder object - * @return null - */ - public function process(ContainerBuilder $container) - { - $definition = $container->getDefinition('dispatcher'); - - foreach ($container->findTaggedServiceIds('kernel.event_listener') as $id => $events) - { - foreach ($events as $event) - { - $priority = isset($event['priority']) ? $event['priority'] : 0; - - if (!isset($event['event'])) - { - throw new InvalidArgumentException(sprintf('Service "%1$s" must define the "event" attribute on "kernel.event_listener" tags.', $id)); - } - - if (!isset($event['method'])) - { - throw new InvalidArgumentException(sprintf('Service "%1$s" must define the "method" attribute on "kernel.event_listener" tags.', $id)); - } - - $definition->addMethodCall('addListenerService', array($event['event'], array($id, $event['method']), $priority)); - } - } - - foreach ($container->findTaggedServiceIds('kernel.event_subscriber') as $id => $attributes) - { - // We must assume that the class value has been correctly filled, even if the service is created by a factory - $class = $container->getDefinition($id)->getClass(); - - $refClass = new ReflectionClass($class); - $interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface'; - if (!$refClass->implementsInterface($interface)) - { - throw new InvalidArgumentException(sprintf('Service "%1$s" must implement interface "%2$s".', $id, $interface)); - } - - $definition->addMethodCall('addSubscriberService', array($id, $class)); - } - } -} diff --git a/phpBB/includes/di/service_collection.php b/phpBB/includes/di/service_collection.php deleted file mode 100644 index 60323c8dba..0000000000 --- a/phpBB/includes/di/service_collection.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** -* Collection of services to be configured at container compile time. -* -* @package phpBB3 -*/ -class phpbb_di_service_collection extends ArrayObject -{ - /** - * Constructor - * - * @param ContainerInterface $container Container object - */ - public function __construct(ContainerInterface $container) - { - $this->container = $container; - } - - /** - * Add a service to the collection - * - * @param string $name The service name - * @return null - */ - public function add($name) - { - $task = $this->container->get($name); - $task->set_name($name); - $this->offsetSet($name, $task); - } -} |
