mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 16:35:35 +02:00
[ticket/12508] Move \phpbb\extension\finder to \phpbb\finder
PHPBB3-12508
This commit is contained in:
parent
d45c681b40
commit
183492b019
phpBB
develop
phpbb
tests
@ -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->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/')
|
||||
->directory('/db/migration/data')
|
||||
->get_classes();
|
||||
|
@ -46,10 +46,10 @@ class provider
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \phpbb\extension\finder $finder
|
||||
* @param \phpbb\finder $finder
|
||||
* @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
|
||||
// because the finder cannot find it
|
||||
|
@ -714,7 +714,7 @@ class migrator
|
||||
/**
|
||||
* 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 bool $check_fulfillable If TRUE (default), we will check
|
||||
* 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).
|
||||
* @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))
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ class base implements \phpbb\extension\extension_interface
|
||||
/** @var ContainerInterface */
|
||||
protected $container;
|
||||
|
||||
/** @var \phpbb\extension\finder */
|
||||
/** @var \phpbb\finder */
|
||||
protected $finder;
|
||||
|
||||
/** @var \phpbb\db\migrator */
|
||||
@ -39,11 +39,11 @@ class base implements \phpbb\extension\extension_interface
|
||||
* Constructor
|
||||
*
|
||||
* @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_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->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
|
||||
* @return \phpbb\extension\finder An extension finder instance
|
||||
* @return \phpbb\finder An extension finder instance
|
||||
*/
|
||||
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)
|
||||
{
|
||||
$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
|
||||
@ -81,7 +81,7 @@ class finder
|
||||
* Set the array of extensions
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@ -93,7 +93,7 @@ class finder
|
||||
* Sets a core path to be searched in addition to extensions
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@ -109,7 +109,7 @@ class finder
|
||||
* file extension is automatically added to suffixes.
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@ -126,7 +126,7 @@ class finder
|
||||
* file extension is automatically added to suffixes.
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@ -142,7 +142,7 @@ class finder
|
||||
* file extension is automatically added to suffixes.
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@ -154,7 +154,7 @@ class finder
|
||||
* Sets the prefix all files found in extensions and core must match
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@ -167,7 +167,7 @@ class finder
|
||||
* Sets a prefix all files found in extensions must match
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@ -179,7 +179,7 @@ class finder
|
||||
* Sets a prefix all files found in the core path must match
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@ -194,7 +194,7 @@ class finder
|
||||
* the current 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)
|
||||
{
|
||||
@ -207,7 +207,7 @@ class finder
|
||||
* Sets a directory all files found in extensions must be contained in
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
@ -219,7 +219,7 @@ class finder
|
||||
* Sets a directory all files found in the core path must be contained in
|
||||
*
|
||||
* @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)
|
||||
{
|
@ -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(),
|
||||
dirname(__FILE__) . '/',
|
||||
new phpbb_mock_cache()
|
||||
|
@ -201,7 +201,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
|
||||
public function test_get_classes_create_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());
|
||||
$files = $finder->suffix('_class.php')->get_files();
|
||||
|
||||
@ -240,7 +240,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
|
||||
'is_dir' => false,
|
||||
);
|
||||
|
||||
$finder = new \phpbb\extension\finder(
|
||||
$finder = new \phpbb\finder(
|
||||
new \phpbb\filesystem(),
|
||||
dirname(__FILE__) . '/',
|
||||
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')));
|
||||
|
||||
$manager = new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array());
|
||||
$finder = new \phpbb\extension\finder(
|
||||
$finder = new \phpbb\finder(
|
||||
new \phpbb\filesystem(),
|
||||
dirname(__FILE__) . '/',
|
||||
new phpbb_mock_cache()
|
||||
|
Loading…
x
Reference in New Issue
Block a user