diff options
-rw-r--r-- | phpBB/includes/extension/manager.php | 18 | ||||
-rw-r--r-- | tests/extension/ext/moo/feature_class.php | 5 | ||||
-rw-r--r-- | tests/extension/ext/vendor/moo/ext.php (renamed from tests/extension/ext/moo/ext.php) | 2 | ||||
-rw-r--r-- | tests/extension/ext/vendor/moo/feature_class.php | 5 | ||||
-rw-r--r-- | tests/extension/fixtures/extensions.xml | 2 | ||||
-rw-r--r-- | tests/extension/manager_test.php | 18 |
6 files changed, 28 insertions, 22 deletions
diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index 07e98735f8..981fa43ab2 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -94,7 +94,9 @@ class phpbb_extension_manager */ public function get_extension_path($name, $phpbb_relative = false) { - return (($phpbb_relative) ? $this->phpbb_root_path : '') . 'ext/' . basename($name) . '/'; + $name = str_replace('.', '', $name); + + return (($phpbb_relative) ? $this->phpbb_root_path : '') . 'ext/' . $name . '/'; } /** @@ -106,7 +108,7 @@ class phpbb_extension_manager */ public function get_extension($name) { - $extension_class_name = 'phpbb_ext_' . $name . '_ext'; + $extension_class_name = 'phpbb_ext_' . str_replace('/', '_', $name) . '_ext'; if (class_exists($extension_class_name)) { @@ -292,13 +294,17 @@ class phpbb_extension_manager { $available = array(); - $iterator = new DirectoryIterator($this->phpbb_root_path . 'ext/'); + $iterator = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/')); foreach ($iterator as $file_info) { - $path = $this->phpbb_root_path . 'ext/' . $file_info->getBasename() . '/'; - if (!$file_info->isDot() && $file_info->isDir() && file_exists($path)) + if ($file_info->isFile() && $file_info->getFilename() == 'ext' . $this->phpEx) { - $available[$file_info->getBasename()] = $path; + $ext_name = $iterator->getInnerIterator()->getSubPath(); + + $ext_name = str_replace(DIRECTORY_SEPARATOR, '/', $ext_name); + + $available[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/'; } } ksort($available); diff --git a/tests/extension/ext/moo/feature_class.php b/tests/extension/ext/moo/feature_class.php deleted file mode 100644 index bf7ba40d84..0000000000 --- a/tests/extension/ext/moo/feature_class.php +++ /dev/null @@ -1,5 +0,0 @@ -<?php - -class phpbb_ext_moo_feature_class -{ -} diff --git a/tests/extension/ext/moo/ext.php b/tests/extension/ext/vendor/moo/ext.php index 8b534380f2..e0ac1a22cc 100644 --- a/tests/extension/ext/moo/ext.php +++ b/tests/extension/ext/vendor/moo/ext.php @@ -1,6 +1,6 @@ <?php -class phpbb_ext_moo_ext extends phpbb_extension_base +class phpbb_ext_vendor_moo_ext extends phpbb_extension_base { static public $purged; diff --git a/tests/extension/ext/vendor/moo/feature_class.php b/tests/extension/ext/vendor/moo/feature_class.php new file mode 100644 index 0000000000..c3bcc4451c --- /dev/null +++ b/tests/extension/ext/vendor/moo/feature_class.php @@ -0,0 +1,5 @@ +<?php + +class phpbb_ext_vendor_moo_feature_class +{ +} diff --git a/tests/extension/fixtures/extensions.xml b/tests/extension/fixtures/extensions.xml index f3acdd2575..65cb71c7a4 100644 --- a/tests/extension/fixtures/extensions.xml +++ b/tests/extension/fixtures/extensions.xml @@ -8,7 +8,7 @@ <value>1</value> </row> <row> - <value>moo</value> + <value>vendor/moo</value> <value>0</value> </row> </table> diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index 4c49366d20..ba7f227a56 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -9,7 +9,7 @@ require_once dirname(__FILE__) . '/../mock/cache.php'; require_once dirname(__FILE__) . '/ext/bar/ext.php'; -require_once dirname(__FILE__) . '/ext/moo/ext.php'; +require_once dirname(__FILE__) . '/ext/vendor/moo/ext.php'; class phpbb_extension_manager_test extends phpbb_database_test_case { @@ -36,7 +36,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case public function test_available() { - $this->assertEquals(array('bar', 'foo', 'moo'), array_keys($this->extension_manager->all_available())); + $this->assertEquals(array('bar', 'foo', 'vendor/moo'), array_keys($this->extension_manager->all_available())); } public function test_enabled() @@ -46,7 +46,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case public function test_configured() { - $this->assertEquals(array('foo', 'moo'), array_keys($this->extension_manager->all_configured())); + $this->assertEquals(array('foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured())); } public function test_enable() @@ -56,7 +56,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); $this->extension_manager->enable('bar'); $this->assertEquals(array('bar', 'foo'), array_keys($this->extension_manager->all_enabled())); - $this->assertEquals(array('bar', 'foo', 'moo'), array_keys($this->extension_manager->all_configured())); + $this->assertEquals(array('bar', 'foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured())); $this->assertEquals(4, phpbb_ext_bar_ext::$state); } @@ -66,20 +66,20 @@ class phpbb_extension_manager_test extends phpbb_database_test_case $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); $this->extension_manager->disable('foo'); $this->assertEquals(array(), array_keys($this->extension_manager->all_enabled())); - $this->assertEquals(array('foo', 'moo'), array_keys($this->extension_manager->all_configured())); + $this->assertEquals(array('foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured())); } public function test_purge() { - phpbb_ext_moo_ext::$purged = false; + phpbb_ext_vendor_moo_ext::$purged = false; $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); - $this->assertEquals(array('foo', 'moo'), array_keys($this->extension_manager->all_configured())); - $this->extension_manager->purge('moo'); + $this->assertEquals(array('foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured())); + $this->extension_manager->purge('vendor/moo'); $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled())); $this->assertEquals(array('foo'), array_keys($this->extension_manager->all_configured())); - $this->assertTrue(phpbb_ext_moo_ext::$purged); + $this->assertTrue(phpbb_ext_vendor_moo_ext::$purged); } public function test_enabled_no_cache() |