Merge "jquery.accessKeyLabel: make modifier info public"
[lhc/web/wiklou.git] / includes / specials / SpecialListfiles.php
index 3ea56c6..9a73a25 100644 (file)
@@ -57,6 +57,24 @@ class SpecialListFiles extends IncludableSpecialPage {
                }
        }
 
+       /**
+        * 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 array();
+               }
+               // Autocomplete subpage as user list - public to allow caching
+               return UserNamePrefixSearch::search( 'public', $search, $limit, $offset );
+       }
+
        protected function getGroupName() {
                return 'media';
        }
@@ -108,7 +126,7 @@ class ImageListPager extends TablePager {
 
                if ( $search !== '' && !$this->getConfig()->get( 'MiserMode' ) ) {
                        $this->mSearch = $search;
-                       $nt = Title::newFromURL( $this->mSearch );
+                       $nt = Title::newFromText( $this->mSearch );
 
                        if ( $nt ) {
                                $dbr = wfGetDB( DB_SLAVE );
@@ -147,7 +165,7 @@ class ImageListPager extends TablePager {
                }
 
                if ( $this->mSearch !== '' ) {
-                       $nt = Title::newFromURL( $this->mSearch );
+                       $nt = Title::newFromText( $this->mSearch );
                        if ( $nt ) {
                                $dbr = wfGetDB( DB_SLAVE );
                                $conds[] = 'LOWER(' . $prefix . '_name)' .