1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-17 22:11:26 +02:00

[ticket/12631] Add finder.not_use_cache

PHPBB3-12631
This commit is contained in:
Rubén Calvo
2018-09-01 01:32:22 +02:00
committed by Marc Alexander
parent 38024d14bf
commit 9308764fae
22 changed files with 136 additions and 42 deletions

View File

@@ -23,7 +23,7 @@ class base implements \phpbb\extension\extension_interface
/** @var ContainerInterface */
protected $container;
/** @var \phpbb\finder */
/** @var \phpbb\finder\finder */
protected $extension_finder;
/** @var \phpbb\db\migrator */
@@ -42,12 +42,12 @@ class base implements \phpbb\extension\extension_interface
* Constructor
*
* @param ContainerInterface $container Container object
* @param \phpbb\finder $extension_finder
* @param \phpbb\finder\finder $extension_finder
* @param \phpbb\db\migrator $migrator
* @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\finder $extension_finder, \phpbb\db\migrator $migrator, $extension_name, $extension_path)
public function __construct(ContainerInterface $container, \phpbb\finder\finder $extension_finder, \phpbb\db\migrator $migrator, $extension_name, $extension_path)
{
$this->container = $container;
$this->extension_finder = $extension_finder;

View File

@@ -15,6 +15,7 @@ namespace phpbb\extension;
use phpbb\exception\runtime_exception;
use phpbb\file_downloader;
use phpbb\finder\factory as finder_factory;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -27,8 +28,8 @@ class manager
protected $db;
protected $config;
protected $finder_factory;
protected $cache;
protected $php_ext;
protected $extensions;
protected $extension_table;
protected $phpbb_root_path;
@@ -42,20 +43,19 @@ class manager
* @param \phpbb\config\config $config Config object
* @param string $extension_table The name of the table holding extensions
* @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $php_ext php file extension, defaults to php
* @param \phpbb\cache\service|null $cache A cache instance or null
* @param string $cache_name The name of the cache variable, defaults to _ext
*/
public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\service $cache = null, $cache_name = '_ext')
public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, finder_factory $finder_factory, $extension_table, $phpbb_root_path, \phpbb\cache\service $cache = null, $cache_name = '_ext')
{
$this->cache = $cache;
$this->cache_name = $cache_name;
$this->config = $config;
$this->finder_factory = $finder_factory;
$this->container = $container;
$this->db = $db;
$this->extension_table = $extension_table;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->extensions = ($this->cache) ? $this->cache->get($this->cache_name) : false;
@@ -568,14 +568,15 @@ class manager
}
/**
* Instantiates a \phpbb\finder.
* Instantiates a \phpbb\finder\finder.
*
* @param bool $use_all_available Should we load all extensions, or just enabled ones
* @return \phpbb\finder An extension finder instance
* @return \phpbb\finder\finder An extension finder instance
*/
public function get_finder($use_all_available = false)
{
$finder = new \phpbb\finder($this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
$finder = $this->finder_factory->get($this->cache_name . '_finder');
if ($use_all_available)
{
$finder->set_extensions(array_keys($this->all_available()));
@@ -584,6 +585,7 @@ class manager
{
$finder->set_extensions(array_keys($this->all_enabled()));
}
return $finder;
}
}