Merge "RevisionStoreDbTestBase, remove redundant needsDB override"
[lhc/web/wiklou.git] / includes / specialpage / SpecialPageFactory_deprecated.php
1 <?php
2 /**
3 * Factory for handling the special page list and generating SpecialPage objects.
4 *
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.
9 *
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.
14 *
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
19 *
20 * @file
21 * @ingroup SpecialPage
22 * @defgroup SpecialPage SpecialPage
23 */
24
25 use MediaWiki\Linker\LinkRenderer;
26 use MediaWiki\MediaWikiServices;
27
28 // phpcs:disable MediaWiki.Files.ClassMatchesFilename.NotMatch
29 /**
30 * Wrapper for backward compatibility for old callers that used static methods.
31 *
32 * @deprecated since 1.32, use the SpecialPageFactory service instead
33 */
34 class SpecialPageFactory {
35 public static function getNames() : array {
36 return MediaWikiServices::getInstance()->getSpecialPageFactory()->getNames();
37 }
38
39 public static function resolveAlias( $alias ) : array {
40 return MediaWikiServices::getInstance()->getSpecialPageFactory()->resolveAlias( $alias );
41 }
42
43 public static function exists( $name ) {
44 return MediaWikiServices::getInstance()->getSpecialPageFactory()->exists( $name );
45 }
46
47 public static function getPage( $name ) {
48 return MediaWikiServices::getInstance()->getSpecialPageFactory()->getPage( $name );
49 }
50
51 public static function getUsablePages( User $user = null ) : array {
52 global $wgUser;
53 $user = $user ?? $wgUser;
54 return MediaWikiServices::getInstance()->getSpecialPageFactory()->getUsablePages( $user );
55 }
56
57 public static function getRegularPages() : array {
58 return MediaWikiServices::getInstance()->getSpecialPageFactory()->getRegularPages();
59 }
60
61 public static function getRestrictedPages( User $user = null ) : array {
62 global $wgUser;
63 $user = $user ?? $wgUser;
64 return MediaWikiServices::getInstance()->getSpecialPageFactory()->getRestrictedPages( $user );
65 }
66
67 public static function executePath( Title &$title, IContextSource &$context, $including = false,
68 LinkRenderer $linkRenderer = null
69 ) {
70 return MediaWikiServices::getInstance()->getSpecialPageFactory()
71 ->executePath( $title, $context, $including, $linkRenderer );
72 }
73
74 public static function capturePath(
75 Title $title, IContextSource $context, LinkRenderer $linkRenderer = null
76 ) {
77 return MediaWikiServices::getInstance()->getSpecialPageFactory()
78 ->capturePath( $title, $context, $linkRenderer );
79 }
80
81 public static function getLocalNameFor( $name, $subpage = false ) {
82 return MediaWikiServices::getInstance()->getSpecialPageFactory()
83 ->getLocalNameFor( $name, $subpage );
84 }
85
86 public static function getTitleForAlias( $alias ) {
87 return MediaWikiServices::getInstance()->getSpecialPageFactory()
88 ->getTitleForAlias( $alias );
89 }
90
91 /**
92 * No-op since 1.32, call overrideMwServices() instead
93 */
94 public static function resetList() {
95 }
96 }