Index: trunk/phase3/includes/SpecialPageFactory.php |
— | — | @@ -339,16 +339,21 @@ |
340 | 340 | * Return categorised listable special pages which are available |
341 | 341 | * for the current user, and everyone. |
342 | 342 | * |
| 343 | + * @param $user User object to check permissions, $wgUser will be used |
| 344 | + * if not provided |
343 | 345 | * @return Array( String => Specialpage ) |
344 | 346 | */ |
345 | | - public static function getUsablePages() { |
346 | | - global $wgUser; |
| 347 | + public static function getUsablePages( User $user = null ) { |
347 | 348 | $pages = array(); |
| 349 | + if ( $user === null ) { |
| 350 | + global $wgUser; |
| 351 | + $user = $wgUser; |
| 352 | + } |
348 | 353 | foreach ( self::getList() as $name => $rec ) { |
349 | 354 | $page = self::getPage( $name ); |
350 | 355 | if ( $page // not null |
351 | 356 | && $page->isListed() |
352 | | - && ( !$page->isRestricted() || $page->userCanExecute( $wgUser ) ) |
| 357 | + && ( !$page->isRestricted() || $page->userCanExecute( $user ) ) |
353 | 358 | ) { |
354 | 359 | $pages[$name] = $page; |
355 | 360 | } |
Index: trunk/phase3/includes/specials/SpecialSpecialpages.php |
— | — | @@ -51,7 +51,7 @@ |
52 | 52 | private function getPageGroups() { |
53 | 53 | global $wgSortSpecialPages; |
54 | 54 | |
55 | | - $pages = SpecialPageFactory::getUsablePages(); |
| 55 | + $pages = SpecialPageFactory::getUsablePages( $this->getUser() ); |
56 | 56 | |
57 | 57 | if( !count( $pages ) ) { |
58 | 58 | # Yeah, that was pointless. Thanks for coming. |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -189,11 +189,13 @@ |
190 | 190 | * Return categorised listable special pages which are available |
191 | 191 | * for the current user, and everyone. |
192 | 192 | * |
| 193 | + * @param $user User object to check permissions, $wgUser will be used |
| 194 | + * if not provided |
193 | 195 | * @return Associative array mapping page's name to its SpecialPage object |
194 | 196 | * @deprecated since 1.18 call SpecialPageFactory method directly |
195 | 197 | */ |
196 | | - static function getUsablePages() { |
197 | | - return SpecialPageFactory::getUsablePages(); |
| 198 | + static function getUsablePages( User $user = null ) { |
| 199 | + return SpecialPageFactory::getUsablePages( $user ); |
198 | 200 | } |
199 | 201 | |
200 | 202 | /** |