41 public function run() {
43 $dbProvider = $services->getConnectionProvider();
46 $dbw = $dbProvider->getPrimaryDatabase();
47 $ticket = $dbProvider->getEmptyTransactionTicket( __METHOD__ );
48 if ( !isset( $this->params[
'timestamp'] ) ) {
50 $timestampCond = $dbw->expr(
'wl_notificationtimestamp',
'!=',
null );
52 $timestamp = $dbw->timestamp( $this->params[
'timestamp'] );
53 $timestampCond = $dbw->expr(
'wl_notificationtimestamp',
'!=', $timestamp )
54 ->or(
'wl_notificationtimestamp',
'=',
null );
57 $casTimeCond = $dbw->expr(
'wl_notificationtimestamp',
'<', $dbw->timestamp( $this->params[
'casTime'] ) )
58 ->or(
'wl_notificationtimestamp',
'=',
null );
62 $idsToUpdate = $dbw->newSelectQueryBuilder()
65 ->where( [
'wl_user' => $this->params[
'userId'] ] )
66 ->andWhere( $timestampCond )
67 ->andWhere( $casTimeCond )
68 ->limit( $rowsPerQuery )
69 ->caller( __METHOD__ )->fetchFieldValues();
72 $dbw->newUpdateQueryBuilder()
73 ->update(
'watchlist' )
74 ->set( [
'wl_notificationtimestamp' => $timestamp ] )
75 ->where( [
'wl_id' => $idsToUpdate ] )
76 ->andWhere( $casTimeCond )
77 ->caller( __METHOD__ )->execute();
79 $dbProvider->commitAndWaitForReplication( __METHOD__, $ticket );
83 }
while ( $idsToUpdate );