/** * Adds a notice saying that this revision is pending review * @param FlaggedRevision $srev The stable version * @param string $diffToggle either "" or " <diff toggle><diff div>" * @return void */ public function setPendingNotice(FlaggedRevision $srev, $diffToggle = '') { $this->load(); $time = $this->getLang()->date($srev->getTimestamp(), true); $revsSince = $this->article->getPendingRevCount(); $msg = $srev->getQuality() ? 'revreview-newest-quality' : 'revreview-newest-basic'; $msg .= $revsSince == 0 ? '-i' : ''; # Add bar msg to the top of the page... $css = 'flaggedrevs_preview plainlinks'; $msgHTML = wfMsgExt($msg, 'parseinline', $srev->getRevId(), $time, $revsSince); $this->reviewNotice .= "<div id='mw-fr-reviewnotice' class='{$css}'>" . "{$msgHTML}{$diffToggle}</div>"; }
/** * Get the HTML output of a revision. * @param FlaggedRevision $frev * @param ParserOptions $pOpts * @return ParserOutput|null */ public static function parseStableRevision(FlaggedRevision $frev, ParserOptions $pOpts) { # Notify Parser if includes should be stabilized $resetManager = false; $incManager = FRInclusionManager::singleton(); if ($frev->getRevId() && self::inclusionSetting() != FR_INCLUDES_CURRENT) { # Use FRInclusionManager to do the template/file version query # up front unless the versions are already specified there... if (!$incManager->parserOutputIsStabilized()) { $incManager->stabilizeParserOutput($frev); $resetManager = true; // need to reset when done } } # Parse the new body $content = $frev->getRevision()->getContent(); if ($content === null) { return null; // missing revision } $parserOut = $content->getParserOutput($frev->getTitle(), $frev->getRevId(), $pOpts); # Stable parse done! if ($resetManager) { $incManager->clear(); // reset the FRInclusionManager as needed } return $parserOut; }