1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-13 12:14:06 +02:00

[ticket/13713] Fix priorities

PHPBB3-13713
This commit is contained in:
lavigor
2018-07-22 03:58:00 +03:00
committed by Marc Alexander
parent 6f8467a2fa
commit e616ec025c
6 changed files with 62 additions and 7 deletions

View File

@@ -15,19 +15,31 @@ namespace phpbb\mention\source;
class user extends base_user
{
/**
* {@inheritdoc}
*/
public function get_priority($row)
{
/*
* Presence in array with all names for this type should not increase the priority
* Otherwise names will not be properly sorted because we fetch them in batches
* and the name from 'special' source can be absent from the array with all names
* and therefore it will appear lower than needed
*/
return 0;
}
/**
* {@inheritdoc}
*/
protected function query($keyword, $topic_id)
{
// TODO: think about caching ALL users: 1m users results to ~40MB file
$query = $this->db->sql_build_query('SELECT', [
'SELECT' => 'u.username_clean, u.username, u.user_id',
'FROM' => [
USERS_TABLE => 'u',
],
'WHERE' => $this->db->sql_in_set('u.user_type', [USER_NORMAL, USER_FOUNDER])/* . '
AND u.username_clean ' . $this->db->sql_like_expression($keyword . $this->db->get_any_char())*/,
'WHERE' => $this->db->sql_in_set('u.user_type', [USER_NORMAL, USER_FOUNDER]),
'ORDER_BY' => 'u.user_lastvisit DESC'
]);
return $query;