X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FWatchedItem.php;h=adee1264a39b471cbb872adcb2f80d8454378298;hp=73b0b937b087dcbc613e673ea1886ef3e293f775;hb=59ebff658ce912c1b0e7ef8d8f9bfec5a4e17b39;hpb=fac57b4b9692847c0473efedcff076fab873dbde diff --git a/includes/WatchedItem.php b/includes/WatchedItem.php index 73b0b937b0..adee1264a3 100644 --- a/includes/WatchedItem.php +++ b/includes/WatchedItem.php @@ -224,8 +224,6 @@ class WatchedItem { public function resetNotificationTimestamp( $force = '', $oldid = 0, $mode = self::IMMEDIATE ) { - global $wgActivityUpdatesUseJobQueue; - // Only loggedin user can have a watchlist if ( wfReadOnly() || $this->mUser->isAnon() || !$this->isAllowed( 'editmywatchlist' ) ) { return; @@ -275,20 +273,20 @@ class WatchedItem { } // If the page is watched by the user (or may be watched), update the timestamp - if ( $mode === self::DEFERRED && $wgActivityUpdatesUseJobQueue ) { - JobQueueGroup::singleton()->push( - EnqueueJob::newFromLocalJobs( new JobSpecification( - 'activityUpdateJob', - array( - 'type' => 'updateWatchlistNotification', - 'userid' => $this->getUserId(), - 'notifTime' => $notificationTimestamp, - 'curTime' => time() - ), - array( 'removeDuplicates' => true ), - $title - ) ) + if ( $mode === self::DEFERRED ) { + $job = new ActivityUpdateJob( + $title, + array( + 'type' => 'updateWatchlistNotification', + 'userid' => $this->getUserId(), + 'notifTime' => $notificationTimestamp, + 'curTime' => time() + ) ); + // Try to run this post-send + DeferredUpdates::addCallableUpdate( function() use ( $job ) { + $job->run(); + } ); } else { $dbw = wfGetDB( DB_MASTER ); $dbw->update( 'watchlist',