mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/12508] Move \phpbb\extension\finder to \phpbb\finder
PHPBB3-12508
This commit is contained in:
parent
d45c681b40
commit
183492b019
9 changed files with 27 additions and 27 deletions
|
@ -44,7 +44,7 @@ require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx);
|
||||||
$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
|
$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
|
||||||
$phpbb_class_loader->register();
|
$phpbb_class_loader->register();
|
||||||
|
|
||||||
$finder = new \phpbb\extension\finder(new \phpbb\filesystem(), $phpbb_root_path);
|
$finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path);
|
||||||
$classes = $finder->core_path('phpbb/')
|
$classes = $finder->core_path('phpbb/')
|
||||||
->directory('/db/migration/data')
|
->directory('/db/migration/data')
|
||||||
->get_classes();
|
->get_classes();
|
||||||
|
|
|
@ -46,10 +46,10 @@ class provider
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \phpbb\extension\finder $finder
|
* @param \phpbb\finder $finder
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function find_routing_files(\phpbb\extension\finder $finder)
|
public function find_routing_files(\phpbb\finder $finder)
|
||||||
{
|
{
|
||||||
// We hardcode the path to the core config directory
|
// We hardcode the path to the core config directory
|
||||||
// because the finder cannot find it
|
// because the finder cannot find it
|
||||||
|
|
|
@ -714,7 +714,7 @@ class migrator
|
||||||
/**
|
/**
|
||||||
* Load migration data files from a directory
|
* Load migration data files from a directory
|
||||||
*
|
*
|
||||||
* @param \phpbb\extension\finder $finder
|
* @param \phpbb\finder $finder
|
||||||
* @param string $path Path to migration data files
|
* @param string $path Path to migration data files
|
||||||
* @param bool $check_fulfillable If TRUE (default), we will check
|
* @param bool $check_fulfillable If TRUE (default), we will check
|
||||||
* if all of the migrations are fulfillable after loading them.
|
* if all of the migrations are fulfillable after loading them.
|
||||||
|
@ -723,7 +723,7 @@ class migrator
|
||||||
* with the last call to prevent throwing errors unnecessarily).
|
* with the last call to prevent throwing errors unnecessarily).
|
||||||
* @return array Array of migration names
|
* @return array Array of migration names
|
||||||
*/
|
*/
|
||||||
public function load_migrations(\phpbb\extension\finder $finder, $path, $check_fulfillable = true)
|
public function load_migrations(\phpbb\finder $finder, $path, $check_fulfillable = true)
|
||||||
{
|
{
|
||||||
if (!is_dir($path))
|
if (!is_dir($path))
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,7 @@ class base implements \phpbb\extension\extension_interface
|
||||||
/** @var ContainerInterface */
|
/** @var ContainerInterface */
|
||||||
protected $container;
|
protected $container;
|
||||||
|
|
||||||
/** @var \phpbb\extension\finder */
|
/** @var \phpbb\finder */
|
||||||
protected $finder;
|
protected $finder;
|
||||||
|
|
||||||
/** @var \phpbb\db\migrator */
|
/** @var \phpbb\db\migrator */
|
||||||
|
@ -39,11 +39,11 @@ class base implements \phpbb\extension\extension_interface
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param ContainerInterface $container Container object
|
* @param ContainerInterface $container Container object
|
||||||
* @param \phpbb\extension\finder $extension_finder
|
* @param \phpbb\finder $extension_finder
|
||||||
* @param string $extension_name Name of this extension (from ext.manager)
|
* @param string $extension_name Name of this extension (from ext.manager)
|
||||||
* @param string $extension_path Relative path to this extension
|
* @param string $extension_path Relative path to this extension
|
||||||
*/
|
*/
|
||||||
public function __construct(ContainerInterface $container, \phpbb\extension\finder $extension_finder, \phpbb\db\migrator $migrator, $extension_name, $extension_path)
|
public function __construct(ContainerInterface $container, \phpbb\finder $extension_finder, \phpbb\db\migrator $migrator, $extension_name, $extension_path)
|
||||||
{
|
{
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
$this->extension_finder = $extension_finder;
|
$this->extension_finder = $extension_finder;
|
||||||
|
|
|
@ -532,14 +532,14 @@ class manager
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a \phpbb\extension\finder.
|
* Instantiates a \phpbb\finder.
|
||||||
*
|
*
|
||||||
* @param bool $use_all_available Should we load all extensions, or just enabled ones
|
* @param bool $use_all_available Should we load all extensions, or just enabled ones
|
||||||
* @return \phpbb\extension\finder An extension finder instance
|
* @return \phpbb\finder An extension finder instance
|
||||||
*/
|
*/
|
||||||
public function get_finder($use_all_available = false)
|
public function get_finder($use_all_available = false)
|
||||||
{
|
{
|
||||||
$finder = new \phpbb\extension\finder($this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
|
$finder = new \phpbb\finder($this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
|
||||||
if ($use_all_available)
|
if ($use_all_available)
|
||||||
{
|
{
|
||||||
$finder->set_extensions($this->all_available());
|
$finder->set_extensions($this->all_available());
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace phpbb\extension;
|
namespace phpbb;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The extension finder provides a simple way to locate files in active extensions
|
* The extension finder provides a simple way to locate files in active extensions
|
||||||
|
@ -81,7 +81,7 @@ class finder
|
||||||
* Set the array of extensions
|
* Set the array of extensions
|
||||||
*
|
*
|
||||||
* @param array $extensions A list of extensions that should be searched aswell
|
* @param array $extensions A list of extensions that should be searched aswell
|
||||||
* @return \phpbb\extension\finder This object for chaining calls
|
* @return \phpbb\finder This object for chaining calls
|
||||||
*/
|
*/
|
||||||
public function set_extensions(array $extensions)
|
public function set_extensions(array $extensions)
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ class finder
|
||||||
* Sets a core path to be searched in addition to extensions
|
* Sets a core path to be searched in addition to extensions
|
||||||
*
|
*
|
||||||
* @param string $core_path The path relative to phpbb_root_path
|
* @param string $core_path The path relative to phpbb_root_path
|
||||||
* @return \phpbb\extension\finder This object for chaining calls
|
* @return \phpbb\finder This object for chaining calls
|
||||||
*/
|
*/
|
||||||
public function core_path($core_path)
|
public function core_path($core_path)
|
||||||
{
|
{
|
||||||
|
@ -109,7 +109,7 @@ class finder
|
||||||
* file extension is automatically added to suffixes.
|
* file extension is automatically added to suffixes.
|
||||||
*
|
*
|
||||||
* @param string $suffix A filename suffix
|
* @param string $suffix A filename suffix
|
||||||
* @return \phpbb\extension\finder This object for chaining calls
|
* @return \phpbb\finder This object for chaining calls
|
||||||
*/
|
*/
|
||||||
public function suffix($suffix)
|
public function suffix($suffix)
|
||||||
{
|
{
|
||||||
|
@ -126,7 +126,7 @@ class finder
|
||||||
* file extension is automatically added to suffixes.
|
* file extension is automatically added to suffixes.
|
||||||
*
|
*
|
||||||
* @param string $extension_suffix A filename suffix
|
* @param string $extension_suffix A filename suffix
|
||||||
* @return \phpbb\extension\finder This object for chaining calls
|
* @return \phpbb\finder This object for chaining calls
|
||||||
*/
|
*/
|
||||||
public function extension_suffix($extension_suffix)
|
public function extension_suffix($extension_suffix)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,7 @@ class finder
|
||||||
* file extension is automatically added to suffixes.
|
* file extension is automatically added to suffixes.
|
||||||
*
|
*
|
||||||
* @param string $core_suffix A filename suffix
|
* @param string $core_suffix A filename suffix
|
||||||
* @return \phpbb\extension\finder This object for chaining calls
|
* @return \phpbb\finder This object for chaining calls
|
||||||
*/
|
*/
|
||||||
public function core_suffix($core_suffix)
|
public function core_suffix($core_suffix)
|
||||||
{
|
{
|
||||||
|
@ -154,7 +154,7 @@ class finder
|
||||||
* Sets the prefix all files found in extensions and core must match
|
* Sets the prefix all files found in extensions and core must match
|
||||||
*
|
*
|
||||||
* @param string $prefix A filename prefix
|
* @param string $prefix A filename prefix
|
||||||
* @return \phpbb\extension\finder This object for chaining calls
|
* @return \phpbb\finder This object for chaining calls
|
||||||
*/
|
*/
|
||||||
public function prefix($prefix)
|
public function prefix($prefix)
|
||||||
{
|
{
|
||||||
|
@ -167,7 +167,7 @@ class finder
|
||||||
* Sets a prefix all files found in extensions must match
|
* Sets a prefix all files found in extensions must match
|
||||||
*
|
*
|
||||||
* @param string $extension_prefix A filename prefix
|
* @param string $extension_prefix A filename prefix
|
||||||
* @return \phpbb\extension\finder This object for chaining calls
|
* @return \phpbb\finder This object for chaining calls
|
||||||
*/
|
*/
|
||||||
public function extension_prefix($extension_prefix)
|
public function extension_prefix($extension_prefix)
|
||||||
{
|
{
|
||||||
|
@ -179,7 +179,7 @@ class finder
|
||||||
* Sets a prefix all files found in the core path must match
|
* Sets a prefix all files found in the core path must match
|
||||||
*
|
*
|
||||||
* @param string $core_prefix A filename prefix
|
* @param string $core_prefix A filename prefix
|
||||||
* @return \phpbb\extension\finder This object for chaining calls
|
* @return \phpbb\finder This object for chaining calls
|
||||||
*/
|
*/
|
||||||
public function core_prefix($core_prefix)
|
public function core_prefix($core_prefix)
|
||||||
{
|
{
|
||||||
|
@ -194,7 +194,7 @@ class finder
|
||||||
* the current directory.
|
* the current directory.
|
||||||
*
|
*
|
||||||
* @param string $directory
|
* @param string $directory
|
||||||
* @return \phpbb\extension\finder This object for chaining calls
|
* @return \phpbb\finder This object for chaining calls
|
||||||
*/
|
*/
|
||||||
public function directory($directory)
|
public function directory($directory)
|
||||||
{
|
{
|
||||||
|
@ -207,7 +207,7 @@ class finder
|
||||||
* Sets a directory all files found in extensions must be contained in
|
* Sets a directory all files found in extensions must be contained in
|
||||||
*
|
*
|
||||||
* @param string $extension_directory
|
* @param string $extension_directory
|
||||||
* @return \phpbb\extension\finder This object for chaining calls
|
* @return \phpbb\finder This object for chaining calls
|
||||||
*/
|
*/
|
||||||
public function extension_directory($extension_directory)
|
public function extension_directory($extension_directory)
|
||||||
{
|
{
|
||||||
|
@ -219,7 +219,7 @@ class finder
|
||||||
* Sets a directory all files found in the core path must be contained in
|
* Sets a directory all files found in the core path must be contained in
|
||||||
*
|
*
|
||||||
* @param string $core_directory
|
* @param string $core_directory
|
||||||
* @return \phpbb\extension\finder This object for chaining calls
|
* @return \phpbb\finder This object for chaining calls
|
||||||
*/
|
*/
|
||||||
public function core_directory($core_directory)
|
public function core_directory($core_directory)
|
||||||
{
|
{
|
|
@ -42,7 +42,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$finder = new \phpbb\extension\finder(
|
$finder = new \phpbb\finder(
|
||||||
new \phpbb\filesystem(),
|
new \phpbb\filesystem(),
|
||||||
dirname(__FILE__) . '/',
|
dirname(__FILE__) . '/',
|
||||||
new phpbb_mock_cache()
|
new phpbb_mock_cache()
|
||||||
|
|
|
@ -201,7 +201,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(new \phpbb\filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name');
|
$finder = new \phpbb\finder(new \phpbb\filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name');
|
||||||
$finder->set_extensions($this->extension_manager->all_enabled());
|
$finder->set_extensions($this->extension_manager->all_enabled());
|
||||||
$files = $finder->suffix('_class.php')->get_files();
|
$files = $finder->suffix('_class.php')->get_files();
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
|
||||||
'is_dir' => false,
|
'is_dir' => false,
|
||||||
);
|
);
|
||||||
|
|
||||||
$finder = new \phpbb\extension\finder(
|
$finder = new \phpbb\finder(
|
||||||
new \phpbb\filesystem(),
|
new \phpbb\filesystem(),
|
||||||
dirname(__FILE__) . '/',
|
dirname(__FILE__) . '/',
|
||||||
new phpbb_mock_cache(array(
|
new phpbb_mock_cache(array(
|
||||||
|
|
|
@ -35,7 +35,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
||||||
->will($this->returnCallback(array($this, 'return_callback_implode')));
|
->will($this->returnCallback(array($this, 'return_callback_implode')));
|
||||||
|
|
||||||
$manager = new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array());
|
$manager = new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array());
|
||||||
$finder = new \phpbb\extension\finder(
|
$finder = new \phpbb\finder(
|
||||||
new \phpbb\filesystem(),
|
new \phpbb\filesystem(),
|
||||||
dirname(__FILE__) . '/',
|
dirname(__FILE__) . '/',
|
||||||
new phpbb_mock_cache()
|
new phpbb_mock_cache()
|
||||||
|
|
Loading…
Add table
Reference in a new issue