[MediaWiki-commits] [Gerrit] mediawiki...LoginNotify[master]: Log the heck out of everything

2017-08-23 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373170 )

Change subject: Log the heck out of everything
..


Log the heck out of everything

Bug: T173888
Change-Id: I6cd0a8f953fd823d33bba60df3b9dcfe51d4b4a3
---
M includes/LoginNotify.php
1 file changed, 38 insertions(+), 6 deletions(-)

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



diff --git a/includes/LoginNotify.php b/includes/LoginNotify.php
index 91a1938..df8217a 100644
--- a/includes/LoginNotify.php
+++ b/includes/LoginNotify.php
@@ -134,11 +134,16 @@
 */
private function isKnownSystemFast( User $user, WebRequest $request ) {
$result = $this->userIsInCookie( $user, $request );
-   if ( $result === self::USER_KNOWN ) {
-   return $result;
+
+   if ( $result !== self::USER_KNOWN ) {
+   $result = $this->mergeResults( $result, 
$this->userIsInCache( $user, $request ) );
}
 
-   $result = $this->mergeResults( $result, $this->userIsInCache( 
$user, $request ) );
+   $this->log->debug( 'Checking cookies and cache for {user}: 
{result}', [
+   'function' => __METHOD__,
+   'user' => $user->getName(),
+   'result' => $result,
+   ] );
 
return $result;
}
@@ -408,6 +413,13 @@
public function setCurrentAddressAsKnown( User $user ) {
$this->cacheLoginIP( $user );
$this->setLoginCookie( $user );
+
+   $this->log->debug( 'Recording user {user} as known',
+   [
+   'function' => __METHOD__,
+   'user' => $user->getName(),
+   ]
+   );
}
 
/**
@@ -456,10 +468,13 @@
 
// FIXME, does this really make sense?
if ( $cookie === '' ) {
-   return self::USER_NO_INFO;
+   $result = self::USER_NO_INFO;
+   } else {
+   list( $userKnown, ) = $this->checkAndGenerateCookie( 
$user, $cookie );
+   $result = $userKnown ? self::USER_KNOWN : 
self::USER_NOT_KNOWN;
}
-   list( $userKnown, ) = $this->checkAndGenerateCookie( $user, 
$cookie );
-   return $userKnown ? self::USER_KNOWN : self::USER_NOT_KNOWN;
+
+   return $result;
}
 
/**
@@ -665,6 +680,14 @@
'extra' => $extra,
'agent' => $user,
] );
+
+   $this->log->info( 'Sending a {type} notification to {user}',
+   [
+   'function' => __METHOD__,
+   'type' => $type,
+   'user' => $user->getName(),
+   ]
+   );
}
 
/**
@@ -788,6 +811,15 @@
]
);
JobQueueGroup::singleton()->lazyPush( $job );
+
+   $this->log->debug( 'Login {status}, creating a job to verify 
{user}, result so far: {result}',
+   [
+   'function' => __METHOD__,
+   'status' => $type,
+   'user' => $user->getName(),
+   'result' => $resultSoFar,
+   ]
+   );
}
 
/**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6cd0a8f953fd823d33bba60df3b9dcfe51d4b4a3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LoginNotify
Gerrit-Branch: master
Gerrit-Owner: MaxSem 
Gerrit-Reviewer: Niharika29 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...LoginNotify[master]: Log the heck out of everything

2017-08-22 Thread MaxSem (Code Review)
MaxSem has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/373170 )

Change subject: Log the heck out of everything
..

Log the heck out of everything

Bug: T173888
Change-Id: I6cd0a8f953fd823d33bba60df3b9dcfe51d4b4a3
---
M includes/LoginNotify.php
1 file changed, 38 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LoginNotify 
refs/changes/70/373170/1

diff --git a/includes/LoginNotify.php b/includes/LoginNotify.php
index 91a1938..df8217a 100644
--- a/includes/LoginNotify.php
+++ b/includes/LoginNotify.php
@@ -134,11 +134,16 @@
 */
private function isKnownSystemFast( User $user, WebRequest $request ) {
$result = $this->userIsInCookie( $user, $request );
-   if ( $result === self::USER_KNOWN ) {
-   return $result;
+
+   if ( $result !== self::USER_KNOWN ) {
+   $result = $this->mergeResults( $result, 
$this->userIsInCache( $user, $request ) );
}
 
-   $result = $this->mergeResults( $result, $this->userIsInCache( 
$user, $request ) );
+   $this->log->debug( 'Checking cookies and cache for {user}: 
{result}', [
+   'function' => __METHOD__,
+   'user' => $user->getName(),
+   'result' => $result,
+   ] );
 
return $result;
}
@@ -408,6 +413,13 @@
public function setCurrentAddressAsKnown( User $user ) {
$this->cacheLoginIP( $user );
$this->setLoginCookie( $user );
+
+   $this->log->debug( 'Recording user {user} as known',
+   [
+   'function' => __METHOD__,
+   'user' => $user->getName(),
+   ]
+   );
}
 
/**
@@ -456,10 +468,13 @@
 
// FIXME, does this really make sense?
if ( $cookie === '' ) {
-   return self::USER_NO_INFO;
+   $result = self::USER_NO_INFO;
+   } else {
+   list( $userKnown, ) = $this->checkAndGenerateCookie( 
$user, $cookie );
+   $result = $userKnown ? self::USER_KNOWN : 
self::USER_NOT_KNOWN;
}
-   list( $userKnown, ) = $this->checkAndGenerateCookie( $user, 
$cookie );
-   return $userKnown ? self::USER_KNOWN : self::USER_NOT_KNOWN;
+
+   return $result;
}
 
/**
@@ -665,6 +680,14 @@
'extra' => $extra,
'agent' => $user,
] );
+
+   $this->log->info( 'Sending a {type} notification to {user}',
+   [
+   'function' => __METHOD__,
+   'type' => $type,
+   'user' => $user->getName(),
+   ]
+   );
}
 
/**
@@ -788,6 +811,15 @@
]
);
JobQueueGroup::singleton()->lazyPush( $job );
+
+   $this->log->debug( 'Login {status}, creating a job to verify 
{user}, result so far: {result}',
+   [
+   'function' => __METHOD__,
+   'status' => $type,
+   'user' => $user->getName(),
+   'result' => $resultSoFar,
+   ]
+   );
}
 
/**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6cd0a8f953fd823d33bba60df3b9dcfe51d4b4a3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LoginNotify
Gerrit-Branch: master
Gerrit-Owner: MaxSem 

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