Replace usages of deprecated User::isAllowed. Step 2.
[lhc/web/wiklou.git] / includes / specialpage / SpecialPage.php
index eba406e..ba8e318 100644 (file)
@@ -278,7 +278,9 @@ class SpecialPage implements MessageLocalizer {
         */
        public function isRestricted() {
                // DWIM: If anons can do something, then it is not restricted
-               return $this->mRestriction != '' && !User::groupHasPermission( '*', $this->mRestriction );
+               return $this->mRestriction != '' && !MediaWikiServices::getInstance()
+                               ->getPermissionManager()
+                               ->groupHasPermission( '*', $this->mRestriction );
        }
 
        /**
@@ -290,7 +292,9 @@ class SpecialPage implements MessageLocalizer {
         * @return bool Does the user have permission to view the page?
         */
        public function userCanExecute( User $user ) {
-               return $user->isAllowed( $this->mRestriction );
+               return MediaWikiServices::getInstance()
+                       ->getPermissionManager()
+                       ->userHasRight( $user, $this->mRestriction );
        }
 
        /**
@@ -456,10 +460,10 @@ class SpecialPage implements MessageLocalizer {
         * For example, if a page supports subpages "foo", "bar" and "baz" (as in Special:PageName/foo,
         * etc.):
         *
-        *   - `prefixSearchSubpages( "ba" )` should return `array( "bar", "baz" )`
-        *   - `prefixSearchSubpages( "f" )` should return `array( "foo" )`
-        *   - `prefixSearchSubpages( "z" )` should return `array()`
-        *   - `prefixSearchSubpages( "" )` should return `array( foo", "bar", "baz" )`
+        *   - `prefixSearchSubpages( "ba" )` should return `[ "bar", "baz" ]`
+        *   - `prefixSearchSubpages( "f" )` should return `[ "foo" ]`
+        *   - `prefixSearchSubpages( "z" )` should return `[]`
+        *   - `prefixSearchSubpages( "" )` should return `[ foo", "bar", "baz" ]`
         *
         * @param string $search Prefix to search for
         * @param int $limit Maximum number of results to return (usually 10)