[MediaWiki-commits] [Gerrit] Do not unauthenticate if autocreation fails due to a race - change (mediawiki/core)

2016-02-23 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Do not unauthenticate if autocreation fails due to a race
..


Do not unauthenticate if autocreation fails due to a race

Bug: T70012
Change-Id: I523ee94744ac943ede78af59ab381b65ae26e672
(cherry-picked from commit c4c501d9bbcf44baf72efe7c0ee343d699fb76fd)
---
M includes/session/SessionManager.php
1 file changed, 15 insertions(+), 6 deletions(-)

Approvals:
  Krinkle: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/session/SessionManager.php 
b/includes/session/SessionManager.php
index 6e4f99c..caa36fa 100644
--- a/includes/session/SessionManager.php
+++ b/includes/session/SessionManager.php
@@ -474,12 +474,21 @@
$status = $user->addToDatabase();
if ( !$status->isOK() ) {
// @codeCoverageIgnoreStart
-   $logger->error( __METHOD__ . ': failed with 
message ' . $status->getWikiText(),
-   array(
-   'username' => $userName,
-   ) );
-   $user->setId( 0 );
-   $user->loadFromId();
+   // double-check for a race condition (T70012)
+   $id = User::idFromName( $user->getName(), 
User::READ_LATEST );
+   if ( $id ) {
+   $logger->info( __METHOD__ . ': tried to 
autocreate existing user',
+   array(
+   'username' => $userName,
+   ) );
+   } else {
+   $logger->error( __METHOD__ . ': failed 
with message ' . $status->getWikiText(),
+   array(
+   'username' => $userName,
+   ) );
+   }
+   $user->setId( $id );
+   $user->loadFromId( User::READ_LATEST );
return false;
// @codeCoverageIgnoreEnd
}

-- 
To view, visit https://gerrit.wikimedia.org/r/272835
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I523ee94744ac943ede78af59ab381b65ae26e672
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.14
Gerrit-Owner: Gergő Tisza 
Gerrit-Reviewer: Anomie 
Gerrit-Reviewer: Krinkle 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Do not unauthenticate if autocreation fails due to a race - change (mediawiki/core)

2016-02-23 Thread Code Review
Gergő Tisza has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/272835

Change subject: Do not unauthenticate if autocreation fails due to a race
..

Do not unauthenticate if autocreation fails due to a race

Bug: T70012
Change-Id: I523ee94744ac943ede78af59ab381b65ae26e672
(cherry-picked from commit c4c501d9bbcf44baf72efe7c0ee343d699fb76fd)
---
M includes/session/SessionManager.php
1 file changed, 15 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/35/272835/1

diff --git a/includes/session/SessionManager.php 
b/includes/session/SessionManager.php
index 6e4f99c..caa36fa 100644
--- a/includes/session/SessionManager.php
+++ b/includes/session/SessionManager.php
@@ -474,12 +474,21 @@
$status = $user->addToDatabase();
if ( !$status->isOK() ) {
// @codeCoverageIgnoreStart
-   $logger->error( __METHOD__ . ': failed with 
message ' . $status->getWikiText(),
-   array(
-   'username' => $userName,
-   ) );
-   $user->setId( 0 );
-   $user->loadFromId();
+   // double-check for a race condition (T70012)
+   $id = User::idFromName( $user->getName(), 
User::READ_LATEST );
+   if ( $id ) {
+   $logger->info( __METHOD__ . ': tried to 
autocreate existing user',
+   array(
+   'username' => $userName,
+   ) );
+   } else {
+   $logger->error( __METHOD__ . ': failed 
with message ' . $status->getWikiText(),
+   array(
+   'username' => $userName,
+   ) );
+   }
+   $user->setId( $id );
+   $user->loadFromId( User::READ_LATEST );
return false;
// @codeCoverageIgnoreEnd
}

-- 
To view, visit https://gerrit.wikimedia.org/r/272835
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I523ee94744ac943ede78af59ab381b65ae26e672
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.14
Gerrit-Owner: Gergő Tisza 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Do not unauthenticate if autocreation fails due to a race - change (mediawiki/core)

2016-02-18 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Do not unauthenticate if autocreation fails due to a race
..


Do not unauthenticate if autocreation fails due to a race

Bug: T70012
Change-Id: I523ee94744ac943ede78af59ab381b65ae26e672
---
M includes/session/SessionManager.php
1 file changed, 15 insertions(+), 6 deletions(-)

Approvals:
  Anomie: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/session/SessionManager.php 
b/includes/session/SessionManager.php
index 5573ec7..e7a5e2e 100644
--- a/includes/session/SessionManager.php
+++ b/includes/session/SessionManager.php
@@ -475,12 +475,21 @@
$status = $user->addToDatabase();
if ( !$status->isOK() ) {
// @codeCoverageIgnoreStart
-   $logger->error( __METHOD__ . ': failed with 
message ' . $status->getWikiText(),
-   [
-   'username' => $userName,
-   ] );
-   $user->setId( 0 );
-   $user->loadFromId();
+   // double-check for a race condition (T70012)
+   $id = User::idFromName( $user->getName(), 
User::READ_LATEST );
+   if ( $id ) {
+   $logger->info( __METHOD__ . ': tried to 
autocreate existing user',
+   [
+   'username' => $userName,
+   ] );
+   } else {
+   $logger->error( __METHOD__ . ': failed 
with message ' . $status->getWikiText(),
+   [
+   'username' => $userName,
+   ] );
+   }
+   $user->setId( $id );
+   $user->loadFromId( User::READ_LATEST );
return false;
// @codeCoverageIgnoreEnd
}

-- 
To view, visit https://gerrit.wikimedia.org/r/271460
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I523ee94744ac943ede78af59ab381b65ae26e672
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza 
Gerrit-Reviewer: Anomie 
Gerrit-Reviewer: Gergő Tisza 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Do not unauthenticate if autocreation fails due to a race - change (mediawiki/core)

2016-02-17 Thread Code Review
Gergő Tisza has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/271460

Change subject: Do not unauthenticate if autocreation fails due to a race
..

Do not unauthenticate if autocreation fails due to a race

Bug: T70012
Change-Id: I523ee94744ac943ede78af59ab381b65ae26e672
---
M includes/session/SessionManager.php
1 file changed, 15 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/60/271460/1

diff --git a/includes/session/SessionManager.php 
b/includes/session/SessionManager.php
index d3b7a2d..7d41ba4 100644
--- a/includes/session/SessionManager.php
+++ b/includes/session/SessionManager.php
@@ -475,12 +475,21 @@
$status = $user->addToDatabase();
if ( !$status->isOK() ) {
// @codeCoverageIgnoreStart
-   $logger->error( __METHOD__ . ': failed with 
message ' . $status->getWikiText(),
-   array(
-   'username' => $userName,
-   ) );
-   $user->setId( 0 );
-   $user->loadFromId();
+   // double-check for a race condition (T70012)
+   $id = User::idFromName( $user->getName(), 
User::READ_LATEST );
+   if ( $id ) {
+   $logger->info( __METHOD__ . ': tried to 
autocreate existing user',
+   array(
+   'username' => $userName,
+   ) );
+   } else {
+   $logger->error( __METHOD__ . ': failed 
with message ' . $status->getWikiText(),
+   array(
+   'username' => $userName,
+   ) );
+   }
+   $user->setId( $id );
+   $user->loadFromId( User::READ_LATEST );
return false;
// @codeCoverageIgnoreEnd
}

-- 
To view, visit https://gerrit.wikimedia.org/r/271460
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I523ee94744ac943ede78af59ab381b65ae26e672
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits