* @ingroup SpecialPage
* @defgroup SpecialPage SpecialPage
*/
+use MediaWiki\Linker\LinkRenderer;
/**
* Factory for handling the special page list and generating SpecialPage objects.
'PagesWithProp' => 'SpecialPagesWithProp',
'TrackingCategories' => 'SpecialTrackingCategories',
- // Login/create account
- 'Userlogin' => 'LoginForm',
- 'CreateAccount' => 'SpecialCreateAccount',
+ // Authentication
+ 'Userlogin' => 'SpecialUserLogin',
+ 'Userlogout' => 'SpecialUserlogoutPreAuthManager',
+ 'CreateAccount' => 'SpecialCreateAccountPreAuthManager',
+ 'LinkAccounts' => 'SpecialLinkAccounts',
+ 'UnlinkAccounts' => 'SpecialUnlinkAccounts',
+ 'ChangeCredentials' => 'SpecialChangeCredentials',
+ 'RemoveCredentials' => 'SpecialRemoveCredentials',
// Users and rights
'Activeusers' => 'SpecialActiveUsers',
'Block' => 'SpecialBlock',
'Unblock' => 'SpecialUnblock',
'BlockList' => 'SpecialBlockList',
- 'ChangePassword' => 'SpecialChangePassword',
+ 'ChangePassword' => 'SpecialChangePasswordPreAuthManager',
'BotPasswords' => 'SpecialBotPasswords',
- 'PasswordReset' => 'SpecialPasswordReset',
+ 'PasswordReset' => 'SpecialPasswordResetPreAuthManager',
'DeletedContributions' => 'DeletedContributionsPage',
'Preferences' => 'SpecialPreferences',
'ResetTokens' => 'SpecialResetTokens',
'Revisiondelete' => 'SpecialRevisionDelete',
'RunJobs' => 'SpecialRunJobs',
'Specialpages' => 'SpecialSpecialpages',
- 'Userlogout' => 'SpecialUserlogout',
];
private static $list;
global $wgDisableInternalSearch, $wgEmailAuthentication;
global $wgEnableEmail, $wgEnableJavaScriptTest;
global $wgPageLanguageUseDB, $wgContentHandlerUseDB;
+ global $wgDisableAuthManager;
if ( !is_array( self::$list ) ) {
}
if ( $wgEnableEmail ) {
- self::$list['ChangeEmail'] = 'SpecialChangeEmail';
+ self::$list['ChangeEmail'] = 'SpecialChangeEmailPreAuthManager';
}
if ( $wgEnableJavaScriptTest ) {
self::$list['ChangeContentModel'] = 'SpecialChangeContentModel';
}
+ // horrible hack to allow selection between old and new classes via a feature flag - T110756
+ // will be removed once AuthManager is stable
+ if ( !$wgDisableAuthManager ) {
+ self::$list = array_map( function ( $class ) {
+ return preg_replace( '/PreAuthManager$/', '', $class );
+ }, self::$list );
+ self::$list['Userlogout'] = 'SpecialUserLogout'; // case matters
+ } else {
+ self::$list['Userlogin'] = 'LoginForm';
+ self::$list = array_diff_key( self::$list, array_fill_keys( [
+ 'LinkAccounts', 'UnlinkAccounts', 'ChangeCredentials', 'RemoveCredentials',
+ ], true ) );
+ }
+
// Add extension special pages
self::$list = array_merge( self::$list, $wgSpecialPages );
* @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
*/
- 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];
}
$page->including( $including );
+ if ( $linkRenderer ) {
+ $page->setLinkRenderer( $linkRenderer );
+ }
// Execute special page
$page->run( $par );
*
* @param Title $title
* @param IContextSource $context
+ * @param LinkRenderer|null $linkRenderer (since 1.28)
* @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();
$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'];