[ticket/13713] Use config limit for fetching users

PHPBB3-13713
This commit is contained in:
lavigor 2018-06-21 11:04:07 +03:00 committed by Marc Alexander
parent ab91cf6ca6
commit 368090b7e6
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
2 changed files with 7 additions and 2 deletions

View file

@ -30,6 +30,7 @@ services:
abstract: true
arguments:
- '@dbal.conn'
- '@config'
- '@user_loader'
- '%core.root_path%'
- '%core.php_ext%'

View file

@ -18,6 +18,9 @@ abstract class base_user implements source_interface
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\user_loader */
protected $user_loader;
@ -30,9 +33,10 @@ abstract class base_user implements source_interface
/**
* Constructor
*/
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user_loader $user_loader, $phpbb_root_path, $phpEx)
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\user_loader $user_loader, $phpbb_root_path, $phpEx)
{
$this->db = $db;
$this->config = $config;
$this->user_loader = $user_loader;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
@ -58,7 +62,7 @@ abstract class base_user implements source_interface
public function get($keyword, $topic_id)
{
$keyword = utf8_clean_string($keyword);
$result = $this->db->sql_query_limit($this->query($keyword, $topic_id), 5);
$result = $this->db->sql_query_limit($this->query($keyword, $topic_id), $this->config['mention_names_limit']);
$names = [];
while ($row = $this->db->sql_fetchrow($result))