Go to the documentation of this file.
68 # Do a batch existence check
72 $outText =
'<div class="mw-templatesUsedExplanation">';
73 $count =
count( $templates );
74 if (
$type ===
'preview' ) {
75 $outText .= $this->context->msg(
'templatesusedpreview' )->numParams( $count )
77 } elseif (
$type ===
'section' ) {
78 $outText .= $this->context->msg(
'templatesusedsection' )->numParams( $count )
81 $outText .= $this->context->msg(
'templatesused' )->numParams( $count )
84 $outText .=
"</div><ul>\n";
86 usort( $templates,
'Title::compare' );
92 $outText .= Html::rawElement(
'li', [], $this->linkRenderer->makeLink(
93 $more, $this->context->msg(
'moredotdotdot' )->text() ) );
96 $outText .= Html::rawElement(
'li', [], $more );
114 return '<li>' . $this->linkRenderer->makeLink( $target )
115 . $this->context->msg(
'word-separator' )->escaped()
116 . $this->context->msg(
'parentheses' )->rawParams( $editLink )->escaped()
117 . $this->context->msg(
'word-separator' )->escaped()
118 . $protected .
'</li>';
130 if ( !$restrictions ) {
136 if ( $restrictions === [
'sysop' ] ) {
137 $msg = $this->context->msg(
'template-protected' );
138 } elseif ( $restrictions === [
'autoconfirmed' ] ) {
139 $msg = $this->context->msg(
'template-semiprotected' );
141 if ( $msg && !$msg->isDisabled() ) {
142 $protected = $msg->parse();
147 foreach ( $restrictions
as $r ) {
148 $msgs[] = $this->context->msg(
"restriction-level-$r" )->parse();
150 $protected = $this->context->msg(
'parentheses' )
151 ->rawParams( $this->context->getLanguage()->commaList( $msgs ) )->escaped();
165 if ( $titleObj->
quickUserCan(
'edit', $this->context->getUser() ) ) {
166 $linkMsg =
'editlink';
168 $linkMsg =
'viewsourcelink';
171 return $this->linkRenderer->makeLink(
173 $this->context->msg( $linkMsg )->text(),
175 [
'action' =>
'edit' ]
Class representing a list of titles The execute() method checks them all for existence and adds them ...
buildEditLink(Title $titleObj)
Return a link to the edit page, with the text saying "view source" if the user can't edit the page.
__construct(IContextSource $context, LinkRenderer $linkRenderer)
quickUserCan( $action, $user=null)
Can $user perform $action on this page? This skips potentially expensive cascading permission checks ...
getRestrictionsText(array $restrictions)
If the page is protected, get the relevant text for those restrictions.
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
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))
format(array $templates, $type=false, $more=null)
Make an HTML list of templates, and then add a "More..." link at the bottom.
Handles formatting for the "templates used on this page" lists.
static newFromLinkTarget(LinkTarget $linkTarget, $forceClone='')
Returns a Title given a LinkTarget.
Interface for objects which can provide a MediaWiki context on request.
Represents a title within MediaWiki.
formatTemplate(LinkTarget $target)
Builds an item for an individual template.
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
LinkRenderer $linkRenderer
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 $template