1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/12631] Rename finder.not_use_cache to finder.cache

PHPBB3-12631
This commit is contained in:
Rubén Calvo
2018-09-28 13:10:16 +02:00
committed by Marc Alexander
parent 9308764fae
commit d31e986815
13 changed files with 30 additions and 28 deletions

View File

@@ -3,6 +3,6 @@ services:
class: phpbb\finder\factory
arguments:
- '@cache'
- '%finder.not_use_cache%'
- '%finder.cache%'
- '%core.root_path%'
- '%core.php_ext%'

View File

@@ -27,4 +27,4 @@ core:
log_errors: true
finder:
not_use_cache: true
cache: false

View File

@@ -8,7 +8,7 @@ services:
- '%core.root_path%'
- '%core.php_ext%'
- '%tables%'
- '%finder.not_use_cache%'
- '%finder.cache%'
tags:
- { name: install_database_install, order: 1 }

View File

@@ -43,7 +43,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\finder\finder(null, true, $phpbb_root_path, $phpEx);
$finder = new \phpbb\finder\finder(null, false, $phpbb_root_path, $phpEx);
$classes = $finder->core_path('phpbb/')
->directory('/db/migration/data')
->get_classes();

View File

@@ -67,7 +67,7 @@ class container_configuration implements ConfigurationInterface
->arrayNode('finder')
->addDefaultsIfNotSet()
->children()
->booleanNode('not_use_cache')->defaultValue(false)->end()
->booleanNode('cache')->defaultValue(true)->end()
->end()
->end()
->end()

View File

@@ -19,23 +19,22 @@ namespace phpbb\finder;
class factory
{
protected $cache;
protected $not_use_cache;
protected $use_cache;
protected $phpbb_root_path;
protected $php_ext;
/**
* Creates a new finder instance with its dependencies
*
* @param string $phpbb_root_path Path to the phpbb root directory
* @param \phpbb\cache\service $cache A cache instance or null
* @param string $php_ext php file extension
* @param string $cache_name The name of the cache variable, defaults to
* _ext_finder
* @param \phpbb\cache\service $cache A cache instance or null
* @param bool $not_use_cache Use cache or not
* @param string $phpbb_root_path Path to the phpbb root directory
* @param string $php_ext php file extension
*/
public function __construct(/*\phpbb\cache\service */ $cache, $not_use_cache, $phpbb_root_path, $php_ext)
public function __construct(/*\phpbb\cache\service */ $cache, $use_cache, $phpbb_root_path, $php_ext)
{
$this->cache = $cache;
$this->not_use_cache = $not_use_cache;
$this->use_cache = $use_cache;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
}
@@ -44,10 +43,12 @@ class factory
* The cache variable name used to store $this->cached_queries in $this->cache.
*
* Allows the use of multiple differently configured finders with the same cache.
* @var string
*
* @param string $cache_name The name of the cache variable, defaults to
* _ext_finder
*/
public function get($cache_name = '_ext_finder')
{
return new finder($this->cache, $this->not_use_cache, $this->phpbb_root_path, $this->php_ext, $cache_name);
return new finder($this->cache, $this->use_cache, $this->phpbb_root_path, $this->php_ext, $cache_name);
}
}

View File

@@ -23,7 +23,7 @@ class finder
protected $extensions;
protected $phpbb_root_path;
protected $cache;
protected $not_use_cache;
protected $use_cache;
protected $php_ext;
/**
@@ -56,11 +56,11 @@ class finder
* @param string $cache_name The name of the cache variable, defaults to
* _ext_finder
*/
public function __construct(/*\phpbb\cache\service */ $cache, $not_use_cache, $phpbb_root_path, $php_ext, $cache_name = '_ext_finder')
public function __construct(/*\phpbb\cache\service */ $cache, $use_cache, $phpbb_root_path, $php_ext, $cache_name = '_ext_finder')
{
$this->phpbb_root_path = $phpbb_root_path;
$this->cache = $cache;
$this->not_use_cache = $not_use_cache;
$this->use_cache = $use_cache;
$this->php_ext = $php_ext;
$this->cache_name = $cache_name;
@@ -426,7 +426,7 @@ class finder
$this->query['is_dir'] = $is_dir;
$query = md5(serialize($this->query) . serialize($extensions));
if (!$this->not_use_cache && $cache && isset($this->cached_queries[$query]))
if ($this->use_cache && $cache && isset($this->cached_queries[$query]))
{
return $this->cached_queries[$query];
}

View File

@@ -48,7 +48,7 @@ class create_schema_file extends \phpbb\install\task_base
/**
* @var string
*/
protected $not_use_cache;
protected $finder_cache;
/**
* Constructor
@@ -64,7 +64,7 @@ class create_schema_file extends \phpbb\install\task_base
\phpbb\filesystem\filesystem_interface $filesystem,
$phpbb_root_path,
$php_ext,
$not_use_cache)
$finder_cache)
{
$dbms = $db_helper->get_available_dbms($config->get('dbms'));
$dbms = $dbms[$config->get('dbms')]['DRIVER'];
@@ -84,7 +84,7 @@ class create_schema_file extends \phpbb\install\task_base
$this->filesystem = $filesystem;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->not_use_cache = $not_use_cache;
$this->finder_cache = $finder_cache;
parent::__construct(true);
}
@@ -124,7 +124,7 @@ class create_schema_file extends \phpbb\install\task_base
include ($this->phpbb_root_path . 'includes/constants.' . $this->php_ext);
}
$finder = new \phpbb\finder\finder(null, true, $this->phpbb_root_path, $this->php_ext);
$finder = new \phpbb\finder\finder(null, $this->finder_cache, $this->phpbb_root_path, $this->php_ext);
$migrator_classes = $finder->core_path('phpbb/db/migration/data/')->get_classes();
$factory = new \phpbb\db\tools\factory();
$db_tools = $factory->get($this->db, true);