Merge "Show protection log on creation-protected pages"
[lhc/web/wiklou.git] / includes / specialpage / LoginSignupSpecialPage.php
index 5c048a2..9d6fd5b 100644 (file)
@@ -26,7 +26,9 @@ use MediaWiki\Auth\AuthenticationResponse;
 use MediaWiki\Auth\AuthManager;
 use MediaWiki\Auth\Throttler;
 use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
 use MediaWiki\Session\SessionManager;
+use Wikimedia\ScopedCallback;
 
 /**
  * Holds shared logic for login and account creation pages.
@@ -212,6 +214,15 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
         * @param string|null $subPage
         */
        public function execute( $subPage ) {
+               if ( $this->mPosted ) {
+                       $time = microtime( true );
+                       $profilingScope = new ScopedCallback( function () use ( $time ) {
+                               $time = microtime( true ) - $time;
+                               $statsd = MediaWikiServices::getInstance()->getStatsdDataFactory();
+                               $statsd->timing( "timing.login.ui.{$this->authAction}", $time * 1000 );
+                       } );
+               }
+
                $authManager = AuthManager::singleton();
                $session = SessionManager::getGlobalSession();
 
@@ -761,7 +772,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
                if ( $this->showCreateAccountLink() ) {
                        # Pass any language selection on to the mode switch link
                        if ( $this->mLanguage ) {
-                               $linkq .= '&uselang=' . $this->mLanguage;
+                               $linkq .= '&uselang=' . urlencode( $this->mLanguage );
                        }
                        // Supply URL, login template creates the button.
                        $template->set( 'createOrLoginHref', $titleObj->getLocalURL( $linkq ) );
@@ -1149,7 +1160,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
                                $linkq = $this->getReturnToQueryStringFragment();
                                // Pass any language selection on to the mode switch link
                                if ( $this->mLanguage ) {
-                                       $linkq .= '&uselang=' . $this->mLanguage;
+                                       $linkq .= '&uselang=' . urlencode( $this->mLanguage );
                                }
                                $loggedIn = $this->getUser()->isLoggedIn();