MediaWiki  1.31.0
LogFormatterTest.php
Go to the documentation of this file.
1 <?php
2 
7  private static $oldExtMsgFiles;
8 
12  protected $user;
13 
17  protected $title;
18 
22  protected $context;
23 
27  protected $target;
28 
32  protected $user_comment;
33 
34  public static function setUpBeforeClass() {
35  parent::setUpBeforeClass();
36 
38  self::$oldExtMsgFiles = $wgExtensionMessagesFiles;
39  $wgExtensionMessagesFiles['LogTests'] = __DIR__ . '/LogTests.i18n.php';
40  Language::getLocalisationCache()->recache( 'en' );
41  }
42 
43  public static function tearDownAfterClass() {
46  Language::getLocalisationCache()->recache( 'en' );
47 
48  parent::tearDownAfterClass();
49  }
50 
51  protected function setUp() {
52  parent::setUp();
53 
54  $this->setMwGlobals( [
55  'wgLogTypes' => [ 'phpunit' ],
56  'wgLogActionsHandlers' => [ 'phpunit/test' => LogFormatter::class,
57  'phpunit/param' => LogFormatter::class ],
58  'wgUser' => User::newFromName( 'Testuser' ),
59  ] );
60 
61  $this->user = User::newFromName( 'Testuser' );
62  $this->title = Title::newFromText( 'SomeTitle' );
63  $this->target = Title::newFromText( 'TestTarget' );
64 
65  $this->context = new RequestContext();
66  $this->context->setUser( $this->user );
67  $this->context->setTitle( $this->title );
68  $this->context->setLanguage( RequestContext::getMain()->getLanguage() );
69 
70  $this->user_comment = '<User comment about action>';
71  }
72 
73  public function newLogEntry( $action, $params ) {
74  $logEntry = new ManualLogEntry( 'phpunit', $action );
75  $logEntry->setPerformer( $this->user );
76  $logEntry->setTarget( $this->title );
77  $logEntry->setComment( 'A very good reason' );
78 
79  $logEntry->setParameters( $params );
80 
81  return $logEntry;
82  }
83 
87  public function testNormalLogParams() {
88  $entry = $this->newLogEntry( 'test', [] );
89  $formatter = LogFormatter::newFromEntry( $entry );
90  $formatter->setContext( $this->context );
91 
92  $formatter->setShowUserToolLinks( false );
93  $paramsWithoutTools = $formatter->getMessageParametersForTesting();
94  unset( $formatter->parsedParameters );
95 
96  $formatter->setShowUserToolLinks( true );
97  $paramsWithTools = $formatter->getMessageParametersForTesting();
98 
99  $userLink = Linker::userLink(
100  $this->user->getId(),
101  $this->user->getName()
102  );
103 
105  $this->user->getId(),
106  $this->user->getName(),
107  $this->user->getEditCount()
108  );
109 
110  $titleLink = Linker::link( $this->title, null, [], [] );
111 
112  // $paramsWithoutTools and $paramsWithTools should be only different
113  // in index 0
114  $this->assertEquals( $paramsWithoutTools[1], $paramsWithTools[1] );
115  $this->assertEquals( $paramsWithoutTools[2], $paramsWithTools[2] );
116 
117  $this->assertEquals( $userLink, $paramsWithoutTools[0]['raw'] );
118  $this->assertEquals( $userLink . $userTools, $paramsWithTools[0]['raw'] );
119 
120  $this->assertEquals( $this->user->getName(), $paramsWithoutTools[1] );
121 
122  $this->assertEquals( $titleLink, $paramsWithoutTools[2]['raw'] );
123  }
124 
129  public function testLogParamsTypeRaw() {
130  $params = [ '4:raw:raw' => Linker::link( $this->title, null, [], [] ) ];
131  $expected = Linker::link( $this->title, null, [], [] );
132 
133  $entry = $this->newLogEntry( 'param', $params );
134  $formatter = LogFormatter::newFromEntry( $entry );
135  $formatter->setContext( $this->context );
136 
137  $logParam = $formatter->getActionText();
138 
139  $this->assertEquals( $expected, $logParam );
140  }
141 
146  public function testLogParamsTypeMsg() {
147  $params = [ '4:msg:msg' => 'log-description-phpunit' ];
148  $expected = wfMessage( 'log-description-phpunit' )->text();
149 
150  $entry = $this->newLogEntry( 'param', $params );
151  $formatter = LogFormatter::newFromEntry( $entry );
152  $formatter->setContext( $this->context );
153 
154  $logParam = $formatter->getActionText();
155 
156  $this->assertEquals( $expected, $logParam );
157  }
158 
163  public function testLogParamsTypeMsgContent() {
164  $params = [ '4:msg-content:msgContent' => 'log-description-phpunit' ];
165  $expected = wfMessage( 'log-description-phpunit' )->inContentLanguage()->text();
166 
167  $entry = $this->newLogEntry( 'param', $params );
168  $formatter = LogFormatter::newFromEntry( $entry );
169  $formatter->setContext( $this->context );
170 
171  $logParam = $formatter->getActionText();
172 
173  $this->assertEquals( $expected, $logParam );
174  }
175 
180  public function testLogParamsTypeNumber() {
181  global $wgLang;
182 
183  $params = [ '4:number:number' => 123456789 ];
184  $expected = $wgLang->formatNum( 123456789 );
185 
186  $entry = $this->newLogEntry( 'param', $params );
187  $formatter = LogFormatter::newFromEntry( $entry );
188  $formatter->setContext( $this->context );
189 
190  $logParam = $formatter->getActionText();
191 
192  $this->assertEquals( $expected, $logParam );
193  }
194 
199  public function testLogParamsTypeUserLink() {
200  $params = [ '4:user-link:userLink' => $this->user->getName() ];
201  $expected = Linker::userLink(
202  $this->user->getId(),
203  $this->user->getName()
204  );
205 
206  $entry = $this->newLogEntry( 'param', $params );
207  $formatter = LogFormatter::newFromEntry( $entry );
208  $formatter->setContext( $this->context );
209 
210  $logParam = $formatter->getActionText();
211 
212  $this->assertEquals( $expected, $logParam );
213  }
214 
219  public function testLogParamsTypeTitleLink() {
220  $params = [ '4:title-link:titleLink' => $this->title->getText() ];
221  $expected = Linker::link( $this->title, null, [], [] );
222 
223  $entry = $this->newLogEntry( 'param', $params );
224  $formatter = LogFormatter::newFromEntry( $entry );
225  $formatter->setContext( $this->context );
226 
227  $logParam = $formatter->getActionText();
228 
229  $this->assertEquals( $expected, $logParam );
230  }
231 
236  public function testLogParamsTypePlain() {
237  $params = [ '4:plain:plain' => 'Some plain text' ];
238  $expected = 'Some plain text';
239 
240  $entry = $this->newLogEntry( 'param', $params );
241  $formatter = LogFormatter::newFromEntry( $entry );
242  $formatter->setContext( $this->context );
243 
244  $logParam = $formatter->getActionText();
245 
246  $this->assertEquals( $expected, $logParam );
247  }
248 
253  public function testLogComment() {
254  $entry = $this->newLogEntry( 'test', [] );
255  $formatter = LogFormatter::newFromEntry( $entry );
256  $formatter->setContext( $this->context );
257 
258  $comment = ltrim( Linker::commentBlock( $entry->getComment() ) );
259 
260  $this->assertEquals( $comment, $formatter->getComment() );
261  }
262 
268  public function testApiParamFormatting( $key, $value, $expected ) {
269  $entry = $this->newLogEntry( 'param', [ $key => $value ] );
270  $formatter = LogFormatter::newFromEntry( $entry );
271  $formatter->setContext( $this->context );
272 
273  ApiResult::setIndexedTagName( $expected, 'param' );
274  ApiResult::setArrayType( $expected, 'assoc' );
275 
276  $this->assertEquals( $expected, $formatter->formatParametersForApi() );
277  }
278 
279  public static function provideApiParamFormatting() {
280  return [
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 ] ],
291  [ '4:array:key', [], [ 'key' => [ ApiResult::META_TYPE => 'array' ] ] ],
292  [ '4:assoc:key', [], [ 'key' => [ ApiResult::META_TYPE => 'assoc' ] ] ],
293  [ '4:kvp:key', [], [ 'key' => [ ApiResult::META_TYPE => 'kvp' ] ] ],
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(),
298  ] ],
299  [ '4:msg-content:key', 'parentheses', [
300  'key_key' => 'parentheses',
301  'key_text' => wfMessage( 'parentheses' )->inContentLanguage()->text(),
302  ] ],
303  [ '4:title:key', 'project:foo', [
304  'key_ns' => NS_PROJECT,
305  'key_title' => Title::newFromText( 'project:foo' )->getFullText(),
306  ] ],
307  [ '4:title-link:key', 'project:foo', [
308  'key_ns' => NS_PROJECT,
309  'key_title' => Title::newFromText( 'project:foo' )->getFullText(),
310  ] ],
311  [ '4:title-link:key', '<invalid>', [
312  'key_ns' => NS_SPECIAL,
313  'key_title' => SpecialPage::getTitleFor( 'Badtitle', '<invalid>' )->getFullText(),
314  ] ],
315  [ '4:user:key', 'foo', [ 'key' => 'Foo' ] ],
316  [ '4:user-link:key', 'foo', [ 'key' => 'Foo' ] ],
317  ];
318  }
319 
362  public function testIrcMsgForLogTypeBlock() {
363  $sep = $this->context->msg( 'colon-separator' )->text();
364 
365  # block/block
366  $this->assertIRCComment(
367  $this->context->msg( 'blocklogentry', 'SomeTitle', 'duration', '(flags)' )->plain()
368  . $sep . $this->user_comment,
369  'block', 'block',
370  [
371  '5::duration' => 'duration',
372  '6::flags' => 'flags',
373  ],
375  );
376  # block/block - legacy
377  $this->assertIRCComment(
378  $this->context->msg( 'blocklogentry', 'SomeTitle', 'duration', '(flags)' )->plain()
379  . $sep . $this->user_comment,
380  'block', 'block',
381  [
382  'duration',
383  'flags',
384  ],
386  '',
387  true
388  );
389  # block/unblock
390  $this->assertIRCComment(
391  $this->context->msg( 'unblocklogentry', 'SomeTitle' )->plain() . $sep . $this->user_comment,
392  'block', 'unblock',
393  [],
395  );
396  # block/reblock
397  $this->assertIRCComment(
398  $this->context->msg( 'reblock-logentry', 'SomeTitle', 'duration', '(flags)' )->plain()
399  . $sep . $this->user_comment,
400  'block', 'reblock',
401  [
402  '5::duration' => 'duration',
403  '6::flags' => 'flags',
404  ],
406  );
407  }
408 
413  public function testIrcMsgForLogTypeDelete() {
414  $sep = $this->context->msg( 'colon-separator' )->text();
415 
416  # delete/delete
417  $this->assertIRCComment(
418  $this->context->msg( 'deletedarticle', 'SomeTitle' )->plain() . $sep . $this->user_comment,
419  'delete', 'delete',
420  [],
422  );
423 
424  # delete/restore
425  $this->assertIRCComment(
426  $this->context->msg( 'undeletedarticle', 'SomeTitle' )->plain() . $sep . $this->user_comment,
427  'delete', 'restore',
428  [],
430  );
431  }
432 
437  public function testIrcMsgForLogTypeNewusers() {
438  $this->assertIRCComment(
439  'New user account',
440  'newusers', 'newusers',
441  []
442  );
443  $this->assertIRCComment(
444  'New user account',
445  'newusers', 'create',
446  []
447  );
448  $this->assertIRCComment(
449  'created new account SomeTitle',
450  'newusers', 'create2',
451  []
452  );
453  $this->assertIRCComment(
454  'Account created automatically',
455  'newusers', 'autocreate',
456  []
457  );
458  }
459 
464  public function testIrcMsgForLogTypeMove() {
465  $move_params = [
466  '4::target' => $this->target->getPrefixedText(),
467  '5::noredir' => 0,
468  ];
469  $sep = $this->context->msg( 'colon-separator' )->text();
470 
471  # move/move
472  $this->assertIRCComment(
473  $this->context->msg( '1movedto2', 'SomeTitle', 'TestTarget' )
474  ->plain() . $sep . $this->user_comment,
475  'move', 'move',
476  $move_params,
478  );
479 
480  # move/move_redir
481  $this->assertIRCComment(
482  $this->context->msg( '1movedto2_redir', 'SomeTitle', 'TestTarget' )
483  ->plain() . $sep . $this->user_comment,
484  'move', 'move_redir',
485  $move_params,
487  );
488  }
489 
494  public function testIrcMsgForLogTypePatrol() {
495  # patrol/patrol
496  $this->assertIRCComment(
497  $this->context->msg( 'patrol-log-line', 'revision 777', '[[SomeTitle]]', '' )->plain(),
498  'patrol', 'patrol',
499  [
500  '4::curid' => '777',
501  '5::previd' => '666',
502  '6::auto' => 0,
503  ]
504  );
505  }
506 
511  public function testIrcMsgForLogTypeProtect() {
512  $protectParams = [
513  '4::description' => '[edit=sysop] (indefinite) ‎[move=sysop] (indefinite)'
514  ];
515  $sep = $this->context->msg( 'colon-separator' )->text();
516 
517  # protect/protect
518  $this->assertIRCComment(
519  $this->context->msg( 'protectedarticle', 'SomeTitle ' . $protectParams['4::description'] )
520  ->plain() . $sep . $this->user_comment,
521  'protect', 'protect',
522  $protectParams,
524  );
525 
526  # protect/unprotect
527  $this->assertIRCComment(
528  $this->context->msg( 'unprotectedarticle', 'SomeTitle' )->plain() . $sep . $this->user_comment,
529  'protect', 'unprotect',
530  [],
532  );
533 
534  # protect/modify
535  $this->assertIRCComment(
536  $this->context->msg(
537  'modifiedarticleprotection',
538  'SomeTitle ' . $protectParams['4::description']
539  )->plain() . $sep . $this->user_comment,
540  'protect', 'modify',
541  $protectParams,
543  );
544 
545  # protect/move_prot
546  $this->assertIRCComment(
547  $this->context->msg( 'movedarticleprotection', 'SomeTitle', 'OldTitle' )
548  ->plain() . $sep . $this->user_comment,
549  'protect', 'move_prot',
550  [
551  '4::oldtitle' => 'OldTitle'
552  ],
554  );
555  }
556 
561  public function testIrcMsgForLogTypeUpload() {
562  $sep = $this->context->msg( 'colon-separator' )->text();
563 
564  # upload/upload
565  $this->assertIRCComment(
566  $this->context->msg( 'uploadedimage', 'SomeTitle' )->plain() . $sep . $this->user_comment,
567  'upload', 'upload',
568  [],
570  );
571 
572  # upload/overwrite
573  $this->assertIRCComment(
574  $this->context->msg( 'overwroteimage', 'SomeTitle' )->plain() . $sep . $this->user_comment,
575  'upload', 'overwrite',
576  [],
578  );
579  }
580 
585  public function testIrcMsgForLogTypeMerge() {
586  $sep = $this->context->msg( 'colon-separator' )->text();
587 
588  # merge/merge
589  $this->assertIRCComment(
590  $this->context->msg( 'pagemerge-logentry', 'SomeTitle', 'Dest', 'timestamp' )->plain()
591  . $sep . $this->user_comment,
592  'merge', 'merge',
593  [
594  '4::dest' => 'Dest',
595  '5::mergepoint' => 'timestamp',
596  ],
598  );
599  }
600 
605  public function testIrcMsgForLogTypeImport() {
606  $sep = $this->context->msg( 'colon-separator' )->text();
607 
608  # import/upload
609  $msg = $this->context->msg( 'import-logentry-upload', 'SomeTitle' )->plain() .
610  $sep .
612  $this->assertIRCComment(
613  $msg,
614  'import', 'upload',
615  [],
616  $this->user_comment
617  );
618 
619  # import/interwiki
620  $msg = $this->context->msg( 'import-logentry-interwiki', 'SomeTitle' )->plain() .
621  $sep .
623  $this->assertIRCComment(
624  $msg,
625  'import', 'interwiki',
626  [],
627  $this->user_comment
628  );
629  }
630 
639  protected function assertIRCComment( $expected, $type, $action, $params,
640  $comment = null, $msg = '', $legacy = false
641  ) {
642  $logEntry = new ManualLogEntry( $type, $action );
643  $logEntry->setPerformer( $this->user );
644  $logEntry->setTarget( $this->title );
645  if ( $comment !== null ) {
646  $logEntry->setComment( $comment );
647  }
648  $logEntry->setParameters( $params );
649  $logEntry->setLegacy( $legacy );
650 
651  $formatter = LogFormatter::newFromEntry( $logEntry );
652  $formatter->setContext( $this->context );
653 
654  // Apply the same transformation as done in IRCColourfulRCFeedFormatter::getLine for rc_comment
655  $ircRcComment = IRCColourfulRCFeedFormatter::cleanupForIRC( $formatter->getIRCActionComment() );
656 
657  $this->assertEquals(
658  $expected,
659  $ircRcComment,
660  $msg
661  );
662  }
663 
664 }
LogFormatterTest
Database.
Definition: LogFormatterTest.php:6
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:273
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
Linker\userToolLinksRedContribs
static userToolLinksRedContribs( $userId, $userText, $edits=null)
Alias for userToolLinks( $userId, $userText, true );.
Definition: Linker.php:993
LogFormatterTest\$user_comment
string $user_comment
Definition: LogFormatterTest.php:32
LogFormatterTest\testLogParamsTypeNumber
testLogParamsTypeNumber()
LogFormatter::newFromEntry LogFormatter::getActionText.
Definition: LogFormatterTest.php:180
LogFormatterTest\setUp
setUp()
Definition: LogFormatterTest.php:51
Linker\userLink
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
Definition: Linker.php:893
LogFormatterTest\testIrcMsgForLogTypeProtect
testIrcMsgForLogTypeProtect()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
Definition: LogFormatterTest.php:511
LogFormatterTest\testLogParamsTypeUserLink
testLogParamsTypeUserLink()
LogFormatter::newFromEntry LogFormatter::getActionText.
Definition: LogFormatterTest.php:199
ApiResult\META_TYPE
const META_TYPE
Key for the 'type' metadata item.
Definition: ApiResult.php:108
LogFormatterTest\testLogComment
testLogComment()
LogFormatter::newFromEntry LogFormatter::getComment.
Definition: LogFormatterTest.php:253
LogFormatterTest\newLogEntry
newLogEntry( $action, $params)
Definition: LogFormatterTest.php:73
LogFormatterTest\testLogParamsTypeTitleLink
testLogParamsTypeTitleLink()
LogFormatter::newFromEntry LogFormatter::getActionText.
Definition: LogFormatterTest.php:219
LogFormatterTest\$title
Title $title
Definition: LogFormatterTest.php:17
LogFormatterTest\testIrcMsgForLogTypeImport
testIrcMsgForLogTypeImport()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
Definition: LogFormatterTest.php:605
$params
$params
Definition: styleTest.css.php:40
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:591
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition: SpecialPage.php:82
LogFormatterTest\testLogParamsTypeMsgContent
testLogParamsTypeMsgContent()
LogFormatter::newFromEntry LogFormatter::getActionText.
Definition: LogFormatterTest.php:163
LogFormatterTest\testLogParamsTypeMsg
testLogParamsTypeMsg()
LogFormatter::newFromEntry LogFormatter::getActionText.
Definition: LogFormatterTest.php:146
php
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
Definition: injection.txt:35
LogFormatterTest\testIrcMsgForLogTypeMove
testIrcMsgForLogTypeMove()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
Definition: LogFormatterTest.php:464
LogFormatterTest\$context
RequestContext $context
Definition: LogFormatterTest.php:22
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:54
ApiResult\setArrayType
static setArrayType(array &$arr, $type, $kvpKeyName=null)
Set the array data type.
Definition: ApiResult.php:728
Language\getLocalisationCache
static getLocalisationCache()
Get the LocalisationCache instance.
Definition: Language.php:406
NS_PROJECT
const NS_PROJECT
Definition: Defines.php:69
user
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
Definition: distributors.txt:9
LogFormatterTest\$oldExtMsgFiles
static $oldExtMsgFiles
Definition: LogFormatterTest.php:7
LogFormatterTest\$user
User $user
Definition: LogFormatterTest.php:12
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
Definition: MediaWikiTestCase.php:678
LogFormatterTest\testIrcMsgForLogTypeBlock
testIrcMsgForLogTypeBlock()
The testIrcMsgForAction* tests are supposed to cover the hacky LogFormatter::getIRCActionText / T3650...
Definition: LogFormatterTest.php:362
$wgLang
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
Definition: design.txt:56
LogFormatterTest\assertIRCComment
assertIRCComment( $expected, $type, $action, $params, $comment=null, $msg='', $legacy=false)
Definition: LogFormatterTest.php:639
LogFormatterTest\$target
Title $target
Definition: LogFormatterTest.php:27
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
RequestContext
Group all the pieces relevant to the context of a request into one instance.
Definition: RequestContext.php:32
LogFormatterTest\testIrcMsgForLogTypePatrol
testIrcMsgForLogTypePatrol()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
Definition: LogFormatterTest.php:494
LogFormatterTest\testLogParamsTypeRaw
testLogParamsTypeRaw()
LogFormatter::newFromEntry LogFormatter::getActionText.
Definition: LogFormatterTest.php:129
ApiResult\setIndexedTagName
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:616
$value
$value
Definition: styleTest.css.php:45
LogFormatterTest\testIrcMsgForLogTypeDelete
testIrcMsgForLogTypeDelete()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
Definition: LogFormatterTest.php:413
title
title
Definition: parserTests.txt:219
Linker\link
static link( $target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
Definition: Linker.php:107
MediaWikiLangTestCase
Base class that store and restore the Language objects.
Definition: MediaWikiLangTestCase.php:6
LogFormatterTest\setUpBeforeClass
static setUpBeforeClass()
Definition: LogFormatterTest.php:34
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:434
LogFormatterTest\testNormalLogParams
testNormalLogParams()
LogFormatter::newFromEntry.
Definition: LogFormatterTest.php:87
LogFormatterTest\provideApiParamFormatting
static provideApiParamFormatting()
Definition: LogFormatterTest.php:279
Title
Represents a title within MediaWiki.
Definition: Title.php:39
IRCColourfulRCFeedFormatter\cleanupForIRC
static cleanupForIRC( $text)
Remove newlines, carriage returns and decode html entites.
Definition: IRCColourfulRCFeedFormatter.php:136
$wgExtensionMessagesFiles
$wgExtensionMessagesFiles['ExtensionNameMagic']
Definition: magicword.txt:43
Linker\commentBlock
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...
Definition: Linker.php:1455
true
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
Definition: hooks.txt:1987
ManualLogEntry
Class for creating log entries manually, to inject them into the database.
Definition: LogEntry.php:432
wfMessage
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 "&lt
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
LogFormatterTest\testLogParamsTypePlain
testLogParamsTypePlain()
LogFormatter::newFromEntry LogFormatter::getActionText.
Definition: LogFormatterTest.php:236
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:53
LogFormatterTest\testIrcMsgForLogTypeNewusers
testIrcMsgForLogTypeNewusers()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
Definition: LogFormatterTest.php:437
LogFormatterTest\testIrcMsgForLogTypeUpload
testIrcMsgForLogTypeUpload()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
Definition: LogFormatterTest.php:561
LogFormatterTest\testIrcMsgForLogTypeMerge
testIrcMsgForLogTypeMerge()
LogFormatter::getIRCActionComment LogFormatter::getIRCActionText.
Definition: LogFormatterTest.php:585
LogFormatterTest\tearDownAfterClass
static tearDownAfterClass()
Definition: LogFormatterTest.php:43
LogFormatterTest\testApiParamFormatting
testApiParamFormatting( $key, $value, $expected)
provideApiParamFormatting LogFormatter::formatParametersForApi LogFormatter::formatParameterValueForA...
Definition: LogFormatterTest.php:268
LogFormatter\newFromEntry
static newFromEntry(LogEntry $entry)
Constructs a new formatter suitable for given entry.
Definition: LogFormatter.php:50
$type
$type
Definition: testCompression.php:48