From aa8823ac4b58be611caf2595ad3c7b0ecacbc8ac Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 6 Feb 2016 22:21:18 +0100 Subject: [PATCH] Allow auto suggestion for subpages of Special:BotPasswords The autocomplete search allows special pages to define the list of subpages to be excepted. Fill up the function to show auto suggestion for subpages of Special:BotPasswords Change-Id: I8e4037f058ac2f65b12c4bcad81b4847c408bcce --- includes/specials/SpecialBotPasswords.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/includes/specials/SpecialBotPasswords.php b/includes/specials/SpecialBotPasswords.php index 47e3316365..8aa81fbabb 100644 --- a/includes/specials/SpecialBotPasswords.php +++ b/includes/specials/SpecialBotPasswords.php @@ -347,6 +347,24 @@ class SpecialBotPasswords extends FormSpecialPage { $out->addReturnTo( $this->getPageTitle() ); } + /** + * Return an array of subpages beginning with $search that this special page will accept. + * + * @param string $search Prefix to search for + * @param int $limit Maximum number of results to return (usually 10) + * @param int $offset Number of results to skip (usually 0) + * @return string[] Matching subpages + */ + public function prefixSearchSubpages( $search, $limit, $offset ) { + $user = User::newFromName( $search ); + if ( !$user ) { + // No prefix suggestion for invalid user + return []; + } + // Autocomplete subpage as user list - public to allow caching + return UserNamePrefixSearch::search( 'public', $search, $limit, $offset ); + } + protected function getGroupName() { return 'users'; } -- 2.20.1