threadItemStore = $threadItemStore; } /** * @param Title $title * @param RenderedRevision $renderedRevision * @param DeferrableUpdate[] &$updates * @return bool|void */ public function onRevisionDataUpdates( $title, $renderedRevision, &$updates ) { // This doesn't trigger on action=purge, only on automatic purge after editing a template or // transcluded page, and API action=purge&forcelinkupdate=1. // TODO Deduplicate work between this and the Echo hook (make it use Parsoid too) $rev = $renderedRevision->getRevision(); if ( HookUtils::isAvailableForTitle( $title ) ) { $updates[] = new MWCallableUpdate( function () use ( $rev ) { try { $threadItemSet = HookUtils::parseRevisionParsoidHtml( $rev ); $this->threadItemStore->insertThreadItems( $rev, $threadItemSet ); } catch ( Throwable $e ) { // Catch errors, so that they don't cause other updates to fail (T315383), but log them. MWExceptionHandler::logException( $e ); } }, __METHOD__ ); } } }