parsoid = $parsoid; $this->wikiPageFactory = $wikiPageFactory; $this->renderedRevision = $renderedRevision; } public function doUpdate() { $rev = $this->renderedRevision->getRevision(); $mainSlot = $rev->getSlot( SlotRecord::MAIN, RevisionRecord::RAW ); $page = $this->wikiPageFactory->newFromTitle( $rev->getPage() ); if ( $page->getLatest() !== $rev->getId() ) { // The given revision is no longer the latest revision. return; } $content = $mainSlot->getContent(); if ( !$content instanceof TextContent ) { // Linting is only defined for text return; } $pOptions = $page->makeParserOptions( 'canonical' ); $pOptions->setUseParsoid(); LoggerFactory::getInstance( 'Linter' )->debug( '{method}: Parsing {page}', [ 'method' => __METHOD__, 'page' => $page->getTitle()->getPrefixedDBkey(), 'touched' => $page->getTouched() ] ); // Don't update the parser cache, to avoid flooding it. // This matches the behavior of RefreshLinksJob. // However, unlike RefreshLinksJob, we don't parse if we already // have the output in the cache. This avoids duplicating the effort // of ParsoidCachePrewarmJob. $this->parsoid->parse( $content->getText(), $rev->getPage(), $pOptions, true, true, $rev->getId() ); } }