[ticket/11362] Extension manager depends on filesystem

PHPBB3-11362
This commit is contained in:
Joas Schilling 2013-04-17 18:43:19 +02:00
parent d7fb934a2f
commit 423b310e2a
8 changed files with 12 additions and 3 deletions

View file

@ -131,6 +131,7 @@ services:
- @dbal.conn - @dbal.conn
- @config - @config
- @migrator - @migrator
- @filesystem
- %tables.ext% - %tables.ext%
- %core.root_path% - %core.root_path%
- .%core.php_ext% - .%core.php_ext%

View file

@ -44,13 +44,14 @@ class phpbb_extension_manager
* @param phpbb_db_driver $db A database connection * @param phpbb_db_driver $db A database connection
* @param phpbb_config $config phpbb_config * @param phpbb_config $config phpbb_config
* @param phpbb_db_migrator $migrator * @param phpbb_db_migrator $migrator
* @param phpbb_filesystem $filesystem
* @param string $extension_table The name of the table holding extensions * @param string $extension_table The name of the table holding extensions
* @param string $phpbb_root_path Path to the phpbb includes directory. * @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $php_ext php file extension * @param string $php_ext php file extension
* @param phpbb_cache_driver_interface $cache A cache instance or null * @param phpbb_cache_driver_interface $cache A cache instance or null
* @param string $cache_name The name of the cache variable, defaults to _ext * @param string $cache_name The name of the cache variable, defaults to _ext
*/ */
public function __construct(ContainerInterface $container, phpbb_db_driver $db, phpbb_config $config, phpbb_db_migrator $migrator, $extension_table, $phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext') public function __construct(ContainerInterface $container, phpbb_db_driver $db, phpbb_config $config, phpbb_db_migrator $migrator, phpbb_filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = '.php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
{ {
$this->container = $container; $this->container = $container;
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
@ -58,6 +59,7 @@ class phpbb_extension_manager
$this->config = $config; $this->config = $config;
$this->migrator = $migrator; $this->migrator = $migrator;
$this->cache = $cache; $this->cache = $cache;
$this->filesystem = $filesystem;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$this->extension_table = $extension_table; $this->extension_table = $extension_table;
$this->cache_name = $cache_name; $this->cache_name = $cache_name;
@ -510,7 +512,7 @@ class phpbb_extension_manager
*/ */
public function get_finder() public function get_finder()
{ {
return new phpbb_extension_finder($this, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder'); return new phpbb_extension_finder($this, $this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
} }
/** /**

View file

@ -60,6 +60,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$this->db, $this->db,
$this->config, $this->config,
$this->migrator, $this->migrator,
new phpbb_filesystem(),
'phpbb_ext', 'phpbb_ext',
dirname(__FILE__) . '/../../phpBB/', dirname(__FILE__) . '/../../phpBB/',
'.php', '.php',

View file

@ -164,7 +164,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
public function test_get_classes_create_cache() public function test_get_classes_create_cache()
{ {
$cache = new phpbb_mock_cache; $cache = new phpbb_mock_cache;
$finder = new phpbb_extension_finder($this->extension_manager, dirname(__FILE__) . '/', $cache, '.php', '_custom_cache_name'); $finder = new phpbb_extension_finder($this->extension_manager, new phpbb_filesystem(), dirname(__FILE__) . '/', $cache, '.php', '_custom_cache_name');
$files = $finder->suffix('_class.php')->get_files(); $files = $finder->suffix('_class.php')->get_files();
$expected_files = array( $expected_files = array(
@ -204,6 +204,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
$finder = new phpbb_extension_finder( $finder = new phpbb_extension_finder(
$this->extension_manager, $this->extension_manager,
new phpbb_filesystem(),
dirname(__FILE__) . '/', dirname(__FILE__) . '/',
new phpbb_mock_cache(array( new phpbb_mock_cache(array(
'_ext_finder' => array( '_ext_finder' => array(

View file

@ -112,6 +112,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$db, $db,
$config, $config,
$migrator, $migrator,
new phpbb_filesystem(),
'phpbb_ext', 'phpbb_ext',
dirname(__FILE__) . '/', dirname(__FILE__) . '/',
'.' . $php_ext, '.' . $php_ext,

View file

@ -64,6 +64,7 @@ class metadata_manager_test extends phpbb_database_test_case
$this->db, $this->db,
$this->config, $this->config,
$this->migrator, $this->migrator,
new phpbb_filesystem(),
'phpbb_ext', 'phpbb_ext',
$this->phpbb_root_path, $this->phpbb_root_path,
$this->phpEx, $this->phpEx,

View file

@ -14,5 +14,6 @@ class phpbb_mock_extension_manager extends phpbb_extension_manager
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = '.php'; $this->php_ext = '.php';
$this->extensions = $extensions; $this->extensions = $extensions;
$this->filesystem = new phpbb_filesystem();
} }
} }

View file

@ -153,6 +153,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$db, $db,
$config, $config,
$migrator, $migrator,
new phpbb_filesystem(),
self::$config['table_prefix'] . 'ext', self::$config['table_prefix'] . 'ext',
dirname(__FILE__) . '/', dirname(__FILE__) . '/',
'.' . $php_ext, '.' . $php_ext,