3 * Prefix search of user names.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
23 use MediaWiki\MediaWikiServices
;
24 use MediaWiki\User\User
;
26 // phpcs:disable MediaWiki.Files.ClassMatchesFilename.NotMatch
28 * Handles searching prefixes of user names
30 * @note There are two classes called UserNamePrefixSearch. You should use the first one, in
31 * namespace MediaWiki\User, which is a service. \UserNamePrefixSearch is a deprecated static wrapper
32 * that forwards to the global service.
34 * @deprecated since 1.36, use the MediaWiki\User\UserNamePrefixSearch service; hard deprecated
39 class UserNamePrefixSearch
{
42 * Do a prefix search of user names and return a list of matching user names.
44 * @deprecated since 1.36, use the MediaWiki\User\UserNamePrefixSearch service instead; hard
45 * deprecated since 1.41
47 * @param string|User $audience The string 'public' or a user object to show the search for
48 * @param string $search
50 * @param int $offset How many results to offset from the beginning
53 public static function search( $audience, $search, $limit, $offset = 0 ) {
54 wfDeprecated( __METHOD__
, '1.36' );
55 return MediaWikiServices
::getInstance()
56 ->getUserNamePrefixSearch()
57 ->search( $audience, (string)$search, (int)$limit, (int)$offset );