1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-09 10:16:36 +02:00

[ticket/15540] Refactor search backend classes to Symfony services

PHPBB3-15540
This commit is contained in:
Ruben Calvo
2018-11-07 06:21:46 +00:00
committed by rubencm
parent 271d6d3169
commit 2aabf560b4
36 changed files with 567 additions and 522 deletions

View File

@@ -561,7 +561,7 @@ function phpbb_get_num_ips_for_poster(\phpbb\db\driver\driver_interface $db, $po
*/
function change_poster(&$post_info, $userdata)
{
global $auth, $db, $config, $phpbb_root_path, $phpEx, $user, $phpbb_log, $phpbb_dispatcher;
global $db, $config, $user, $phpbb_log, $phpbb_dispatcher;
if (empty($userdata) || $userdata['user_id'] == $post_info['user_id'])
{
@@ -632,18 +632,12 @@ function change_poster(&$post_info, $userdata)
}
// refresh search cache of this post
$search_type = $config['search_type'];
$search_backend_factory = $phpbb_container->get('search.backend_factory');
$search = $search_backend_factory->get_active();
if (class_exists($search_type))
if (method_exists($search, 'destroy_cache'))
{
// We do some additional checks in the module to ensure it can actually be utilised
$error = false;
$search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher);
if (!$error && method_exists($search, 'destroy_cache'))
{
$search->destroy_cache(array(), array($post_info['user_id'], $userdata['user_id']));
}
$search->destroy_cache(array(), array($post_info['user_id'], $userdata['user_id']));
}
$from_username = $post_info['username'];