54 public function run() {
56 $dbProvider = $services->getConnectionProvider();
59 $dbw = $dbProvider->getPrimaryDatabase();
60 $ticket = $dbProvider->getEmptyTransactionTicket( __METHOD__ );
61 if ( !isset( $this->params[
'timestamp'] ) ) {
63 $timestampCond = $dbw->expr(
'wl_notificationtimestamp',
'!=',
null );
65 $timestamp = $dbw->timestamp( $this->params[
'timestamp'] );
66 $timestampCond = $dbw->expr(
'wl_notificationtimestamp',
'!=', $timestamp )
67 ->or(
'wl_notificationtimestamp',
'=',
null );
70 $casTimeCond = $dbw->expr(
'wl_notificationtimestamp',
'<', $dbw->timestamp( $this->params[
'casTime'] ) )
71 ->or(
'wl_notificationtimestamp',
'=',
null );
75 $idsToUpdate = $dbw->newSelectQueryBuilder()
78 ->where( [
'wl_user' => $this->params[
'userId'] ] )
79 ->andWhere( $timestampCond )
80 ->andWhere( $casTimeCond )
81 ->limit( $rowsPerQuery )
82 ->caller( __METHOD__ )->fetchFieldValues();
85 $dbw->newUpdateQueryBuilder()
86 ->update(
'watchlist' )
87 ->set( [
'wl_notificationtimestamp' => $timestamp ] )
88 ->where( [
'wl_id' => $idsToUpdate ] )
89 ->andWhere( $casTimeCond )
90 ->caller( __METHOD__ )->execute();
92 $dbProvider->commitAndWaitForReplication( __METHOD__, $ticket );
96 }
while ( $idsToUpdate );