Initialize $success

Followup I85452d0f0afe974d26a575e000f6ae2ceeddf06c

* initialize "$success = true" before using it in
  a loop to keep track of the overall success of
  all batches.

* Add check for readOnly db in markUnRead() and
  markAllRead(), like it was done in markRead()

Bug: T202672
Change-Id: Ifdfa93059268d5b02ba3e0e885661ce593845791
This commit is contained in:
Stephane Bisson 2018-08-24 06:15:12 -04:00
parent 8bcc8107b0
commit a5ececbb7e

View file

@ -91,7 +91,11 @@ class EchoUserNotificationGateway {
}
$dbw = $this->getDB( DB_MASTER );
if ( $dbw->isReadOnly() ) {
return false;
}
$success = true;
foreach ( array_chunk( $eventIDs, $wgUpdateRowsPerQuery ) as $batch ) {
$success = $dbw->update(
self::$notificationTable,
@ -114,6 +118,9 @@ class EchoUserNotificationGateway {
*/
public function markAllRead() {
$dbw = $this->getDB( DB_MASTER );
if ( $dbw->isReadOnly() ) {
return false;
}
return $dbw->update(
self::$notificationTable,