dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Revert "Don't construct SpecialPages twice""
[lhc/web/wiklou.git]
/
includes
/
specialpage
/
SpecialPageFactory.php
diff --git
a/includes/specialpage/SpecialPageFactory.php
b/includes/specialpage/SpecialPageFactory.php
index
8ce480e
..
daabded
100644
(file)
--- a/
includes/specialpage/SpecialPageFactory.php
+++ b/
includes/specialpage/SpecialPageFactory.php
@@
-21,6
+21,7
@@
* @ingroup SpecialPage
* @defgroup SpecialPage SpecialPage
*/
* @ingroup SpecialPage
* @defgroup SpecialPage SpecialPage
*/
+use MediaWiki\Linker\LinkRenderer;
/**
* Factory for handling the special page list and generating SpecialPage objects.
/**
* Factory for handling the special page list and generating SpecialPage objects.
@@
-81,11
+82,17
@@
class SpecialPageFactory {
'PagesWithProp' => 'SpecialPagesWithProp',
'TrackingCategories' => 'SpecialTrackingCategories',
'PagesWithProp' => 'SpecialPagesWithProp',
'TrackingCategories' => 'SpecialTrackingCategories',
- // Login/create account
- 'Userlogin' => 'LoginForm',
+ // Authentication
+ 'Userlogin' => 'SpecialUserLogin',
+ 'Userlogout' => 'SpecialUserLogout',
'CreateAccount' => 'SpecialCreateAccount',
'CreateAccount' => 'SpecialCreateAccount',
+ 'LinkAccounts' => 'SpecialLinkAccounts',
+ 'UnlinkAccounts' => 'SpecialUnlinkAccounts',
+ 'ChangeCredentials' => 'SpecialChangeCredentials',
+ 'RemoveCredentials' => 'SpecialRemoveCredentials',
// Users and rights
// Users and rights
+ 'Activeusers' => 'SpecialActiveUsers',
'Block' => 'SpecialBlock',
'Unblock' => 'SpecialUnblock',
'BlockList' => 'SpecialBlockList',
'Block' => 'SpecialBlock',
'Unblock' => 'SpecialUnblock',
'BlockList' => 'SpecialBlockList',
@@
-177,7
+184,6
@@
class SpecialPageFactory {
'Revisiondelete' => 'SpecialRevisionDelete',
'RunJobs' => 'SpecialRunJobs',
'Specialpages' => 'SpecialSpecialpages',
'Revisiondelete' => 'SpecialRevisionDelete',
'RunJobs' => 'SpecialRunJobs',
'Specialpages' => 'SpecialSpecialpages',
- 'Userlogout' => 'SpecialUserlogout',
];
private static $list;
];
private static $list;
@@
-252,8
+258,6
@@
class SpecialPageFactory {
self::$list['ChangeContentModel'] = 'SpecialChangeContentModel';
}
self::$list['ChangeContentModel'] = 'SpecialChangeContentModel';
}
- self::$list['Activeusers'] = 'SpecialActiveUsers';
-
// Add extension special pages
self::$list = array_merge( self::$list, $wgSpecialPages );
// Add extension special pages
self::$list = array_merge( self::$list, $wgSpecialPages );
@@
-498,10
+502,13
@@
class SpecialPageFactory {
* @param Title $title
* @param IContextSource $context
* @param bool $including Bool output is being captured for use in {{special:whatever}}
* @param Title $title
* @param IContextSource $context
* @param bool $including Bool output is being captured for use in {{special:whatever}}
+ * @param LinkRenderer|null $linkRenderer (since 1.28)
*
* @return bool
*/
*
* @return bool
*/
- public static function executePath( Title &$title, IContextSource &$context, $including = false ) {
+ public static function executePath( Title &$title, IContextSource &$context, $including = false,
+ LinkRenderer $linkRenderer = null
+ ) {
// @todo FIXME: Redirects broken due to this call
$bits = explode( '/', $title->getDBkey(), 2 );
$name = $bits[0];
// @todo FIXME: Redirects broken due to this call
$bits = explode( '/', $title->getDBkey(), 2 );
$name = $bits[0];
@@
-532,6
+539,7
@@
class SpecialPageFactory {
$trxProfiler = Profiler::instance()->getTransactionProfiler();
if ( $context->getRequest()->wasPosted() && !$page->doesWrites() ) {
$trxProfiler->setExpectations( $trxLimits['POST-nonwrite'], __METHOD__ );
$trxProfiler = Profiler::instance()->getTransactionProfiler();
if ( $context->getRequest()->wasPosted() && !$page->doesWrites() ) {
$trxProfiler->setExpectations( $trxLimits['POST-nonwrite'], __METHOD__ );
+ $context->getRequest()->markAsSafeRequest();
}
}
}
}
@@
-560,6
+568,9
@@
class SpecialPageFactory {
}
$page->including( $including );
}
$page->including( $including );
+ if ( $linkRenderer ) {
+ $page->setLinkRenderer( $linkRenderer );
+ }
// Execute special page
$page->run( $par );
// Execute special page
$page->run( $par );
@@
-579,9
+590,12
@@
class SpecialPageFactory {
*
* @param Title $title
* @param IContextSource $context
*
* @param Title $title
* @param IContextSource $context
+ * @param LinkRenderer|null $linkRenderer (since 1.28)
* @return string HTML fragment
*/
* @return string HTML fragment
*/
- public static function capturePath( Title $title, IContextSource $context ) {
+ public static function capturePath(
+ Title $title, IContextSource $context, LinkRenderer $linkRenderer = null
+ ) {
global $wgTitle, $wgOut, $wgRequest, $wgUser, $wgLang;
$main = RequestContext::getMain();
global $wgTitle, $wgOut, $wgRequest, $wgUser, $wgLang;
$main = RequestContext::getMain();
@@
-614,7
+628,7
@@
class SpecialPageFactory {
$main->setLanguage( $context->getLanguage() );
// The useful part
$main->setLanguage( $context->getLanguage() );
// The useful part
- $ret = self::executePath( $title, $context, true );
+ $ret = self::executePath( $title, $context, true
, $linkRenderer
);
// Restore old globals and context
$wgTitle = $glob['title'];
// Restore old globals and context
$wgTitle = $glob['title'];
@@
-678,6
+692,8
@@
class SpecialPageFactory {
}
if ( $subpage !== false && !is_null( $subpage ) ) {
}
if ( $subpage !== false && !is_null( $subpage ) ) {
+ // Make sure it's in dbkey form
+ $subpage = str_replace( ' ', '_', $subpage );
$name = "$name/$subpage";
}
$name = "$name/$subpage";
}