26use InvalidArgumentException;
29use Psr\Log\LoggerInterface;
30use Psr\Log\NullLogger;
64 $this->saveParseLogger =
new NullLogger();
94 if (
$rev->getWikiId() !== $this->wikiId ) {
95 throw new InvalidArgumentException(
'Mismatching wiki ID ' .
$rev->getWikiId() );
98 $audience = $hints[
'audience']
108 $options = ParserOptions::newCanonical( $forUser ?:
'canonical' );
111 $useMaster = $hints[
'use-master'] ??
false;
113 $dbIndex = $useMaster
117 $options->setSpeculativeRevIdCallback(
function ()
use ( $dbIndex ) {
121 $title = Title::newFromLinkTarget(
$rev->getPageAsLinkTarget() );
136 return $renderedRevision;
144 $flags = defined(
'MW_PHPUNIT_TEST' ) || $dbIndex ===
DB_REPLICA
145 ? 0 : ILoadBalancer::CONN_TRX_AUTOCOMMIT;
147 $db = $this->loadBalancer->getConnectionRef( $dbIndex, [], $this->wikiId, $flags );
149 return 1 + (int)$db->selectField(
168 $revision = $rrev->getRevision();
169 $slots = $revision->getSlots()->getSlots();
171 $withHtml = $hints[
'generate-html'] ??
true;
189 $options->registerWatcher( [ $combinedOutput,
'recordOption' ] );
191 foreach ( $slots as $role => $slot ) {
192 $out = $rrev->getSlotParserOutput( $role, $hints );
193 $slotOutput[$role] =
$out;
195 $combinedOutput->mergeInternalMetaDataFrom(
$out, $role );
196 $combinedOutput->mergeTrackingMetaDataFrom(
$out );
203 foreach ( $slotOutput as $role =>
$out ) {
209 $headText = Html::element(
'mw:slotheader', [], $role );
210 $html .= Html::rawElement(
'h1', [
'class' =>
'mw-slot-header' ], $headText );
214 $combinedOutput->mergeHtmlMetaDataFrom(
$out );
217 $combinedOutput->setText(
$html );
221 return $combinedOutput;
This class is a collection of static functions that serve two purposes:
Set options of the Parser.
Represents a title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))