* aliases; the first in the array is the canonical alias. All registered special
* pages are guaranteed to have a property entry, and for that property array to
* contain at least one entry (English fallbacks will be added if necessary).
- * @return Object
+ * @return object
*/
static function getAliasList() {
if ( !is_object( self::$aliases ) ) {
* Return categorised listable special pages which are available
* for the current user, and everyone.
*
- * @param $user User object to check permissions, $wgUser will be used if
+ * @param User $user User object to check permissions, $wgUser will be used if
* if not provided
* @return array ( string => Specialpage )
*/
* Return categorised listable special pages which are available
* for the current user, but not for everyone
*
+ * @param User|null $user User object to use or null for $wgUser
* @return array ( string => Specialpage )
*/
- public static function getRestrictedPages() {
- global $wgUser;
+ public static function getRestrictedPages( User $user = null ) {
$pages = array();
+ if ( $user === null ) {
+ global $wgUser;
+ $user = $wgUser;
+ }
foreach ( self::getList() as $name => $rec ) {
$page = self::getPage( $name );
if (
$page->isListed()
&& $page->isRestricted()
- && $page->userCanExecute( $wgUser )
+ && $page->userCanExecute( $user )
) {
$pages[$name] = $page;
}