39 'wgLogTypes' => [
'phpunit' ],
40 'wgLogActionsHandlers' => [
'phpunit/test' =>
'LogFormatter',
41 'phpunit/param' =>
'LogFormatter' ],
43 'wgExtensionMessagesFiles' => [
'LogTests' => __DIR__ .
'/LogTests.i18n.php' ],
53 $this->context->setUser( $this->
user );
54 $this->context->setTitle( $this->
title );
55 $this->context->setLanguage( $wgLang );
57 $this->user_comment =
'<User comment about action>';
69 $logEntry->setPerformer( $this->
user );
70 $logEntry->setTarget( $this->
title );
71 $logEntry->setComment(
'A very good reason' );
73 $logEntry->setParameters(
$params );
84 $formatter->setContext( $this->context );
86 $formatter->setShowUserToolLinks(
false );
87 $paramsWithoutTools = $formatter->getMessageParametersForTesting();
88 unset( $formatter->parsedParameters );
90 $formatter->setShowUserToolLinks(
true );
91 $paramsWithTools = $formatter->getMessageParametersForTesting();
95 $this->
user->getName()
100 $this->
user->getName(),
101 $this->
user->getEditCount()
108 $this->assertEquals( $paramsWithoutTools[1], $paramsWithTools[1] );
109 $this->assertEquals( $paramsWithoutTools[2], $paramsWithTools[2] );
111 $this->assertEquals( $userLink, $paramsWithoutTools[0][
'raw'] );
112 $this->assertEquals( $userLink . $userTools, $paramsWithTools[0][
'raw'] );
114 $this->assertEquals( $this->
user->getName(), $paramsWithoutTools[1] );
116 $this->assertEquals( $titleLink, $paramsWithoutTools[2][
'raw'] );
129 $formatter->setContext( $this->context );
131 $logParam = $formatter->getActionText();
133 $this->assertEquals( $expected, $logParam );
141 $params = [
'4:msg:msg' =>
'log-description-phpunit' ];
142 $expected =
wfMessage(
'log-description-phpunit' )->text();
146 $formatter->setContext( $this->context );
148 $logParam = $formatter->getActionText();
150 $this->assertEquals( $expected, $logParam );
158 $params = [
'4:msg-content:msgContent' =>
'log-description-phpunit' ];
159 $expected =
wfMessage(
'log-description-phpunit' )->inContentLanguage()->text();
163 $formatter->setContext( $this->context );
165 $logParam = $formatter->getActionText();
167 $this->assertEquals( $expected, $logParam );
177 $params = [
'4:number:number' => 123456789 ];
178 $expected = $wgLang->formatNum( 123456789 );
182 $formatter->setContext( $this->context );
184 $logParam = $formatter->getActionText();
186 $this->assertEquals( $expected, $logParam );
194 $params = [
'4:user-link:userLink' => $this->
user->getName() ];
196 $this->
user->getId(),
197 $this->
user->getName()
202 $formatter->setContext( $this->context );
204 $logParam = $formatter->getActionText();
206 $this->assertEquals( $expected, $logParam );
214 $params = [
'4:title-link:titleLink' => $this->
title->getText() ];
219 $formatter->setContext( $this->context );
221 $logParam = $formatter->getActionText();
223 $this->assertEquals( $expected, $logParam );
231 $params = [
'4:plain:plain' =>
'Some plain text' ];
232 $expected =
'Some plain text';
236 $formatter->setContext( $this->context );
238 $logParam = $formatter->getActionText();
240 $this->assertEquals( $expected, $logParam );
250 $formatter->setContext( $this->context );
254 $this->assertEquals(
$comment, $formatter->getComment() );
265 $formatter->setContext( $this->context );
270 $this->assertEquals( $expected, $formatter->formatParametersForApi() );
275 [ 0,
'value', [
'value' ] ],
276 [
'named',
'value', [
'named' =>
'value' ] ],
277 [
'::key',
'value', [
'key' =>
'value' ] ],
278 [
'4::key',
'value', [
'key' =>
'value' ] ],
279 [
'4:raw:key',
'value', [
'key' =>
'value' ] ],
280 [
'4:plain:key',
'value', [
'key' =>
'value' ] ],
281 [
'4:bool:key',
'1', [
'key' =>
true ] ],
282 [
'4:bool:key',
'0', [
'key' =>
false ] ],
283 [
'4:number:key',
'123', [
'key' => 123 ] ],
284 [
'4:number:key',
'123.5', [
'key' => 123.5 ] ],
288 [
'4:timestamp:key',
'20150102030405', [
'key' =>
'2015-01-02T03:04:05Z' ] ],
289 [
'4:msg:key',
'parentheses', [
290 'key_key' =>
'parentheses',
291 'key_text' =>
wfMessage(
'parentheses' )->text(),
293 [
'4:msg-content:key',
'parentheses', [
294 'key_key' =>
'parentheses',
295 'key_text' =>
wfMessage(
'parentheses' )->inContentLanguage()->text(),
297 [
'4:title:key',
'project:foo', [
301 [
'4:title-link:key',
'project:foo', [
305 [
'4:user:key',
'foo', [
'key' =>
'Foo' ] ],
306 [
'4:user-link:key',
'foo', [
'key' =>
'Foo' ] ],
353 $sep = $this->context->msg(
'colon-separator' )->text();
357 $this->context->msg(
'blocklogentry',
'SomeTitle',
'duration',
'(flags)' )->plain()
361 '5::duration' =>
'duration',
362 '6::flags' =>
'flags',
366 # block/block - legacy
368 $this->context->msg(
'blocklogentry',
'SomeTitle',
'duration',
'(flags)' )->plain()
381 $this->context->msg(
'unblocklogentry',
'SomeTitle' )->plain() . $sep .
$this->user_comment,
388 $this->context->msg(
'reblock-logentry',
'SomeTitle',
'duration',
'(flags)' )->plain()
392 '5::duration' =>
'duration',
393 '6::flags' =>
'flags',
404 $sep = $this->context->msg(
'colon-separator' )->text();
408 $this->context->msg(
'deletedarticle',
'SomeTitle' )->plain() . $sep .
$this->user_comment,
416 $this->context->msg(
'undeletedarticle',
'SomeTitle' )->plain() . $sep .
$this->user_comment,
430 'newusers',
'newusers',
435 'newusers',
'create',
439 'created new account SomeTitle',
440 'newusers',
'create2',
444 'Account created automatically',
445 'newusers',
'autocreate',
456 '4::target' => $this->target->getPrefixedText(),
459 $sep = $this->context->msg(
'colon-separator' )->text();
463 $this->context->msg(
'1movedto2',
'SomeTitle',
'TestTarget' )
472 $this->context->msg(
'1movedto2_redir',
'SomeTitle',
'TestTarget' )
474 'move',
'move_redir',
487 $this->context->msg(
'patrol-log-line',
'revision 777',
'[[SomeTitle]]',
'' )->plain(),
491 '5::previd' =>
'666',
503 '4::description' =>
'[edit=sysop] (indefinite) [move=sysop] (indefinite)'
505 $sep = $this->context->msg(
'colon-separator' )->text();
509 $this->context->msg(
'protectedarticle',
'SomeTitle ' . $protectParams[
'4::description'] )
511 'protect',
'protect',
518 $this->context->msg(
'unprotectedarticle',
'SomeTitle' )->plain() . $sep .
$this->user_comment,
519 'protect',
'unprotect',
527 'modifiedarticleprotection',
528 'SomeTitle ' . $protectParams[
'4::description']
537 $this->context->msg(
'movedarticleprotection',
'SomeTitle',
'OldTitle' )
539 'protect',
'move_prot',
541 '4::oldtitle' =>
'OldTitle'
552 $sep = $this->context->msg(
'colon-separator' )->text();
564 $this->context->msg(
'overwroteimage',
'SomeTitle' )->plain() . $sep .
$this->user_comment,
565 'upload',
'overwrite',
576 $sep = $this->context->msg(
'colon-separator' )->text();
580 $this->context->msg(
'pagemerge-logentry',
'SomeTitle',
'Dest',
'timestamp' )->plain()
585 '5::mergepoint' =>
'timestamp',
596 $sep = $this->context->msg(
'colon-separator' )->text();
599 $msg = $this->context->msg(
'import-logentry-upload',
'SomeTitle' )->plain() .
610 $msg = $this->context->msg(
'import-logentry-interwiki',
'SomeTitle' )->plain() .
615 'import',
'interwiki',
630 $comment = null, $msg =
'', $legacy =
false
633 $logEntry->setPerformer( $this->
user );
634 $logEntry->setTarget( $this->
title );
638 $logEntry->setParameters(
$params );
639 $logEntry->setLegacy( $legacy );
642 $formatter->setContext( $this->context );
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
static getLocalisationCache()
Get the LocalisationCache instance.
Group all the pieces relevant to the context of a request into one instance.
processing should stop and the error should be shown to the user * false
const META_TYPE
Key for the 'type' metadata item.
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
when a variable name is used in a it is silently declared as a new local masking the global
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
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 true
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock()-offset Set to overwrite offset parameter in $wgRequest set to ''to unsetoffset-wrap String Wrap the message in html(usually something like"<
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 and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
Wikitext formatted, in the key only.
static userToolLinksRedContribs($userId, $userText, $edits=null)
Alias for userToolLinks( $userId, $userText, true );.
static link($target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
static userLink($userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
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
Class for creating log entries manually, to inject them into the database.
static commentBlock($comment, $title=null, $local=false, $wikiId=null)
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type