Use WIS::getNotificationTimestampsBatch in ApiSetNotifTimestamp
authoraddshore <addshorewiki@gmail.com>
Fri, 6 May 2016 09:25:37 +0000 (10:25 +0100)
committeraddshore <addshorewiki@gmail.com>
Wed, 18 May 2016 11:09:29 +0000 (12:09 +0100)
Bug: T134387
Change-Id: I560ae6a29fa27c1e4f1f62aa647e14542b0cc8a9

includes/api/ApiSetNotificationTimestamp.php

index a299e87..f335682 100644 (file)
@@ -142,17 +142,10 @@ class ApiSetNotificationTimestamp extends ApiBase {
                                );
 
                                // Query the results of our update
-                               $timestamps = [];
-                               $lb = new LinkBatch( $pageSet->getTitles() );
-                               $res = $dbw->select(
-                                       'watchlist',
-                                       [ 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ],
-                                       [ 'wl_user' => $user->getId(), $lb->constructSet( 'wl', $dbw ) ],
-                                       __METHOD__
+                               $timestamps = $watchedItemStore->getNotificationTimestampsBatch(
+                                       $user,
+                                       $pageSet->getTitles()
                                );
-                               foreach ( $res as $row ) {
-                                       $timestamps[$row->wl_namespace][$row->wl_title] = $row->wl_notificationtimestamp;
-                               }
 
                                // Now, put the valid titles into the result
                                /** @var $title Title */