Go to the documentation of this file.
26 use InvalidArgumentException;
29 use Psr\Log\LoggerInterface;
30 use Psr\Log\NullLogger;
70 $this->roleRegistery = $roleRegistry;
73 $this->saveParseLogger =
new NullLogger();
105 User $forUser =
null,
109 throw new InvalidArgumentException(
'Mismatching wiki ID ' .
$rev->getWikiId() );
112 $audience = $hints[
'audience']
125 $useMaster = $hints[
'use-master'] ??
false;
127 $dbIndex = $useMaster
131 $options->setSpeculativeRevIdCallback(
function ()
use ( $dbIndex ) {
150 if ( isset( $hints[
'known-revision-output'] ) ) {
151 $renderedRevision->setRevisionParserOutput( $hints[
'known-revision-output'] );
154 return $renderedRevision;
162 $flags = defined(
'MW_PHPUNIT_TEST' ) || $dbIndex ===
DB_REPLICA
163 ? 0 : ILoadBalancer::CONN_TRX_AUTOCOMMIT;
165 $db = $this->loadBalancer->getConnectionRef( $dbIndex, [], $this->wikiId, $flags );
167 return 1 + (int)$db->selectField(
187 $slots = $revision->getSlots()->getSlots();
189 $withHtml = $hints[
'generate-html'] ??
true;
205 $options->registerWatcher( [ $combinedOutput,
'recordOption' ] );
207 foreach ( $slots
as $role => $slot ) {
209 $slotOutput[$role] =
$out;
212 $combinedOutput->mergeInternalMetaDataFrom(
$out, $role );
213 $combinedOutput->mergeTrackingMetaDataFrom(
$out );
220 foreach ( $slotOutput
as $role =>
$out ) {
221 $roleHandler = $this->roleRegistery->getRoleHandler( $role );
224 $layout = $roleHandler->getOutputLayoutHints();
225 $display = $layout[
'display'] ??
'section';
227 if ( $display ===
'none' ) {
236 $headText = Html::element(
'mw:slotheader', [], $role );
237 $html .= Html::rawElement(
'h1', [
'class' =>
'mw-slot-header' ], $headText );
243 $combinedOutput->mergeHtmlMetaDataFrom(
$out );
246 $combinedOutput->setText(
$html );
250 return $combinedOutput;
Set options of the 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
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
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
namespace and then decline to actually register it file or subcat img or subcat $title
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))
static newCanonical( $context=null, $userLang=null)
Creates a "canonical" ParserOptions object.
static newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Returns a Title given a LinkTarget.
Represents a title within MediaWiki.
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
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
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
The User object encapsulates all of the user-specific settings (user_id, name, rights,...