3 use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface
;
4 use MediaWiki\Linker\LinkTarget
;
5 use Wikimedia\Assert\Assert
;
8 * Storage layer class for WatchedItems.
9 * Database interaction.
15 class WatchedItemStore
implements StatsdAwareInterface
{
17 const SORT_DESC
= 'DESC';
18 const SORT_ASC
= 'ASC';
23 private $loadBalancer;
31 * @var array[] Looks like $cacheIndex[Namespace ID][Target DB Key][User Id] => 'key'
32 * The index is needed so that on mass changes all relevant items can be un-cached.
33 * For example: Clearing a users watchlist of all items or updating notification timestamps
34 * for all users watching a single target.
36 private $cacheIndex = [];
41 private $deferredUpdatesAddCallableUpdateCallback;
46 private $revisionGetTimestampFromIdCallback;
49 * @var StatsdDataFactoryInterface
54 * @param LoadBalancer $loadBalancer
55 * @param HashBagOStuff $cache
57 public function __construct(
58 LoadBalancer
$loadBalancer,
61 $this->loadBalancer
= $loadBalancer;
62 $this->cache
= $cache;
63 $this->stats
= new NullStatsdDataFactory();
64 $this->deferredUpdatesAddCallableUpdateCallback
= [ 'DeferredUpdates', 'addCallableUpdate' ];
65 $this->revisionGetTimestampFromIdCallback
= [ 'Revision', 'getTimestampFromId' ];
68 public function setStatsdDataFactory( StatsdDataFactoryInterface
$stats ) {
69 $this->stats
= $stats;
73 * Overrides the DeferredUpdates::addCallableUpdate callback
74 * This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined.
76 * @param callable $callback
78 * @see DeferredUpdates::addCallableUpdate for callback signiture
80 * @return ScopedCallback to reset the overridden value
83 public function overrideDeferredUpdatesAddCallableUpdateCallback( callable
$callback ) {
84 if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
85 throw new MWException(
86 'Cannot override DeferredUpdates::addCallableUpdate callback in operation.'
89 $previousValue = $this->deferredUpdatesAddCallableUpdateCallback
;
90 $this->deferredUpdatesAddCallableUpdateCallback
= $callback;
91 return new ScopedCallback( function() use ( $previousValue ) {
92 $this->deferredUpdatesAddCallableUpdateCallback
= $previousValue;
97 * Overrides the Revision::getTimestampFromId callback
98 * This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined.
100 * @param callable $callback
101 * @see Revision::getTimestampFromId for callback signiture
103 * @return ScopedCallback to reset the overridden value
104 * @throws MWException
106 public function overrideRevisionGetTimestampFromIdCallback( callable
$callback ) {
107 if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
108 throw new MWException(
109 'Cannot override Revision::getTimestampFromId callback in operation.'
112 $previousValue = $this->revisionGetTimestampFromIdCallback
;
113 $this->revisionGetTimestampFromIdCallback
= $callback;
114 return new ScopedCallback( function() use ( $previousValue ) {
115 $this->revisionGetTimestampFromIdCallback
= $previousValue;
119 private function getCacheKey( User
$user, LinkTarget
$target ) {
120 return $this->cache
->makeKey(
121 (string)$target->getNamespace(),
123 (string)$user->getId()
127 private function cache( WatchedItem
$item ) {
128 $user = $item->getUser();
129 $target = $item->getLinkTarget();
130 $key = $this->getCacheKey( $user, $target );
131 $this->cache
->set( $key, $item );
132 $this->cacheIndex
[$target->getNamespace()][$target->getDBkey()][$user->getId()] = $key;
133 $this->stats
->increment( 'WatchedItemStore.cache' );
136 private function uncache( User
$user, LinkTarget
$target ) {
137 $this->cache
->delete( $this->getCacheKey( $user, $target ) );
138 unset( $this->cacheIndex
[$target->getNamespace()][$target->getDBkey()][$user->getId()] );
139 $this->stats
->increment( 'WatchedItemStore.uncache' );
142 private function uncacheLinkTarget( LinkTarget
$target ) {
143 $this->stats
->increment( 'WatchedItemStore.uncacheLinkTarget' );
144 if ( !isset( $this->cacheIndex
[$target->getNamespace()][$target->getDBkey()] ) ) {
147 foreach ( $this->cacheIndex
[$target->getNamespace()][$target->getDBkey()] as $key ) {
148 $this->stats
->increment( 'WatchedItemStore.uncacheLinkTarget.items' );
149 $this->cache
->delete( $key );
153 private function uncacheUser( User
$user ) {
154 $this->stats
->increment( 'WatchedItemStore.uncacheUser' );
155 foreach ( $this->cacheIndex
as $ns => $dbKeyArray ) {
156 foreach ( $dbKeyArray as $dbKey => $userArray ) {
157 if ( isset( $userArray[$user->getId()] ) ) {
158 $this->stats
->increment( 'WatchedItemStore.uncacheUser.items' );
159 $this->cache
->delete( $userArray[$user->getId()] );
167 * @param LinkTarget $target
169 * @return WatchedItem|null
171 private function getCached( User
$user, LinkTarget
$target ) {
172 return $this->cache
->get( $this->getCacheKey( $user, $target ) );
176 * Return an array of conditions to select or update the appropriate database
180 * @param LinkTarget $target
184 private function dbCond( User
$user, LinkTarget
$target ) {
186 'wl_user' => $user->getId(),
187 'wl_namespace' => $target->getNamespace(),
188 'wl_title' => $target->getDBkey(),
193 * @param int $dbIndex DB_MASTER or DB_REPLICA
196 * @throws MWException
198 private function getConnectionRef( $dbIndex ) {
199 return $this->loadBalancer
->getConnectionRef( $dbIndex, [ 'watchlist' ] );
203 * Count the number of individual items that are watched by the user.
204 * If a subject and corresponding talk page are watched this will return 2.
210 public function countWatchedItems( User
$user ) {
211 $dbr = $this->getConnectionRef( DB_REPLICA
);
212 $return = (int)$dbr->selectField(
216 'wl_user' => $user->getId()
225 * @param LinkTarget $target
229 public function countWatchers( LinkTarget
$target ) {
230 $dbr = $this->getConnectionRef( DB_REPLICA
);
231 $return = (int)$dbr->selectField(
235 'wl_namespace' => $target->getNamespace(),
236 'wl_title' => $target->getDBkey(),
245 * Number of page watchers who also visited a "recent" edit
247 * @param LinkTarget $target
248 * @param mixed $threshold timestamp accepted by wfTimestamp
251 * @throws DBUnexpectedError
252 * @throws MWException
254 public function countVisitingWatchers( LinkTarget
$target, $threshold ) {
255 $dbr = $this->getConnectionRef( DB_REPLICA
);
256 $visitingWatchers = (int)$dbr->selectField(
260 'wl_namespace' => $target->getNamespace(),
261 'wl_title' => $target->getDBkey(),
262 'wl_notificationtimestamp >= ' .
263 $dbr->addQuotes( $dbr->timestamp( $threshold ) ) .
264 ' OR wl_notificationtimestamp IS NULL'
269 return $visitingWatchers;
273 * @param LinkTarget[] $targets
274 * @param array $options Allowed keys:
275 * 'minimumWatchers' => int
277 * @return array multi dimensional like $return[$namespaceId][$titleString] = int $watchers
278 * All targets will be present in the result. 0 either means no watchers or the number
279 * of watchers was below the minimumWatchers option if passed.
281 public function countWatchersMultiple( array $targets, array $options = [] ) {
282 $dbOptions = [ 'GROUP BY' => [ 'wl_namespace', 'wl_title' ] ];
284 $dbr = $this->getConnectionRef( DB_REPLICA
);
286 if ( array_key_exists( 'minimumWatchers', $options ) ) {
287 $dbOptions['HAVING'] = 'COUNT(*) >= ' . (int)$options['minimumWatchers'];
290 $lb = new LinkBatch( $targets );
293 [ 'wl_title', 'wl_namespace', 'watchers' => 'COUNT(*)' ],
294 [ $lb->constructSet( 'wl', $dbr ) ],
300 foreach ( $targets as $linkTarget ) {
301 $watchCounts[$linkTarget->getNamespace()][$linkTarget->getDBkey()] = 0;
304 foreach ( $res as $row ) {
305 $watchCounts[$row->wl_namespace
][$row->wl_title
] = (int)$row->watchers
;
312 * Number of watchers of each page who have visited recent edits to that page
314 * @param array $targetsWithVisitThresholds array of pairs (LinkTarget $target, mixed $threshold),
316 * - a timestamp of the recent edit if $target exists (format accepted by wfTimestamp)
317 * - null if $target doesn't exist
318 * @param int|null $minimumWatchers
319 * @return array multi-dimensional like $return[$namespaceId][$titleString] = $watchers,
320 * where $watchers is an int:
321 * - if the page exists, number of users watching who have visited the page recently
322 * - if the page doesn't exist, number of users that have the page on their watchlist
323 * - 0 means there are no visiting watchers or their number is below the minimumWatchers
324 * option (if passed).
326 public function countVisitingWatchersMultiple(
327 array $targetsWithVisitThresholds,
328 $minimumWatchers = null
330 $dbr = $this->getConnectionRef( DB_REPLICA
);
332 $conds = $this->getVisitingWatchersCondition( $dbr, $targetsWithVisitThresholds );
334 $dbOptions = [ 'GROUP BY' => [ 'wl_namespace', 'wl_title' ] ];
335 if ( $minimumWatchers !== null ) {
336 $dbOptions['HAVING'] = 'COUNT(*) >= ' . (int)$minimumWatchers;
340 [ 'wl_namespace', 'wl_title', 'watchers' => 'COUNT(*)' ],
347 foreach ( $targetsWithVisitThresholds as list( $target ) ) {
348 /* @var LinkTarget $target */
349 $watcherCounts[$target->getNamespace()][$target->getDBkey()] = 0;
352 foreach ( $res as $row ) {
353 $watcherCounts[$row->wl_namespace
][$row->wl_title
] = (int)$row->watchers
;
356 return $watcherCounts;
360 * Generates condition for the query used in a batch count visiting watchers.
362 * @param IDatabase $db
363 * @param array $targetsWithVisitThresholds array of pairs (LinkTarget, last visit threshold)
366 private function getVisitingWatchersCondition(
368 array $targetsWithVisitThresholds
370 $missingTargets = [];
371 $namespaceConds = [];
372 foreach ( $targetsWithVisitThresholds as list( $target, $threshold ) ) {
373 if ( $threshold === null ) {
374 $missingTargets[] = $target;
377 /* @var LinkTarget $target */
378 $namespaceConds[$target->getNamespace()][] = $db->makeList( [
379 'wl_title = ' . $db->addQuotes( $target->getDBkey() ),
381 'wl_notificationtimestamp >= ' . $db->addQuotes( $db->timestamp( $threshold ) ),
382 'wl_notificationtimestamp IS NULL'
388 foreach ( $namespaceConds as $namespace => $pageConds ) {
389 $conds[] = $db->makeList( [
390 'wl_namespace = ' . $namespace,
391 '(' . $db->makeList( $pageConds, LIST_OR
) . ')'
395 if ( $missingTargets ) {
396 $lb = new LinkBatch( $missingTargets );
397 $conds[] = $lb->constructSet( 'wl', $db );
400 return $db->makeList( $conds, LIST_OR
);
404 * Get an item (may be cached)
407 * @param LinkTarget $target
409 * @return WatchedItem|false
411 public function getWatchedItem( User
$user, LinkTarget
$target ) {
412 if ( $user->isAnon() ) {
416 $cached = $this->getCached( $user, $target );
418 $this->stats
->increment( 'WatchedItemStore.getWatchedItem.cached' );
421 $this->stats
->increment( 'WatchedItemStore.getWatchedItem.load' );
422 return $this->loadWatchedItem( $user, $target );
426 * Loads an item from the db
429 * @param LinkTarget $target
431 * @return WatchedItem|false
433 public function loadWatchedItem( User
$user, LinkTarget
$target ) {
434 // Only loggedin user can have a watchlist
435 if ( $user->isAnon() ) {
439 $dbr = $this->getConnectionRef( DB_REPLICA
);
440 $row = $dbr->selectRow(
442 'wl_notificationtimestamp',
443 $this->dbCond( $user, $target ),
451 $item = new WatchedItem(
454 $row->wl_notificationtimestamp
456 $this->cache( $item );
463 * @param array $options Allowed keys:
464 * 'forWrite' => bool defaults to false
465 * 'sort' => string optional sorting by namespace ID and title
466 * one of the self::SORT_* constants
468 * @return WatchedItem[]
470 public function getWatchedItemsForUser( User
$user, array $options = [] ) {
471 $options +
= [ 'forWrite' => false ];
474 if ( array_key_exists( 'sort', $options ) ) {
476 ( in_array( $options['sort'], [ self
::SORT_ASC
, self
::SORT_DESC
] ) ),
477 '$options[\'sort\']',
478 'must be SORT_ASC or SORT_DESC'
480 $dbOptions['ORDER BY'] = [
481 "wl_namespace {$options['sort']}",
482 "wl_title {$options['sort']}"
485 $db = $this->getConnectionRef( $options['forWrite'] ? DB_MASTER
: DB_REPLICA
);
489 [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
490 [ 'wl_user' => $user->getId() ],
496 foreach ( $res as $row ) {
497 // todo these could all be cached at some point?
498 $watchedItems[] = new WatchedItem(
500 new TitleValue( (int)$row->wl_namespace
, $row->wl_title
),
501 $row->wl_notificationtimestamp
505 return $watchedItems;
509 * Must be called separately for Subject & Talk namespaces
512 * @param LinkTarget $target
516 public function isWatched( User
$user, LinkTarget
$target ) {
517 return (bool)$this->getWatchedItem( $user, $target );
522 * @param LinkTarget[] $targets
524 * @return array multi-dimensional like $return[$namespaceId][$titleString] = $timestamp,
525 * where $timestamp is:
526 * - string|null value of wl_notificationtimestamp,
527 * - false if $target is not watched by $user.
529 public function getNotificationTimestampsBatch( User
$user, array $targets ) {
531 foreach ( $targets as $target ) {
532 $timestamps[$target->getNamespace()][$target->getDBkey()] = false;
535 if ( $user->isAnon() ) {
540 foreach ( $targets as $target ) {
541 $cachedItem = $this->getCached( $user, $target );
543 $timestamps[$target->getNamespace()][$target->getDBkey()] =
544 $cachedItem->getNotificationTimestamp();
546 $targetsToLoad[] = $target;
550 if ( !$targetsToLoad ) {
554 $dbr = $this->getConnectionRef( DB_REPLICA
);
556 $lb = new LinkBatch( $targetsToLoad );
559 [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
561 $lb->constructSet( 'wl', $dbr ),
562 'wl_user' => $user->getId(),
567 foreach ( $res as $row ) {
568 $timestamps[$row->wl_namespace
][$row->wl_title
] = $row->wl_notificationtimestamp
;
575 * Must be called separately for Subject & Talk namespaces
578 * @param LinkTarget $target
580 public function addWatch( User
$user, LinkTarget
$target ) {
581 $this->addWatchBatchForUser( $user, [ $target ] );
586 * @param LinkTarget[] $targets
588 * @return bool success
590 public function addWatchBatchForUser( User
$user, array $targets ) {
591 if ( $this->loadBalancer
->getReadOnlyReason() !== false ) {
594 // Only loggedin user can have a watchlist
595 if ( $user->isAnon() ) {
604 foreach ( $targets as $target ) {
606 'wl_user' => $user->getId(),
607 'wl_namespace' => $target->getNamespace(),
608 'wl_title' => $target->getDBkey(),
609 'wl_notificationtimestamp' => null,
611 $this->uncache( $user, $target );
614 $dbw = $this->getConnectionRef( DB_MASTER
);
615 foreach ( array_chunk( $rows, 100 ) as $toInsert ) {
616 // Use INSERT IGNORE to avoid overwriting the notification timestamp
617 // if there's already an entry for this page
618 $dbw->insert( 'watchlist', $toInsert, __METHOD__
, 'IGNORE' );
625 * Removes the an entry for the User watching the LinkTarget
626 * Must be called separately for Subject & Talk namespaces
629 * @param LinkTarget $target
631 * @return bool success
632 * @throws DBUnexpectedError
633 * @throws MWException
635 public function removeWatch( User
$user, LinkTarget
$target ) {
636 // Only logged in user can have a watchlist
637 if ( $this->loadBalancer
->getReadOnlyReason() !== false ||
$user->isAnon() ) {
641 $this->uncache( $user, $target );
643 $dbw = $this->getConnectionRef( DB_MASTER
);
644 $dbw->delete( 'watchlist',
646 'wl_user' => $user->getId(),
647 'wl_namespace' => $target->getNamespace(),
648 'wl_title' => $target->getDBkey(),
651 $success = (bool)$dbw->affectedRows();
657 * @param User $user The user to set the timestamp for
658 * @param string $timestamp Set the update timestamp to this value
659 * @param LinkTarget[] $targets List of targets to update. Default to all targets
661 * @return bool success
663 public function setNotificationTimestampsForUser( User
$user, $timestamp, array $targets = [] ) {
664 // Only loggedin user can have a watchlist
665 if ( $user->isAnon() ) {
669 $dbw = $this->getConnectionRef( DB_MASTER
);
671 $conds = [ 'wl_user' => $user->getId() ];
673 $batch = new LinkBatch( $targets );
674 $conds[] = $batch->constructSet( 'wl', $dbw );
677 $success = $dbw->update(
679 [ 'wl_notificationtimestamp' => $dbw->timestamp( $timestamp ) ],
684 $this->uncacheUser( $user );
690 * @param User $editor The editor that triggered the update. Their notification
691 * timestamp will not be updated(they have already seen it)
692 * @param LinkTarget $target The target to update timestamps for
693 * @param string $timestamp Set the update timestamp to this value
695 * @return int[] Array of user IDs the timestamp has been updated for
697 public function updateNotificationTimestamp( User
$editor, LinkTarget
$target, $timestamp ) {
698 $dbw = $this->getConnectionRef( DB_MASTER
);
699 $uids = $dbw->selectFieldValues(
703 'wl_user != ' . intval( $editor->getId() ),
704 'wl_namespace' => $target->getNamespace(),
705 'wl_title' => $target->getDBkey(),
706 'wl_notificationtimestamp IS NULL',
711 $watchers = array_map( 'intval', $uids );
713 // Update wl_notificationtimestamp for all watching users except the editor
715 DeferredUpdates
::addCallableUpdate(
716 function () use ( $timestamp, $watchers, $target, $fname ) {
717 global $wgUpdateRowsPerQuery;
719 $dbw = $this->getConnectionRef( DB_MASTER
);
720 $factory = wfGetLBFactory();
721 $ticket = $factory->getEmptyTransactionTicket( __METHOD__
);
723 $watchersChunks = array_chunk( $watchers, $wgUpdateRowsPerQuery );
724 foreach ( $watchersChunks as $watchersChunk ) {
725 $dbw->update( 'watchlist',
727 'wl_notificationtimestamp' => $dbw->timestamp( $timestamp )
728 ], [ /* WHERE - TODO Use wl_id T130067 */
729 'wl_user' => $watchersChunk,
730 'wl_namespace' => $target->getNamespace(),
731 'wl_title' => $target->getDBkey(),
734 if ( count( $watchersChunks ) > 1 ) {
735 $factory->commitAndWaitForReplication(
736 __METHOD__
, $ticket, [ 'wiki' => $dbw->getWikiID() ]
740 $this->uncacheLinkTarget( $target );
742 DeferredUpdates
::POSTSEND
,
751 * Reset the notification timestamp of this entry
754 * @param Title $title
755 * @param string $force Whether to force the write query to be executed even if the
756 * page is not watched or the notification timestamp is already NULL.
757 * 'force' in order to force
758 * @param int $oldid The revision id being viewed. If not given or 0, latest revision is assumed.
760 * @return bool success
762 public function resetNotificationTimestamp( User
$user, Title
$title, $force = '', $oldid = 0 ) {
763 // Only loggedin user can have a watchlist
764 if ( $this->loadBalancer
->getReadOnlyReason() !== false ||
$user->isAnon() ) {
769 if ( $force != 'force' ) {
770 $item = $this->loadWatchedItem( $user, $title );
771 if ( !$item ||
$item->getNotificationTimestamp() === null ) {
776 // If the page is watched by the user (or may be watched), update the timestamp
777 $job = new ActivityUpdateJob(
780 'type' => 'updateWatchlistNotification',
781 'userid' => $user->getId(),
782 'notifTime' => $this->getNotificationTimestamp( $user, $title, $item, $force, $oldid ),
787 // Try to run this post-send
788 // Calls DeferredUpdates::addCallableUpdate in normal operation
790 $this->deferredUpdatesAddCallableUpdateCallback
,
791 function() use ( $job ) {
796 $this->uncache( $user, $title );
801 private function getNotificationTimestamp( User
$user, Title
$title, $item, $force, $oldid ) {
803 // No oldid given, assuming latest revision; clear the timestamp.
807 if ( !$title->getNextRevisionID( $oldid ) ) {
808 // Oldid given and is the latest revision for this title; clear the timestamp.
812 if ( $item === null ) {
813 $item = $this->loadWatchedItem( $user, $title );
817 // This can only happen if $force is enabled.
821 // Oldid given and isn't the latest; update the timestamp.
822 // This will result in no further notification emails being sent!
823 // Calls Revision::getTimestampFromId in normal operation
824 $notificationTimestamp = call_user_func(
825 $this->revisionGetTimestampFromIdCallback
,
830 // We need to go one second to the future because of various strict comparisons
831 // throughout the codebase
832 $ts = new MWTimestamp( $notificationTimestamp );
833 $ts->timestamp
->add( new DateInterval( 'PT1S' ) );
834 $notificationTimestamp = $ts->getTimestamp( TS_MW
);
836 if ( $notificationTimestamp < $item->getNotificationTimestamp() ) {
837 if ( $force != 'force' ) {
840 // This is a little silly…
841 return $item->getNotificationTimestamp();
845 return $notificationTimestamp;
850 * @param int $unreadLimit
852 * @return int|bool The number of unread notifications
853 * true if greater than or equal to $unreadLimit
855 public function countUnreadNotifications( User
$user, $unreadLimit = null ) {
857 if ( $unreadLimit !== null ) {
858 $unreadLimit = (int)$unreadLimit;
859 $queryOptions['LIMIT'] = $unreadLimit;
862 $dbr = $this->getConnectionRef( DB_REPLICA
);
863 $rowCount = $dbr->selectRowCount(
867 'wl_user' => $user->getId(),
868 'wl_notificationtimestamp IS NOT NULL',
874 if ( !isset( $unreadLimit ) ) {
878 if ( $rowCount >= $unreadLimit ) {
886 * Check if the given title already is watched by the user, and if so
887 * add a watch for the new title.
889 * To be used for page renames and such.
891 * @param LinkTarget $oldTarget
892 * @param LinkTarget $newTarget
894 public function duplicateAllAssociatedEntries( LinkTarget
$oldTarget, LinkTarget
$newTarget ) {
895 $oldTarget = Title
::newFromLinkTarget( $oldTarget );
896 $newTarget = Title
::newFromLinkTarget( $newTarget );
898 $this->duplicateEntry( $oldTarget->getSubjectPage(), $newTarget->getSubjectPage() );
899 $this->duplicateEntry( $oldTarget->getTalkPage(), $newTarget->getTalkPage() );
903 * Check if the given title already is watched by the user, and if so
904 * add a watch for the new title.
906 * To be used for page renames and such.
907 * This must be called separately for Subject and Talk pages
909 * @param LinkTarget $oldTarget
910 * @param LinkTarget $newTarget
912 public function duplicateEntry( LinkTarget
$oldTarget, LinkTarget
$newTarget ) {
913 $dbw = $this->getConnectionRef( DB_MASTER
);
915 $result = $dbw->select(
917 [ 'wl_user', 'wl_notificationtimestamp' ],
919 'wl_namespace' => $oldTarget->getNamespace(),
920 'wl_title' => $oldTarget->getDBkey(),
926 $newNamespace = $newTarget->getNamespace();
927 $newDBkey = $newTarget->getDBkey();
929 # Construct array to replace into the watchlist
931 foreach ( $result as $row ) {
933 'wl_user' => $row->wl_user
,
934 'wl_namespace' => $newNamespace,
935 'wl_title' => $newDBkey,
936 'wl_notificationtimestamp' => $row->wl_notificationtimestamp
,
940 if ( !empty( $values ) ) {
942 # Note that multi-row replace is very efficient for MySQL but may be inefficient for
943 # some other DBMSes, mostly due to poor simulation by us
946 [ [ 'wl_user', 'wl_namespace', 'wl_title' ] ],