wikiPageFactory = $wikiPageFactory; $this->parserOutputAccess = $parserOutputAccess; $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(); $pOptions->setRenderReason( 'LintUpdate' ); 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 / DiscussionTools // (note that even with OPT_NO_UPDATE_CACHE we still update the // *local* cache, which prevents wasting effort on duplicate parses) $this->parserOutputAccess->getParserOutput( $page, $pOptions, $rev, ParserOutputAccess::OPT_NO_UPDATE_CACHE ); } }