3 * Factory for handling the special page list and generating SpecialPage objects.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 * @ingroup SpecialPage
22 * @defgroup SpecialPage SpecialPage
25 use MediaWiki\Linker\LinkRenderer
;
26 use MediaWiki\MediaWikiServices
;
28 // phpcs:disable MediaWiki.Files.ClassMatchesFilename.NotMatch
30 * Wrapper for backward compatibility for old callers that used static methods.
32 * @deprecated since 1.32, use the SpecialPageFactory service instead
34 class SpecialPageFactory
{
35 public static function getNames() : array {
36 return MediaWikiServices
::getInstance()->getSpecialPageFactory()->getNames();
39 public static function resolveAlias( $alias ) : array {
40 return MediaWikiServices
::getInstance()->getSpecialPageFactory()->resolveAlias( $alias );
43 public static function exists( $name ) {
44 return MediaWikiServices
::getInstance()->getSpecialPageFactory()->exists( $name );
47 public static function getPage( $name ) {
48 return MediaWikiServices
::getInstance()->getSpecialPageFactory()->getPage( $name );
51 public static function getUsablePages( User
$user = null ) : array {
53 $user = $user ??
$wgUser;
54 return MediaWikiServices
::getInstance()->getSpecialPageFactory()->getUsablePages( $user );
57 public static function getRegularPages() : array {
58 return MediaWikiServices
::getInstance()->getSpecialPageFactory()->getRegularPages();
61 public static function getRestrictedPages( User
$user = null ) : array {
63 $user = $user ??
$wgUser;
64 return MediaWikiServices
::getInstance()->getSpecialPageFactory()->getRestrictedPages( $user );
67 public static function executePath( Title
&$title, IContextSource
&$context, $including = false,
68 LinkRenderer
$linkRenderer = null
70 return MediaWikiServices
::getInstance()->getSpecialPageFactory()
71 ->executePath( $title, $context, $including, $linkRenderer );
74 public static function capturePath(
75 Title
$title, IContextSource
$context, LinkRenderer
$linkRenderer = null
77 return MediaWikiServices
::getInstance()->getSpecialPageFactory()
78 ->capturePath( $title, $context, $linkRenderer );
81 public static function getLocalNameFor( $name, $subpage = false ) {
82 return MediaWikiServices
::getInstance()->getSpecialPageFactory()
83 ->getLocalNameFor( $name, $subpage );
86 public static function getTitleForAlias( $alias ) {
87 return MediaWikiServices
::getInstance()->getSpecialPageFactory()
88 ->getTitleForAlias( $alias );
92 * No-op since 1.32, call overrideMwServices() instead
94 public static function resetList() {