Go to the documentation of this file.
35 parent::setUpBeforeClass();
48 parent::tearDownAfterClass();
55 'wgLogTypes' => [
'phpunit' ],
56 'wgLogActionsHandlers' => [
'phpunit/test' =>
'LogFormatter',
57 'phpunit/param' =>
'LogFormatter' ],
66 $this->context->setUser( $this->
user );
67 $this->context->setTitle( $this->
title );
70 $this->user_comment =
'<User comment about action>';
75 $logEntry->setPerformer( $this->
user );
76 $logEntry->setTarget( $this->
title );
77 $logEntry->setComment(
'A very good reason' );
79 $logEntry->setParameters(
$params );
90 $formatter->setContext( $this->context );
92 $formatter->setShowUserToolLinks(
false );
93 $paramsWithoutTools = $formatter->getMessageParametersForTesting();
94 unset( $formatter->parsedParameters );
96 $formatter->setShowUserToolLinks(
true );
97 $paramsWithTools = $formatter->getMessageParametersForTesting();
100 $this->
user->getId(),
101 $this->
user->getName()
105 $this->
user->getId(),
106 $this->
user->getName(),
107 $this->
user->getEditCount()
114 $this->assertEquals( $paramsWithoutTools[1], $paramsWithTools[1] );
115 $this->assertEquals( $paramsWithoutTools[2], $paramsWithTools[2] );
117 $this->assertEquals( $userLink, $paramsWithoutTools[0][
'raw'] );
118 $this->assertEquals( $userLink . $userTools, $paramsWithTools[0][
'raw'] );
120 $this->assertEquals( $this->
user->getName(), $paramsWithoutTools[1] );
122 $this->assertEquals( $titleLink, $paramsWithoutTools[2][
'raw'] );
135 $formatter->setContext( $this->context );
137 $logParam = $formatter->getActionText();
139 $this->assertEquals( $expected, $logParam );
147 $params = [
'4:msg:msg' =>
'log-description-phpunit' ];
148 $expected =
wfMessage(
'log-description-phpunit' )->text();
152 $formatter->setContext( $this->context );
154 $logParam = $formatter->getActionText();
156 $this->assertEquals( $expected, $logParam );
164 $params = [
'4:msg-content:msgContent' =>
'log-description-phpunit' ];
165 $expected =
wfMessage(
'log-description-phpunit' )->inContentLanguage()->text();
169 $formatter->setContext( $this->context );
171 $logParam = $formatter->getActionText();
173 $this->assertEquals( $expected, $logParam );
183 $params = [
'4:number:number' => 123456789 ];
184 $expected =
$wgLang->formatNum( 123456789 );
188 $formatter->setContext( $this->context );
190 $logParam = $formatter->getActionText();
192 $this->assertEquals( $expected, $logParam );
200 $params = [
'4:user-link:userLink' => $this->
user->getName() ];
202 $this->
user->getId(),
203 $this->
user->getName()
208 $formatter->setContext( $this->context );
210 $logParam = $formatter->getActionText();
212 $this->assertEquals( $expected, $logParam );
220 $params = [
'4:title-link:titleLink' => $this->
title->getText() ];
225 $formatter->setContext( $this->context );
227 $logParam = $formatter->getActionText();
229 $this->assertEquals( $expected, $logParam );
237 $params = [
'4:plain:plain' =>
'Some plain text' ];
238 $expected =
'Some plain text';
242 $formatter->setContext( $this->context );
244 $logParam = $formatter->getActionText();
246 $this->assertEquals( $expected, $logParam );
256 $formatter->setContext( $this->context );
260 $this->assertEquals( $comment, $formatter->getComment() );
271 $formatter->setContext( $this->context );
276 $this->assertEquals( $expected, $formatter->formatParametersForApi() );
281 [ 0,
'value', [
'value' ] ],
282 [
'named',
'value', [
'named' =>
'value' ] ],
283 [
'::key',
'value', [
'key' =>
'value' ] ],
284 [
'4::key',
'value', [
'key' =>
'value' ] ],
285 [
'4:raw:key',
'value', [
'key' =>
'value' ] ],
286 [
'4:plain:key',
'value', [
'key' =>
'value' ] ],
287 [
'4:bool:key',
'1', [
'key' =>
true ] ],
288 [
'4:bool:key',
'0', [
'key' =>
false ] ],
289 [
'4:number:key',
'123', [
'key' => 123 ] ],
290 [
'4:number:key',
'123.5', [
'key' => 123.5 ] ],
294 [
'4:timestamp:key',
'20150102030405', [
'key' =>
'2015-01-02T03:04:05Z' ] ],
295 [
'4:msg:key',
'parentheses', [
296 'key_key' =>
'parentheses',
297 'key_text' =>
wfMessage(
'parentheses' )->text(),
299 [
'4:msg-content:key',
'parentheses', [
300 'key_key' =>
'parentheses',
301 'key_text' =>
wfMessage(
'parentheses' )->inContentLanguage()->text(),
303 [
'4:title:key',
'project:foo', [
307 [
'4:title-link:key',
'project:foo', [
311 [
'4:user:key',
'foo', [
'key' =>
'Foo' ] ],
312 [
'4:user-link:key',
'foo', [
'key' =>
'Foo' ] ],
359 $sep = $this->context->msg(
'colon-separator' )->text();
363 $this->context->msg(
'blocklogentry',
'SomeTitle',
'duration',
'(flags)' )->plain()
367 '5::duration' =>
'duration',
368 '6::flags' =>
'flags',
372 # block/block - legacy
374 $this->context->msg(
'blocklogentry',
'SomeTitle',
'duration',
'(flags)' )->plain()
387 $this->context->msg(
'unblocklogentry',
'SomeTitle' )->plain() . $sep .
$this->user_comment,
394 $this->context->msg(
'reblock-logentry',
'SomeTitle',
'duration',
'(flags)' )->plain()
398 '5::duration' =>
'duration',
399 '6::flags' =>
'flags',
410 $sep = $this->context->msg(
'colon-separator' )->text();
414 $this->context->msg(
'deletedarticle',
'SomeTitle' )->plain() . $sep .
$this->user_comment,
422 $this->context->msg(
'undeletedarticle',
'SomeTitle' )->plain() . $sep .
$this->user_comment,
436 'newusers',
'newusers',
441 'newusers',
'create',
445 'created new account SomeTitle',
446 'newusers',
'create2',
450 'Account created automatically',
451 'newusers',
'autocreate',
462 '4::target' => $this->target->getPrefixedText(),
465 $sep = $this->context->msg(
'colon-separator' )->text();
469 $this->context->msg(
'1movedto2',
'SomeTitle',
'TestTarget' )
478 $this->context->msg(
'1movedto2_redir',
'SomeTitle',
'TestTarget' )
480 'move',
'move_redir',
493 $this->context->msg(
'patrol-log-line',
'revision 777',
'[[SomeTitle]]',
'' )->plain(),
497 '5::previd' =>
'666',
509 '4::description' =>
'[edit=sysop] (indefinite) [move=sysop] (indefinite)'
511 $sep = $this->context->msg(
'colon-separator' )->text();
515 $this->context->msg(
'protectedarticle',
'SomeTitle ' . $protectParams[
'4::description'] )
517 'protect',
'protect',
524 $this->context->msg(
'unprotectedarticle',
'SomeTitle' )->plain() . $sep .
$this->user_comment,
525 'protect',
'unprotect',
533 'modifiedarticleprotection',
534 'SomeTitle ' . $protectParams[
'4::description']
543 $this->context->msg(
'movedarticleprotection',
'SomeTitle',
'OldTitle' )
545 'protect',
'move_prot',
547 '4::oldtitle' =>
'OldTitle'
558 $sep = $this->context->msg(
'colon-separator' )->text();
570 $this->context->msg(
'overwroteimage',
'SomeTitle' )->plain() . $sep .
$this->user_comment,
571 'upload',
'overwrite',
582 $sep = $this->context->msg(
'colon-separator' )->text();
586 $this->context->msg(
'pagemerge-logentry',
'SomeTitle',
'Dest',
'timestamp' )->plain()
591 '5::mergepoint' =>
'timestamp',
602 $sep = $this->context->msg(
'colon-separator' )->text();
605 $msg = $this->context->msg(
'import-logentry-upload',
'SomeTitle' )->plain() .
616 $msg = $this->context->msg(
'import-logentry-interwiki',
'SomeTitle' )->plain() .
621 'import',
'interwiki',
636 $comment =
null, $msg =
'', $legacy =
false
639 $logEntry->setPerformer( $this->
user );
640 $logEntry->setTarget( $this->
title );
641 if ( $comment !==
null ) {
642 $logEntry->setComment( $comment );
644 $logEntry->setParameters(
$params );
645 $logEntry->setLegacy( $legacy );
648 $formatter->setContext( $this->context );
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
processing should stop and the error should be shown to the user * false
static userToolLinksRedContribs( $userId, $userText, $edits=null)
Alias for userToolLinks( $userId, $userText, true );.
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
const META_TYPE
Key for the 'type' metadata item.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
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
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
static getLocalisationCache()
Get the LocalisationCache instance.
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
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
when a variable name is used in a it is silently declared as a new masking the global
Group all the pieces relevant to the context of a request into one instance.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
static link( $target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
static getMain()
Static methods.
Represents a title within MediaWiki.
$wgExtensionMessagesFiles['ExtensionNameMagic']
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...
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
Class for creating log entries manually, to inject them into the database.
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 unset offset - wrap String Wrap the message in html(usually something like "<
The User object encapsulates all of the user-specific settings (user_id, name, rights,...