1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[ticket/13713] Refactor sorting functionality

PHPBB3-13713
This commit is contained in:
lavigor
2018-07-09 02:16:42 +03:00
committed by Marc Alexander
parent ffbff7ed79
commit 2bb50add04
13 changed files with 86 additions and 37 deletions

View File

@@ -73,16 +73,15 @@ abstract class base_user implements source_interface
/**
* {@inheritdoc}
*/
public function get($keyword, $topic_id)
public function get(array &$names, $keyword, $topic_id)
{
$keyword = utf8_clean_string($keyword);
$result = $this->db->sql_query_limit($this->query($keyword, $topic_id), self::NAMES_BATCH_SIZE);
$names = [];
while ($row = $this->db->sql_fetchrow($result))
{
$user_rank = $this->user_loader->get_rank($row['user_id'], true);
$names[] = [
array_push($names, [
'name' => $row['username'],
'type' => 'u',
'id' => $row['user_id'],
@@ -92,7 +91,7 @@ abstract class base_user implements source_interface
],
'rank' => (isset($user_rank['rank_title'])) ? $user_rank['rank_title'] : '',
'priority' => $this->get_priority($row),
];
]);
}
$this->db->sql_freeresult($result);