X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=blobdiff_plain;f=includes%2Fuser%2FUser.php;h=9ef880bfd471b1c82365bc1b5890a6ce39929d9e;hb=2ae7d6b58035f038717d725efd493c4870337599;hp=47d75338bbf905af3c9519ddc0979348b199418f;hpb=f34423130fee55974a5aec783cd34a213802bd1c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/user/User.php b/includes/user/User.php index 47d75338bb..9ef880bfd4 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -150,10 +150,12 @@ class User implements IDBAccessObject, UserIdentity { 'editmyoptions', 'editmyprivateinfo', 'editmyusercss', + 'editmyuserjson', 'editmyuserjs', 'editmywatchlist', 'editsemiprotected', 'editusercss', + 'edituserjson', 'edituserjs', 'hideuser', 'import', @@ -3084,7 +3086,7 @@ class User implements IDBAccessObject, UserIdentity { * @param string $oname The option to check * @param string $defaultOverride A default value returned if the option does not exist * @param bool $ignoreHidden Whether to ignore the effects of $wgHiddenPrefs - * @return string|null User's current value for the option + * @return string|array|int|null User's current value for the option * @see getBoolOption() * @see getIntOption() */ @@ -3969,51 +3971,9 @@ class User implements IDBAccessObject, UserIdentity { return; } - $dbw = wfGetDB( DB_MASTER ); - $asOfTimes = array_unique( $dbw->selectFieldValues( - 'watchlist', - 'wl_notificationtimestamp', - [ 'wl_user' => $id, 'wl_notificationtimestamp IS NOT NULL' ], - __METHOD__, - [ 'ORDER BY' => 'wl_notificationtimestamp DESC', 'LIMIT' => 500 ] - ) ); - if ( !$asOfTimes ) { - return; - } - // Immediately update the most recent touched rows, which hopefully covers what - // the user sees on the watchlist page before pressing "mark all pages visited".... - $dbw->update( - 'watchlist', - [ 'wl_notificationtimestamp' => null ], - [ 'wl_user' => $id, 'wl_notificationtimestamp' => $asOfTimes ], - __METHOD__ - ); - // ...and finish the older ones in a post-send update with lag checks... - DeferredUpdates::addUpdate( new AutoCommitUpdate( - $dbw, - __METHOD__, - function () use ( $dbw, $id ) { - global $wgUpdateRowsPerQuery; - - $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); - $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ ); - $asOfTimes = array_unique( $dbw->selectFieldValues( - 'watchlist', - 'wl_notificationtimestamp', - [ 'wl_user' => $id, 'wl_notificationtimestamp IS NOT NULL' ], - __METHOD__ - ) ); - foreach ( array_chunk( $asOfTimes, $wgUpdateRowsPerQuery ) as $asOfTimeBatch ) { - $dbw->update( - 'watchlist', - [ 'wl_notificationtimestamp' => null ], - [ 'wl_user' => $id, 'wl_notificationtimestamp' => $asOfTimeBatch ], - __METHOD__ - ); - $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket ); - } - } - ) ); + $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore(); + $watchedItemStore->resetAllNotificationTimestampsForUser( $this ); + // We also need to clear here the "you have new message" notification for the own // user_talk page; it's cleared one page view later in WikiPage::doViewUpdates(). }