MediaWiki REL1_40
PoolWorkArticleViewOld.php
Go to the documentation of this file.
1<?php
21use MediaWiki\Logger\Spi as LoggerSpi;
25
33 private $cache;
34
43 public function __construct(
44 string $workKey,
46 RevisionRecord $revision,
47 ParserOptions $parserOptions,
48 RevisionRenderer $revisionRenderer,
49 LoggerSpi $loggerSpi
50 ) {
51 parent::__construct( $workKey, $revision, $parserOptions, $revisionRenderer, $loggerSpi );
52
53 $this->cache = $cache;
54
55 $this->cacheable = true;
56 }
57
61 public function doWork() {
62 // Reduce effects of race conditions for slow parses (T48014)
63 $cacheTime = wfTimestampNow();
64
65 $status = $this->renderRevision();
67 $output = $status->getValue();
68
69 if ( $output && $output->isCacheable() ) {
70 $this->cache->save( $output, $this->revision, $this->parserOptions, $cacheTime );
71 }
72
73 return $status;
74 }
75
79 public function getCachedWork() {
80 $parserOutput = $this->cache->get( $this->revision, $this->parserOptions );
81
82 return $parserOutput ? Status::newGood( $parserOutput ) : false;
83 }
84
85}
wfTimestampNow()
Convenience function; returns MediaWiki timestamp for the present time.
Cache for ParserOutput objects.
Page revision base class.
The RevisionRenderer service provides access to rendered output for revisions.
Set options of the Parser.
PoolWorkArticleView for an old revision of a page, using a simple cache.
__construct(string $workKey, RevisionOutputCache $cache, RevisionRecord $revision, ParserOptions $parserOptions, RevisionRenderer $revisionRenderer, LoggerSpi $loggerSpi)
PoolCounter protected work wrapping RenderedRevision->getRevisionParserOutput.
Service provider interface for \Psr\Log\LoggerInterface implementation libraries.
Definition Spi.php:38