Florianschmidtwelzow has uploaded a new change for review. https://gerrit.wikimedia.org/r/148051
Change subject: Fixed fatal undefined SpecialGoogleLogin::getHost ...................................................................... Fixed fatal undefined SpecialGoogleLogin::getHost getHost moved to GoogleLogin, isn't a function of SpecialGoogleLogin anymore. Fixed. Added mHost var to GoogleLogin to don't need to run getHost for every call again. Bug: 68316 Change-Id: Iea0f3242efa1460cc884cd5ce18dec2558d359f6 --- M includes/GoogleLogin.body.php M includes/specials/SpecialGoogleLogin.php 2 files changed, 11 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GoogleLogin refs/changes/51/148051/1 diff --git a/includes/GoogleLogin.body.php b/includes/GoogleLogin.body.php index 9ba2a2f..578a9f2 100644 --- a/includes/GoogleLogin.body.php +++ b/includes/GoogleLogin.body.php @@ -8,6 +8,8 @@ private $mGoogleClient; /** @var $mPlusClient Stores an instance of Google Service Plus */ private $mPlusClient; + /** @var $mHost The Host of E-Mail provided by Google */ + private $mHost; /** * Returns an prepared instance of Google client to do requests with to Google API @@ -213,13 +215,17 @@ * @return string The Tld and domain of $domain without subdomains * @see http://www.programmierer-forum.de/domainnamen-ermitteln-t244185.htm */ - private function getHost( $domain = '' ) { + public function getHost( $domain = '' ) { global $wgGLAllowedDomainsStrict; + if ( !empty( $this->mHost ) ) { + return $this->mHost; + } $dir = __DIR__ . "/.."; if ( $wgGLAllowedDomainsStrict ) { $domain = explode( '@', $domain ); // we can trust google to give us only valid email address, so give the last element - return array_pop( $domain ); + $this->mHost = $array_pop( $domain ); + return $this->mHost; } // for parse_url() $domain = @@ -276,7 +282,8 @@ } else { // first level is TLD $domain = $_2nd; } - return $domain; + $this->mHost = $domain; + return $this->mHost; } /** diff --git a/includes/specials/SpecialGoogleLogin.php b/includes/specials/SpecialGoogleLogin.php index 3f0d7b4..e593d3a 100644 --- a/includes/specials/SpecialGoogleLogin.php +++ b/includes/specials/SpecialGoogleLogin.php @@ -151,7 +151,7 @@ } else { $out->addWikiMsg( 'googlelogin-unallowed-domain', - $this->getHost( + $this->mGoogleLogin->getHost( $userInfo['emails'][0]['value'] ) ); -- To view, visit https://gerrit.wikimedia.org/r/148051 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iea0f3242efa1460cc884cd5ce18dec2558d359f6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GoogleLogin Gerrit-Branch: master Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits