diff --git a/phpBB/config/default/container/services_search.yml b/phpBB/config/default/container/services_search.yml index ba0f8f2761..f056f71295 100644 --- a/phpBB/config/default/container/services_search.yml +++ b/phpBB/config/default/container/services_search.yml @@ -4,7 +4,6 @@ services: search.fulltext.native: class: phpbb\search\backend\fulltext_native arguments: - - '@cache' - '@config' - '@dbal.conn' - '@dispatcher' @@ -18,7 +17,6 @@ services: search.fulltext.mysql: class: phpbb\search\backend\fulltext_mysql arguments: - - '@cache' - '@config' - '@dbal.conn' - '@dispatcher' @@ -32,7 +30,6 @@ services: search.fulltext.postgres: class: phpbb\search\backend\fulltext_postgres arguments: - - '@cache' - '@config' - '@dbal.conn' - '@dispatcher' diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php index bce0c8d6d8..7534c417e8 100644 --- a/phpBB/phpbb/cache/service.php +++ b/phpBB/phpbb/cache/service.php @@ -13,6 +13,8 @@ namespace phpbb\cache; +use phpbb\cache\driver\driver_interface; +use phpbb\config\config; use phpbb\json\sanitizer as json_sanitizer; /** @@ -23,14 +25,14 @@ class service /** * Cache driver. * - * @var \phpbb\cache\driver\driver_interface + * @var driver_interface */ protected $driver; /** * The config. * - * @var \phpbb\config\config + * @var config */ protected $config; @@ -58,13 +60,13 @@ class service /** * Creates a cache service around a cache driver * - * @param \phpbb\cache\driver\driver_interface $driver The cache driver - * @param \phpbb\config\config $config The config + * @param driver_interface $driver The cache driver + * @param config $config The config * @param \phpbb\db\driver\driver_interface $db Database connection * @param string $phpbb_root_path Root path * @param string $php_ext PHP file extension */ - public function __construct(\phpbb\cache\driver\driver_interface $driver, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext) + public function __construct(driver_interface $driver, config $config, \phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext) { $this->set_driver($driver); $this->config = $config; @@ -76,7 +78,7 @@ class service /** * Returns the cache driver used by this cache service. * - * @return \phpbb\cache\driver\driver_interface The cache driver + * @return driver_interface The cache driver */ public function get_driver() { @@ -86,9 +88,9 @@ class service /** * Replaces the cache driver used by this cache service. * - * @param \phpbb\cache\driver\driver_interface $driver The cache driver + * @param driver_interface $driver The cache driver */ - public function set_driver(\phpbb\cache\driver\driver_interface $driver) + public function set_driver(driver_interface $driver) { $this->driver = $driver; } diff --git a/phpBB/phpbb/install/module/install_data/task/create_search_index.php b/phpBB/phpbb/install/module/install_data/task/create_search_index.php index ce74b220d8..bceeb3a8e1 100644 --- a/phpBB/phpbb/install/module/install_data/task/create_search_index.php +++ b/phpBB/phpbb/install/module/install_data/task/create_search_index.php @@ -98,12 +98,12 @@ class create_search_index extends database_task /** * Constructor * - * @param config $config Installer config. - * @param database $db_helper Database helper. - * @param container_factory $container Installer's DI container - * @param iohandler_interface $iohandler IO manager. - * @param string $phpbb_root_path phpBB root path - * @param string $php_ext PHP file extension + * @param config $config Installer config. + * @param database $db_helper Database helper. + * @param container_factory $container Installer's DI container + * @param iohandler_interface $iohandler IO manager. + * @param string $phpbb_root_path phpBB root path + * @param string $php_ext PHP file extension */ public function __construct( config $config, @@ -127,11 +127,11 @@ class create_search_index extends database_task $this->posts_table = $container->get_parameter('tables.posts'); - // Esto se cargara por servicio abajo $this->search_indexer = new fulltext_native( $this->config, $this->db, $this->phpbb_dispatcher, + $container->get('language'), $this->user, $this->phpbb_root_path, $this->php_ext @@ -148,7 +148,6 @@ class create_search_index extends database_task // Make sure fulltext native load update is set $this->config->set('fulltext_native_load_upd', 1); - // TODO: Replace this with create_index() when it don't depend on acp try { $sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id FROM ' . $this->posts_table; @@ -181,7 +180,7 @@ class create_search_index extends database_task /** * {@inheritdoc} */ - static public function get_step_count() : int + public static function get_step_count() : int { return 1; } diff --git a/phpBB/phpbb/search/backend/fulltext_mysql.php b/phpBB/phpbb/search/backend/fulltext_mysql.php index 8471d16ed6..71468debd4 100644 --- a/phpBB/phpbb/search/backend/fulltext_mysql.php +++ b/phpBB/phpbb/search/backend/fulltext_mysql.php @@ -13,7 +13,6 @@ namespace phpbb\search\backend; -use phpbb\cache\service; use phpbb\config\config; use phpbb\db\driver\driver_interface; use phpbb\event\dispatcher_interface; @@ -73,7 +72,6 @@ class fulltext_mysql extends base implements search_backend_interface * Constructor * Creates a new \phpbb\search\backend\fulltext_mysql, which is used as a search backend * - * @param service $cache * @param config $config Config object * @param driver_interface $db Database object * @param dispatcher_interface $phpbb_dispatcher Event dispatcher object @@ -82,8 +80,10 @@ class fulltext_mysql extends base implements search_backend_interface * @param string $phpbb_root_path Relative path to phpBB root * @param string $phpEx PHP file extension */ - public function __construct(service $cache, config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx) + public function __construct(config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx) { + global $cache; + parent::__construct($cache, $config, $db, $user); $this->phpbb_dispatcher = $phpbb_dispatcher; $this->language = $language; diff --git a/phpBB/phpbb/search/backend/fulltext_native.php b/phpBB/phpbb/search/backend/fulltext_native.php index 56075186ae..ccbdc08a2d 100644 --- a/phpBB/phpbb/search/backend/fulltext_native.php +++ b/phpBB/phpbb/search/backend/fulltext_native.php @@ -13,7 +13,6 @@ namespace phpbb\search\backend; -use phpbb\cache\service; use phpbb\config\config; use phpbb\db\driver\driver_interface; use phpbb\event\dispatcher_interface; @@ -102,7 +101,6 @@ class fulltext_native extends base implements search_backend_interface /** * Initialises the fulltext_native search backend with min/max word length * - * @param service $cache * @param config $config Config object * @param driver_interface $db Database object * @param dispatcher_interface $phpbb_dispatcher Event dispatcher object @@ -111,8 +109,10 @@ class fulltext_native extends base implements search_backend_interface * @param string $phpbb_root_path phpBB root path * @param string $phpEx PHP file extension */ - public function __construct(service $cache, config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx) + public function __construct(config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx) { + global $cache; + parent::__construct($cache, $config, $db, $user); $this->phpbb_dispatcher = $phpbb_dispatcher; $this->language = $language; diff --git a/phpBB/phpbb/search/backend/fulltext_postgres.php b/phpBB/phpbb/search/backend/fulltext_postgres.php index 7ffb9da857..90f7771426 100644 --- a/phpBB/phpbb/search/backend/fulltext_postgres.php +++ b/phpBB/phpbb/search/backend/fulltext_postgres.php @@ -13,7 +13,6 @@ namespace phpbb\search\backend; -use phpbb\cache\service; use phpbb\config\config; use phpbb\db\driver\driver_interface; use phpbb\event\dispatcher_interface; @@ -85,7 +84,6 @@ class fulltext_postgres extends base implements search_backend_interface * Constructor * Creates a new \phpbb\search\backend\fulltext_postgres, which is used as a search backend * - * @param service $cache * @param config $config Config object * @param driver_interface $db Database object * @param dispatcher_interface $phpbb_dispatcher Event dispatcher object @@ -94,8 +92,10 @@ class fulltext_postgres extends base implements search_backend_interface * @param string $phpbb_root_path Relative path to phpBB root * @param string $phpEx PHP file extension */ - public function __construct(service $cache, config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx) + public function __construct(config $config, driver_interface $db, dispatcher_interface $phpbb_dispatcher, language $language, user $user, string $phpbb_root_path, string $phpEx) { + global $cache; + parent::__construct($cache, $config, $db, $user); $this->phpbb_dispatcher = $phpbb_dispatcher; $this->language = $language; diff --git a/phpBB/phpbb/search/backend/fulltext_sphinx.php b/phpBB/phpbb/search/backend/fulltext_sphinx.php index cb376c1502..8a493a4dc3 100644 --- a/phpBB/phpbb/search/backend/fulltext_sphinx.php +++ b/phpBB/phpbb/search/backend/fulltext_sphinx.php @@ -14,7 +14,6 @@ namespace phpbb\search\backend; use phpbb\auth\auth; -use phpbb\cache\service; use phpbb\config\config; use phpbb\db\driver\driver_interface; use phpbb\db\tools\tools_interface; diff --git a/tests/search/mysql_test.php b/tests/search/mysql_test.php index 513135bac1..1e822b92af 100644 --- a/tests/search/mysql_test.php +++ b/tests/search/mysql_test.php @@ -40,6 +40,6 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case $this->db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $class = self::get_search_wrapper('\phpbb\search\backend\fulltext_mysql'); - $this->search = new $class($cache, $config, $this->db, $phpbb_dispatcher, $language, $user, $phpbb_root_path, $phpEx); + $this->search = new $class($config, $this->db, $phpbb_dispatcher, $language, $user, $phpbb_root_path, $phpEx); } } diff --git a/tests/search/native_test.php b/tests/search/native_test.php index 015d8f0b27..6d8a03f4aa 100644 --- a/tests/search/native_test.php +++ b/tests/search/native_test.php @@ -38,7 +38,7 @@ class phpbb_search_native_test extends phpbb_search_test_case $class = self::get_search_wrapper('\phpbb\search\backend\fulltext_native'); $config['fulltext_native_min_chars'] = 2; $config['fulltext_native_max_chars'] = 14; - $this->search = new $class($cache, $config, $this->db, $phpbb_dispatcher, $language, $user, $phpbb_root_path, $phpEx); + $this->search = new $class($config, $this->db, $phpbb_dispatcher, $language, $user, $phpbb_root_path, $phpEx); } public function keywords() diff --git a/tests/search/postgres_test.php b/tests/search/postgres_test.php index b4dbb507b3..545ffafd50 100644 --- a/tests/search/postgres_test.php +++ b/tests/search/postgres_test.php @@ -40,6 +40,6 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case $this->db = $this->new_dbal(); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $class = self::get_search_wrapper('\phpbb\search\backend\fulltext_postgres'); - $this->search = new $class($cache, $config, $this->db, $phpbb_dispatcher, $language, $user, $phpbb_root_path, $phpEx); + $this->search = new $class($config, $this->db, $phpbb_dispatcher, $language, $user, $phpbb_root_path, $phpEx); } }