dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Convert CREDITS to list of all known git contributors"
[lhc/web/wiklou.git]
/
includes
/
api
/
ApiSetNotificationTimestamp.php
diff --git
a/includes/api/ApiSetNotificationTimestamp.php
b/includes/api/ApiSetNotificationTimestamp.php
index
ea52e14
..
3412f38
100644
(file)
--- a/
includes/api/ApiSetNotificationTimestamp.php
+++ b/
includes/api/ApiSetNotificationTimestamp.php
@@
-24,6
+24,7
@@
*
* @file
*/
*
* @file
*/
+use MediaWiki\MediaWikiServices;
/**
* API interface for setting the wl_notificationtimestamp field
/**
* API interface for setting the wl_notificationtimestamp field
@@
-98,13
+99,14
@@
class ApiSetNotificationTimestamp extends ApiBase {
}
}
}
}
+ $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();
$apiResult = $this->getResult();
$result = [];
if ( $params['entirewatchlist'] ) {
// Entire watchlist mode: Just update the thing and return a success indicator
$apiResult = $this->getResult();
$result = [];
if ( $params['entirewatchlist'] ) {
// Entire watchlist mode: Just update the thing and return a success indicator
- $
dbw->update( 'watchlist', [ 'wl_notificationtimestamp' => $timestamp ],
-
[ 'wl_user' => $user->getId() ]
,
- __METHOD__
+ $
watchedItemStore->setNotificationTimestampsForUser(
+
$user
,
+ $timestamp
);
$result['notificationtimestamp'] = is_null( $timestamp )
);
$result['notificationtimestamp'] = is_null( $timestamp )
@@
-133,23
+135,17
@@
class ApiSetNotificationTimestamp extends ApiBase {
if ( $pageSet->getTitles() ) {
// Now process the valid titles
if ( $pageSet->getTitles() ) {
// Now process the valid titles
- $
lb = new LinkBatch( $pageSet->getTitles() );
-
$dbw->update( 'watchlist', [ 'wl_notificationtimestamp' => $timestamp ]
,
-
[ 'wl_user' => $user->getId(), $lb->constructSet( 'wl', $dbw ) ]
,
- __METHOD__
+ $
watchedItemStore->setNotificationTimestampsForUser(
+
$user
,
+
$timestamp
,
+ $pageSet->getTitles()
);
// Query the results of our update
);
// Query the results of our update
- $timestamps = [];
- $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 */
// Now, put the valid titles into the result
/** @var $title Title */
@@
-162,6
+158,9
@@
class ApiSetNotificationTimestamp extends ApiBase {
];
if ( !$title->exists() ) {
$r['missing'] = true;
];
if ( !$title->exists() ) {
$r['missing'] = true;
+ if ( $title->isKnown() ) {
+ $r['known'] = true;
+ }
}
if ( isset( $timestamps[$ns] ) && array_key_exists( $dbkey, $timestamps[$ns] ) ) {
$r['notificationtimestamp'] = '';
}
if ( isset( $timestamps[$ns] ) && array_key_exists( $dbkey, $timestamps[$ns] ) ) {
$r['notificationtimestamp'] = '';