25use InvalidArgumentException;
29use Psr\Log\LoggerInterface;
30use Psr\Log\NullLogger;
35use Wikimedia\Assert\Assert;
122 $this->saveParseLogger =
new NullLogger();
125 throw new InvalidArgumentException(
126 'User must be specified when setting audience to FOR_THIS_USER'
173 $this->revisionOutput =
$output;
192 $withHtml = $hints[
'generate-html'] ??
true;
194 if ( !$this->revisionOutput
195 || ( $withHtml && !$this->revisionOutput->hasText() )
197 $output = call_user_func( $this->combineOutput, $this, $hints );
199 Assert::postcondition(
201 'Callback did not return a ParserOutput object!'
204 $this->revisionOutput =
$output;
221 $withHtml = $hints[
'generate-html'] ??
true;
223 if ( !isset( $this->slotsOutput[ $role ] )
224 || ( $withHtml && !$this->slotsOutput[ $role ]->hasText() )
226 $content = $this->
revision->getContent( $role, $this->audience, $this->forUser );
230 'Access to the content has been suppressed for this audience'
236 if ( $withHtml && !
$output->hasText() ) {
237 throw new LogicException(
238 'HTML generation was requested, but '
240 .
'::getParserOutput() returns a ParserOutput with no text set.'
245 $this->
options->registerWatcher(
null );
248 $this->slotsOutput[ $role ] =
$output;
251 return $this->slotsOutput[$role];
279 if (
$rev->getId() === $this->revision->getId() ) {
284 throw new LogicException(
'RenderedRevision already has a revision with ID '
285 . $this->
revision->getId(),
', can\'t update to revision with ID ' .
$rev->getId() );
288 if ( !$this->
revision->getSlots()->hasSameContent(
$rev->getSlots() ) ) {
289 throw new LogicException(
'Cannot update to a revision with different content!' );
305 if ( $this->revisionOutput ) {
307 $this->revisionOutput =
null;
310 $this->saveParseLogger->debug( __METHOD__ .
": no prepared revision output...\n" );
313 foreach ( $this->slotsOutput
as $role =>
$output ) {
315 unset( $this->slotsOutput[$role] );
356 if ( $this->
revision->isReadyForInsertion() || !$this->revision->getId() ) {
358 $oldCallback = $this->
options->getCurrentRevisionCallback();
359 $this->
options->setCurrentRevisionCallback(
362 $legacyRevision = new Revision( $this->revision );
363 return $legacyRevision;
365 return call_user_func( $oldCallback, $parserTitle, $parser );
380 $method = __METHOD__;
382 if (
$out->getFlag(
'vary-revision' ) ) {
386 $this->saveParseLogger->info(
387 "$method: Prepared output has vary-revision...\n"
390 } elseif (
$out->getFlag(
'vary-revision-id' )
391 && $actualRevId !==
false
392 && ( $actualRevId ===
true ||
$out->getSpeculativeRevIdUsed() !== $actualRevId )
394 $this->saveParseLogger->info(
395 "$method: Prepared output has vary-revision-id with wrong ID...\n"
407 wfDebug(
"$method: Keeping prepared output...\n" );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Set options of the Parser.
Represents a title within MediaWiki.
equals(Title $title)
Compare with another title.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
see documentation in includes Linker php for Linker::makeImageLink or false for current used if you return false $parser
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going and make changes or fix bugs In we can take all the code that deals with the little used title reversing options(say) and put it in one place. Instead of having little title-reversing if-blocks spread all over the codebase in showAnArticle
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place $output
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
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Base interface for content objects.
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))
In both all secondary updates will be triggered handle like object that caches derived data representing a revision