Add SpecialEditWatchlist::prefixSearchSubpages
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 13 Jun 2014 18:51:58 +0000 (20:51 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Fri, 13 Jun 2014 18:51:58 +0000 (20:51 +0200)
Also add 'clear' to SpecialWatchlist::prefixSearchSubpages

Change-Id: Ibc1ca44a9472cd86a6dc5df04274089b8fcf30a2

includes/specials/SpecialEditWatchlist.php
includes/specials/SpecialWatchlist.php

index ebbef17..02d8d70 100644 (file)
@@ -117,6 +117,21 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                }
        }
 
+       /**
+        * Return an array of subpages beginning with $search that this special page will accept.
+        *
+        * @param string $search Prefix to search for
+        * @param integer $limit Maximum number of results to return
+        * @return string[] Matching subpages
+        */
+       public function prefixSearchSubpages( $search, $limit = 10 ) {
+               // SpecialWatchlist uses SpecialEditWatchlist::getMode, so new types should be added
+               // here and there - no 'edit' here, because that the default for this page
+               $subpages = array( 'clear', 'raw' );
+               $escaped = preg_quote( $search );
+               return array_slice( preg_grep( "/^$escaped/i", $subpages ), 0, $limit );
+       }
+
        /**
         * Extract a list of titles from a blob of text, returning
         * (prefixed) strings; unwatchable titles are ignored
index 1add311..2aec8df 100644 (file)
@@ -87,7 +87,8 @@ class SpecialWatchlist extends ChangesListSpecialPage {
         * @return string[] Matching subpages
         */
        public function prefixSearchSubpages( $search, $limit = 10 ) {
-               $subpages = array( 'edit', 'raw' );
+               // See also SpecialEditWatchlist::prefixSearchSubpages
+               $subpages = array( 'clear', 'edit', 'raw' );
                $escaped = preg_quote( $search );
                return array_slice( preg_grep( "/^$escaped/i", $subpages ), 0, $limit );
        }