X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FWatchedItemStore.php;h=858d87bc591208e640cbb02ccb48a818b5685756;hb=43a7b72ae0ba4c7454d1eaa8d465d965f3590fcd;hp=cc4779ef38636b12950688a9b62b0f78cd61bb2b;hpb=6124d71e25c2894c3e025c20e81ff742045e8cd5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/WatchedItemStore.php b/includes/WatchedItemStore.php index cc4779ef38..858d87bc59 100644 --- a/includes/WatchedItemStore.php +++ b/includes/WatchedItemStore.php @@ -2,6 +2,7 @@ use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface; use MediaWiki\Linker\LinkTarget; +use MediaWiki\MediaWikiServices; use Wikimedia\Assert\Assert; use Wikimedia\ScopedCallback; @@ -668,7 +669,7 @@ class WatchedItemStore implements StatsdAwareInterface { /** * @param User $user The user to set the timestamp for - * @param string $timestamp Set the update timestamp to this value + * @param string|null $timestamp Set the update timestamp to this value * @param LinkTarget[] $targets List of targets to update. Default to all targets * * @return bool success @@ -687,9 +688,13 @@ class WatchedItemStore implements StatsdAwareInterface { $conds[] = $batch->constructSet( 'wl', $dbw ); } + if ( $timestamp !== null ) { + $timestamp = $dbw->timestamp( $timestamp ); + } + $success = $dbw->update( 'watchlist', - [ 'wl_notificationtimestamp' => $dbw->timestamp( $timestamp ) ], + [ 'wl_notificationtimestamp' => $timestamp ], $conds, __METHOD__ ); @@ -730,7 +735,7 @@ class WatchedItemStore implements StatsdAwareInterface { global $wgUpdateRowsPerQuery; $dbw = $this->getConnectionRef( DB_MASTER ); - $factory = wfGetLBFactory(); + $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); $ticket = $factory->getEmptyTransactionTicket( __METHOD__ ); $watchersChunks = array_chunk( $watchers, $wgUpdateRowsPerQuery );