MediaWiki 1.42.0
PoolWorkArticleView.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\PoolCounter;
22
23use MediaWiki\Logger\Spi as LoggerSpi;
29
40 protected $parserOptions;
42 protected $revision;
44 private $renderer;
46 protected $loggerSpi;
47
55 public function __construct(
56 string $workKey,
59 RevisionRenderer $revisionRenderer,
60 LoggerSpi $loggerSpi
61 ) {
62 parent::__construct( 'ArticleView', $workKey );
63 $this->revision = $revision;
64 $this->parserOptions = $parserOptions;
65 $this->renderer = $revisionRenderer;
66 $this->loggerSpi = $loggerSpi;
67 }
68
72 public function doWork() {
73 return $this->renderRevision();
74 }
75
83 public function renderRevision(): Status {
84 $renderedRevision = $this->renderer->getRenderedRevision(
85 $this->revision,
86 $this->parserOptions,
87 null,
88 [ 'audience' => RevisionRecord::RAW ]
89 );
90
91 $parserOutput = $renderedRevision->getRevisionParserOutput();
92
93 return Status::newGood( $parserOutput );
94 }
95
100 public function error( $status ) {
101 return $status;
102 }
103
104}
105
107class_alias( PoolWorkArticleView::class, 'PoolWorkArticleView' );
Service for getting rendered output of a given page.
Class for dealing with PoolCounters using class members.
PoolCounter protected work wrapping RenderedRevision->getRevisionParserOutput.
__construct(string $workKey, RevisionRecord $revision, ParserOptions $parserOptions, RevisionRenderer $revisionRenderer, LoggerSpi $loggerSpi)
Page revision base class.
The RevisionRenderer service provides access to rendered output for revisions.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:54
Set options of the Parser.
Service provider interface to create \Psr\Log\LoggerInterface objects.
Definition Spi.php:64