diff options
author | Igor Wiedler <igor@wiedler.ch> | 2012-03-11 15:14:13 +0100 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2012-03-11 15:15:33 +0100 |
commit | e02d92ac62fbe1dc08994444c18a7447d72c56e6 (patch) | |
tree | ee96cc57586f4b3c4e2998d6ad0d747c5db189a7 | |
parent | 5dd5df46a497631b905f6595707b0d1b0c302749 (diff) | |
download | forums-e02d92ac62fbe1dc08994444c18a7447d72c56e6.tar forums-e02d92ac62fbe1dc08994444c18a7447d72c56e6.tar.gz forums-e02d92ac62fbe1dc08994444c18a7447d72c56e6.tar.bz2 forums-e02d92ac62fbe1dc08994444c18a7447d72c56e6.tar.xz forums-e02d92ac62fbe1dc08994444c18a7447d72c56e6.zip |
[feature/event-dispatcher] Use real EventDispatcher through composer
* replace the copy-pasta EventDispatcher with the real one from Symfony2
* use composer for managing this dependency, use composer autoloading
PHPBB3-9550
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | phpBB/common.php | 6 | ||||
-rw-r--r-- | phpBB/composer.json | 5 | ||||
-rw-r--r-- | phpBB/composer.lock | 10 | ||||
-rw-r--r-- | phpBB/download/file.php | 2 | ||||
-rw-r--r-- | phpBB/includes/event/data.php | 4 | ||||
-rw-r--r-- | phpBB/includes/event/extension_subscriber_loader.php | 6 | ||||
-rw-r--r-- | phpBB/install/database_update.php | 2 | ||||
-rw-r--r-- | phpBB/install/index.php | 2 | ||||
-rw-r--r-- | tests/bootstrap.php | 2 |
10 files changed, 36 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore index 1ac01d9b2d..542527e717 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ /phpBB/images/avatars/gallery/* /phpBB/images/avatars/upload/* /phpBB/store/* +/phpBB/vendor /tests/phpbb_unit_tests.sqlite2 /tests/test_config.php /tests/tmp/* diff --git a/phpBB/common.php b/phpBB/common.php index 44a0e7cec3..c48418276a 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -15,6 +15,8 @@ if (!defined('IN_PHPBB')) exit; } +use Symfony\Component\EventDispatcher\EventDispatcher; + require($phpbb_root_path . 'includes/startup.' . $phpEx); if (file_exists($phpbb_root_path . 'config.' . $phpEx)) @@ -70,6 +72,8 @@ if (!empty($load_extensions) && function_exists('dl')) } } +require($phpbb_root_path . 'vendor/.composer/autoload.php'); + // Include files require($phpbb_root_path . 'includes/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/session.' . $phpEx); @@ -98,7 +102,7 @@ $phpbb_class_loader_ext->set_cache($cache->get_driver()); $phpbb_class_loader->set_cache($cache->get_driver()); // Instantiate some basic classes -$phpbb_dispatcher = new phpbb_event_dispatcher(); +$phpbb_dispatcher = new EventDispatcher(); $request = new phpbb_request(); $user = new user(); $auth = new auth(); diff --git a/phpBB/composer.json b/phpBB/composer.json new file mode 100644 index 0000000000..1059b97f84 --- /dev/null +++ b/phpBB/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "symfony/event-dispatcher": "2.0.*" + } +} diff --git a/phpBB/composer.lock b/phpBB/composer.lock new file mode 100644 index 0000000000..062ad4b3aa --- /dev/null +++ b/phpBB/composer.lock @@ -0,0 +1,10 @@ +{ + "hash": "9bada3748ec2933fe0864dcfafbcd671", + "packages": [ + { + "package": "symfony/event-dispatcher", + "version": "v2.0.10" + } + ], + "aliases": [] +} diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 2baa9d6c8a..3f14a9cb82 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -38,6 +38,8 @@ if (isset($_GET['avatar'])) exit; } + require($phpbb_root_path . 'vendor/.composer/autoload.php'); + require($phpbb_root_path . 'includes/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); diff --git a/phpBB/includes/event/data.php b/phpBB/includes/event/data.php index 754876c119..62e2f2312e 100644 --- a/phpBB/includes/event/data.php +++ b/phpBB/includes/event/data.php @@ -15,7 +15,9 @@ if (!defined('IN_PHPBB')) exit; } -class phpbb_event_data extends phpbb_event implements ArrayAccess +use Symfony\Component\EventDispatcher\Event; + +class phpbb_event_data extends Event implements ArrayAccess { private $data; diff --git a/phpBB/includes/event/extension_subscriber_loader.php b/phpBB/includes/event/extension_subscriber_loader.php index 2a53af1249..aa32ca9686 100644 --- a/phpBB/includes/event/extension_subscriber_loader.php +++ b/phpBB/includes/event/extension_subscriber_loader.php @@ -15,12 +15,14 @@ if (!defined('IN_PHPBB')) exit; } +use Symfony\Component\EventDispatcher\EventDispatcher; + class phpbb_event_extension_subscriber_loader { private $dispatcher; private $extension_manager; - public function __construct(phpbb_event_dispatcher $dispatcher, phpbb_extension_manager $extension_manager) + public function __construct(EventDispatcher $dispatcher, phpbb_extension_manager $extension_manager) { $this->dispatcher = $dispatcher; $this->extension_manager = $extension_manager; @@ -37,7 +39,7 @@ class phpbb_event_extension_subscriber_loader foreach ($subscriber_classes as $class) { $subscriber = new $class(); - $this->dispatcher->add_subscriber($subscriber); + $this->dispatcher->addSubscriber($subscriber); } } } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 843e8c2f23..a1c8fe1ef9 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -82,6 +82,8 @@ if (!empty($load_extensions) && function_exists('dl')) } } +require($phpbb_root_path . 'vendor/.composer/autoload.php'); + // Include files require($phpbb_root_path . 'includes/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/session.' . $phpEx); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 9d003ba6ab..7e150c2519 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -69,6 +69,8 @@ else } @ini_set('memory_limit', $mem_limit); +require($phpbb_root_path . 'vendor/.composer/autoload.php'); + // Include essential scripts require($phpbb_root_path . 'includes/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index bf946df381..63e6f4b280 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -29,6 +29,8 @@ else define('STRIP', (get_magic_quotes_gpc()) ? true : false); } +require_once $phpbb_root_path . 'vendor/.composer/autoload.php'; + require_once $phpbb_root_path . 'includes/constants.php'; require_once $phpbb_root_path . 'includes/class_loader.' . $phpEx; |