MediaWiki  1.32.0
ArticleViewTest.php
Go to the documentation of this file.
1 <?php
6 use PHPUnit\Framework\MockObject\MockObject;
7 
12 
13  protected function setUp() {
14  parent::setUp();
15 
16  $this->setUserLang( 'qqx' );
17  }
18 
19  private function getHtml( OutputPage $output ) {
20  return preg_replace( '/<!--.*?-->/s', '', $output->getHTML() );
21  }
22 
32  private function getPage( $title, array $revisionContents = [], array &$revisions = [] ) {
33  if ( is_string( $title ) ) {
35  }
36 
37  $page = WikiPage::factory( $title );
38 
39  $user = $this->getTestUser()->getUser();
40 
41  foreach ( $revisionContents as $key => $cont ) {
42  if ( is_string( $cont ) ) {
43  $cont = new WikitextContent( $cont );
44  }
45 
46  $u = $page->newPageUpdater( $user );
47  $u->setContent( SlotRecord::MAIN, $cont );
48  $rev = $u->saveRevision( CommentStoreComment::newUnsavedComment( 'Rev ' . $key ) );
49 
50  $revisions[ $key ] = $rev;
51  }
52 
53  return $page;
54  }
55 
60  public function testGetOldId() {
61  $revisions = [];
62  $page = $this->getPage( __METHOD__, [ 1 => 'Test A', 2 => 'Test B' ], $revisions );
63 
64  $idA = $revisions[1]->getId();
65  $idB = $revisions[2]->getId();
66 
67  // oldid in constructor
68  $article = new Article( $page->getTitle(), $idA );
69  $this->assertSame( $idA, $article->getOldID() );
70  $article->getRevisionFetched();
71  $this->assertSame( $idA, $article->getRevIdFetched() );
72 
73  // oldid 0 in constructor
74  $article = new Article( $page->getTitle(), 0 );
75  $this->assertSame( 0, $article->getOldID() );
76  $article->getRevisionFetched();
77  $this->assertSame( $idB, $article->getRevIdFetched() );
78 
79  // oldid in request
80  $article = new Article( $page->getTitle() );
81  $context = new RequestContext();
82  $context->setRequest( new FauxRequest( [ 'oldid' => $idA ] ) );
84  $this->assertSame( $idA, $article->getOldID() );
85  $article->getRevisionFetched();
86  $this->assertSame( $idA, $article->getRevIdFetched() );
87 
88  // no oldid
89  $article = new Article( $page->getTitle() );
90  $context = new RequestContext();
91  $context->setRequest( new FauxRequest( [] ) );
93  $this->assertSame( 0, $article->getOldID() );
94  $article->getRevisionFetched();
95  $this->assertSame( $idB, $article->getRevIdFetched() );
96  }
97 
98  public function testView() {
99  $page = $this->getPage( __METHOD__, [ 1 => 'Test A', 2 => 'Test B' ] );
100 
101  $article = new Article( $page->getTitle(), 0 );
102  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
103  $article->view();
104 
105  $output = $article->getContext()->getOutput();
106  $this->assertContains( 'Test B', $this->getHtml( $output ) );
107  $this->assertNotContains( 'id="mw-revision-info"', $this->getHtml( $output ) );
108  $this->assertNotContains( 'id="mw-revision-nav"', $this->getHtml( $output ) );
109  }
110 
111  public function testViewCached() {
112  $page = $this->getPage( __METHOD__, [ 1 => 'Test A', 2 => 'Test B' ] );
113 
114  $po = new ParserOutput( 'Cached Text' );
115 
116  $article = new Article( $page->getTitle(), 0 );
117  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
118 
119  $cache = MediaWikiServices::getInstance()->getParserCache();
120  $cache->save( $po, $page, $article->getParserOptions() );
121 
122  $article->view();
123 
124  $output = $article->getContext()->getOutput();
125  $this->assertContains( 'Cached Text', $this->getHtml( $output ) );
126  $this->assertNotContains( 'Test A', $this->getHtml( $output ) );
127  $this->assertNotContains( 'Test B', $this->getHtml( $output ) );
128  }
129 
133  public function testViewRedirect() {
134  $target = Title::makeTitle( $this->getDefaultWikitextNS(), 'Test_Target' );
135  $redirectText = '#REDIRECT [[' . $target->getPrefixedText() . ']]';
136 
137  $page = $this->getPage( __METHOD__, [ $redirectText ] );
138 
139  $article = new Article( $page->getTitle(), 0 );
140  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
141  $article->view();
142 
143  $this->assertNotNull(
144  $article->getRedirectTarget()->getPrefixedDBkey()
145  );
146  $this->assertSame(
147  $target->getPrefixedDBkey(),
148  $article->getRedirectTarget()->getPrefixedDBkey()
149  );
150 
151  $output = $article->getContext()->getOutput();
152  $this->assertContains( 'class="redirectText"', $this->getHtml( $output ) );
153  $this->assertContains(
154  '>' . htmlspecialchars( $target->getPrefixedText() ) . '<',
155  $this->getHtml( $output )
156  );
157  }
158 
159  public function testViewNonText() {
160  $dummy = $this->getPage( __METHOD__, [ 'Dummy' ] );
161  $dummyRev = $dummy->getRevision()->getRevisionRecord();
162  $title = $dummy->getTitle();
163 
165  $mockHandler = $this->getMockBuilder( ContentHandler::class )
166  ->setMethods(
167  [
168  'isParserCacheSupported',
169  'serializeContent',
170  'unserializeContent',
171  'makeEmptyContent',
172  ]
173  )
174  ->setConstructorArgs( [ 'NotText', [ 'application/frobnitz' ] ] )
175  ->getMock();
176 
177  $mockHandler->method( 'isParserCacheSupported' )
178  ->willReturn( false );
179 
180  $this->setTemporaryHook(
181  'ContentHandlerForModelID',
182  function ( $id, &$handler ) use ( $mockHandler ) {
183  $handler = $mockHandler;
184  }
185  );
186 
188  $content = $this->getMock( Content::class );
189  $content->method( 'getParserOutput' )
190  ->willReturn( new ParserOutput( 'Structured Output' ) );
191  $content->method( 'getModel' )
192  ->willReturn( 'NotText' );
193  $content->method( 'getNativeData' )
194  ->willReturn( [ (object)[ 'x' => 'stuff' ] ] );
195  $content->method( 'copy' )
196  ->willReturn( $content );
197 
199  $rev->setId( $dummyRev->getId() );
200  $rev->setPageId( $title->getArticleID() );
201  $rev->setUser( $dummyRev->getUser() );
202  $rev->setComment( $dummyRev->getComment() );
203  $rev->setTimestamp( $dummyRev->getTimestamp() );
204 
205  $rev->setContent( SlotRecord::MAIN, $content );
206 
207  $rev = new Revision( $rev );
208 
210  $page = $this->getMockBuilder( WikiPage::class )
211  ->setMethods( [ 'getRevision', 'getLatest' ] )
212  ->setConstructorArgs( [ $title ] )
213  ->getMock();
214 
215  $page->method( 'getRevision' )
216  ->willReturn( $rev );
217  $page->method( 'getLatest' )
218  ->willReturn( $rev->getId() );
219 
221  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
222  $article->view();
223 
224  $output = $article->getContext()->getOutput();
225  $this->assertContains( 'Structured Output', $this->getHtml( $output ) );
226  $this->assertNotContains( 'Dummy', $this->getHtml( $output ) );
227  }
228 
229  public function testViewOfOldRevision() {
230  $revisions = [];
231  $page = $this->getPage( __METHOD__, [ 1 => 'Test A', 2 => 'Test B' ], $revisions );
232  $idA = $revisions[1]->getId();
233 
234  $article = new Article( $page->getTitle(), $idA );
235  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
236  $article->view();
237 
238  $output = $article->getContext()->getOutput();
239  $this->assertContains( 'Test A', $this->getHtml( $output ) );
240  $this->assertContains( 'id="mw-revision-info"', $output->getSubtitle() );
241  $this->assertContains( 'id="mw-revision-nav"', $output->getSubtitle() );
242 
243  $this->assertNotContains( 'id="revision-info-current"', $output->getSubtitle() );
244  $this->assertNotContains( 'Test B', $this->getHtml( $output ) );
245  }
246 
247  public function testViewOfCurrentRevision() {
248  $revisions = [];
249  $page = $this->getPage( __METHOD__, [ 1 => 'Test A', 2 => 'Test B' ], $revisions );
250  $idB = $revisions[2]->getId();
251 
252  $article = new Article( $page->getTitle(), $idB );
253  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
254  $article->view();
255 
256  $output = $article->getContext()->getOutput();
257  $this->assertContains( 'Test B', $this->getHtml( $output ) );
258  $this->assertContains( 'id="mw-revision-info-current"', $output->getSubtitle() );
259  $this->assertContains( 'id="mw-revision-nav"', $output->getSubtitle() );
260  }
261 
262  public function testViewOfMissingRevision() {
263  $revisions = [];
264  $page = $this->getPage( __METHOD__, [ 1 => 'Test A' ], $revisions );
265  $badId = $revisions[1]->getId() + 100;
266 
267  $article = new Article( $page->getTitle(), $badId );
268  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
269  $article->view();
270 
271  $output = $article->getContext()->getOutput();
272  $this->assertContains( 'missing-revision: ' . $badId, $this->getHtml( $output ) );
273 
274  $this->assertNotContains( 'Test A', $this->getHtml( $output ) );
275  }
276 
277  public function testViewOfDeletedRevision() {
278  $revisions = [];
279  $page = $this->getPage( __METHOD__, [ 1 => 'Test A', 2 => 'Test B' ], $revisions );
280  $idA = $revisions[1]->getId();
281 
282  $revDelList = new RevDelRevisionList(
283  RequestContext::getMain(), $page->getTitle(), [ $idA ]
284  );
285  $revDelList->setVisibility( [
286  'value' => [ RevisionRecord::DELETED_TEXT => 1 ],
287  'comment' => "Testing",
288  ] );
289 
290  $article = new Article( $page->getTitle(), $idA );
291  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
292  $article->view();
293 
294  $output = $article->getContext()->getOutput();
295  $this->assertContains( '(rev-deleted-text-permission)', $this->getHtml( $output ) );
296 
297  $this->assertNotContains( 'Test A', $this->getHtml( $output ) );
298  $this->assertNotContains( 'Test B', $this->getHtml( $output ) );
299  }
300 
302  $revisions = [];
303  $page = $this->getPage( __METHOD__, [ 1 => 'Test A', 2 => 'Test B' ], $revisions );
304  $idA = $revisions[1]->getId();
305 
306  $revDelList = new RevDelRevisionList(
307  RequestContext::getMain(), $page->getTitle(), [ $idA ]
308  );
309  $revDelList->setVisibility( [
310  'value' => [ RevisionRecord::DELETED_TEXT => 1 ],
311  'comment' => "Testing",
312  ] );
313 
314  $article = new Article( $page->getTitle(), $idA );
317  $context->getOutput()->setTitle( $page->getTitle() );
318  $context->getRequest()->setVal( 'unhide', 1 );
319  $context->setUser( $this->getTestUser( [ 'sysop' ] )->getUser() );
320  $article->view();
321 
322  $output = $article->getContext()->getOutput();
323  $this->assertContains( '(rev-deleted-text-view)', $this->getHtml( $output ) );
324 
325  $this->assertContains( 'Test A', $this->getHtml( $output ) );
326  $this->assertNotContains( 'Test B', $this->getHtml( $output ) );
327  }
328 
329  public function testViewMissingPage() {
330  $page = $this->getPage( __METHOD__ );
331 
332  $article = new Article( $page->getTitle() );
333  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
334  $article->view();
335 
336  $output = $article->getContext()->getOutput();
337  $this->assertContains( '(noarticletextanon)', $this->getHtml( $output ) );
338  }
339 
340  public function testViewDeletedPage() {
341  $page = $this->getPage( __METHOD__, [ 1 => 'Test A', 2 => 'Test B' ] );
342  $page->doDeleteArticle( 'Test' );
343 
344  $article = new Article( $page->getTitle() );
345  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
346  $article->view();
347 
348  $output = $article->getContext()->getOutput();
349  $this->assertContains( 'moveddeleted', $this->getHtml( $output ) );
350  $this->assertContains( 'logentry-delete-delete', $this->getHtml( $output ) );
351  $this->assertContains( '(noarticletextanon)', $this->getHtml( $output ) );
352 
353  $this->assertNotContains( 'Test A', $this->getHtml( $output ) );
354  $this->assertNotContains( 'Test B', $this->getHtml( $output ) );
355  }
356 
357  public function testViewMessagePage() {
358  $title = Title::makeTitle( NS_MEDIAWIKI, 'Mainpage' );
359  $page = $this->getPage( $title );
360 
361  $article = new Article( $page->getTitle() );
362  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
363  $article->view();
364 
365  $output = $article->getContext()->getOutput();
366  $this->assertContains(
367  wfMessage( 'mainpage' )->inContentLanguage()->parse(),
368  $this->getHtml( $output )
369  );
370  $this->assertNotContains( '(noarticletextanon)', $this->getHtml( $output ) );
371  }
372 
373  public function testViewMissingUserPage() {
374  $user = $this->getTestUser()->getUser();
375  $user->addToDatabase();
376 
377  $title = Title::makeTitle( NS_USER, $user->getName() );
378 
379  $page = $this->getPage( $title );
380 
381  $article = new Article( $page->getTitle() );
382  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
383  $article->view();
384 
385  $output = $article->getContext()->getOutput();
386  $this->assertContains( '(noarticletextanon)', $this->getHtml( $output ) );
387  $this->assertNotContains( '(userpage-userdoesnotexist-view)', $this->getHtml( $output ) );
388  }
389 
391  $user = User::newFromName( 'Testing ' . __METHOD__ );
392 
393  $title = Title::makeTitle( NS_USER, $user->getName() );
394 
395  $page = $this->getPage( $title );
396 
397  $article = new Article( $page->getTitle() );
398  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
399  $article->view();
400 
401  $output = $article->getContext()->getOutput();
402  $this->assertContains( '(noarticletextanon)', $this->getHtml( $output ) );
403  $this->assertContains( '(userpage-userdoesnotexist-view:', $this->getHtml( $output ) );
404  }
405 
406  public function testArticleViewHeaderHook() {
407  $page = $this->getPage( __METHOD__, [ 1 => 'Test A' ] );
408 
409  $article = new Article( $page->getTitle(), 0 );
410  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
411 
412  $this->setTemporaryHook(
413  'ArticleViewHeader',
414  function ( Article $articlePage, &$outputDone, &$useParserCache ) use ( $article ) {
415  $this->assertSame( $article, $articlePage, '$articlePage' );
416 
417  $outputDone = new ParserOutput( 'Hook Text' );
418  $outputDone->setTitleText( 'Hook Title' );
419 
420  $articlePage->getContext()->getOutput()->addParserOutput( $outputDone );
421  }
422  );
423 
424  $article->view();
425 
426  $output = $article->getContext()->getOutput();
427  $this->assertNotContains( 'Test A', $this->getHtml( $output ) );
428  $this->assertContains( 'Hook Text', $this->getHtml( $output ) );
429  $this->assertSame( 'Hook Title', $output->getPageTitle() );
430  }
431 
433  $page = $this->getPage( __METHOD__, [ 1 => 'Test A' ] );
434 
435  $article = new Article( $page->getTitle(), 0 );
436  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
437 
438  // use ArticleViewHeader hook to bypass the parser cache
439  $this->setTemporaryHook(
440  'ArticleViewHeader',
441  function ( Article $articlePage, &$outputDone, &$useParserCache ) use ( $article ) {
442  $useParserCache = false;
443  }
444  );
445 
446  $this->setTemporaryHook(
447  'ArticleContentViewCustom',
448  function ( Content $content, Title $title, OutputPage $output ) use ( $page ) {
449  $this->assertSame( $page->getTitle(), $title, '$title' );
450  $this->assertSame( 'Test A', $content->getNativeData(), '$content' );
451 
452  $output->addHTML( 'Hook Text' );
453  return false;
454  }
455  );
456 
457  $this->hideDeprecated(
458  'ArticleContentViewCustom hook (used in hook-ArticleContentViewCustom-closure)'
459  );
460 
461  $article->view();
462 
463  $output = $article->getContext()->getOutput();
464  $this->assertNotContains( 'Test A', $this->getHtml( $output ) );
465  $this->assertContains( 'Hook Text', $this->getHtml( $output ) );
466  }
467 
469  $page = $this->getPage( __METHOD__, [ 1 => 'Test A' ] );
470 
471  $article = new Article( $page->getTitle(), 0 );
472  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
473 
474  // use ArticleViewHeader hook to bypass the parser cache
475  $this->setTemporaryHook(
476  'ArticleViewHeader',
477  function ( Article $articlePage, &$outputDone, &$useParserCache ) use ( $article ) {
478  $useParserCache = false;
479  }
480  );
481 
482  $this->setTemporaryHook(
483  'ArticleRevisionViewCustom',
484  function ( RevisionRecord $rev, Title $title, $oldid, OutputPage $output ) use ( $page ) {
485  $content = $rev->getContent( SlotRecord::MAIN );
486 
487  $this->assertSame( $page->getTitle(), $title, '$title' );
488  $this->assertSame( 'Test A', $content->getNativeData(), '$content' );
489 
490  $output->addHTML( 'Hook Text' );
491  return false;
492  }
493  );
494 
495  $article->view();
496 
497  $output = $article->getContext()->getOutput();
498  $this->assertNotContains( 'Test A', $this->getHtml( $output ) );
499  $this->assertContains( 'Hook Text', $this->getHtml( $output ) );
500  }
501 
503  $page = $this->getPage( __METHOD__, [ 1 => 'Test A' ] );
504 
505  $article = new Article( $page->getTitle(), 0 );
506  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
507 
508  // use ArticleViewHeader hook to bypass the parser cache
509  $this->setTemporaryHook(
510  'ArticleViewHeader',
511  function ( Article $articlePage, &$outputDone, &$useParserCache ) use ( $article ) {
512  $useParserCache = false;
513  }
514  );
515 
516  $this->setTemporaryHook(
517  'ArticleAfterFetchContentObject',
518  function ( Article &$articlePage, Content &$content ) use ( $page, $article ) {
519  $this->assertSame( $article, $articlePage, '$articlePage' );
520  $this->assertSame( 'Test A', $content->getNativeData(), '$content' );
521 
522  $content = new WikitextContent( 'Hook Text' );
523  }
524  );
525 
526  $this->hideDeprecated(
527  'ArticleAfterFetchContentObject hook'
528  . ' (used in hook-ArticleAfterFetchContentObject-closure)'
529  );
530 
531  $article->view();
532 
533  $output = $article->getContext()->getOutput();
534  $this->assertNotContains( 'Test A', $this->getHtml( $output ) );
535  $this->assertContains( 'Hook Text', $this->getHtml( $output ) );
536  }
537 
538  public function testShowMissingArticleHook() {
539  $page = $this->getPage( __METHOD__ );
540 
541  $article = new Article( $page->getTitle() );
542  $article->getContext()->getOutput()->setTitle( $page->getTitle() );
543 
544  $this->setTemporaryHook(
545  'ShowMissingArticle',
546  function ( Article $articlePage ) use ( $article ) {
547  $this->assertSame( $article, $articlePage, '$articlePage' );
548 
549  $articlePage->getContext()->getOutput()->addHTML( 'Hook Text' );
550  }
551  );
552 
553  $article->view();
554 
555  $output = $article->getContext()->getOutput();
556  $this->assertContains( '(noarticletextanon)', $this->getHtml( $output ) );
557  $this->assertContains( 'Hook Text', $this->getHtml( $output ) );
558  }
559 
560 }
ArticleViewTest\testArticleContentViewCustomHook
testArticleContentViewCustomHook()
Definition: ArticleViewTest.php:432
ArticleViewTest\getHtml
getHtml(OutputPage $output)
Definition: ArticleViewTest.php:19
CommentStoreComment\newUnsavedComment
static newUnsavedComment( $comment, array $data=null)
Create a new, unsaved CommentStoreComment.
Definition: CommentStoreComment.php:66
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:244
ArticleViewTest\testViewRedirect
testViewRedirect()
Article::getRedirectTarget()
Definition: ArticleViewTest.php:133
$article
return true to allow those checks to and false if checking is done remove or add to the links of a group of changes in EnhancedChangesList Hook subscribers can return false to omit this line from recentchanges use this to change the tables headers change it to an object instance and return false override the list derivative used the name of the old file & $article
Definition: hooks.txt:1515
ArticleViewTest\testViewOfCurrentRevision
testViewOfCurrentRevision()
Definition: ArticleViewTest.php:247
FauxRequest
WebRequest clone which takes values from a provided array.
Definition: FauxRequest.php:33
ArticleViewTest\testViewMessagePage
testViewMessagePage()
Definition: ArticleViewTest.php:357
ContextSource\getContext
getContext()
Get the base IContextSource object.
Definition: ContextSource.php:40
Revision\RevisionRecord
Page revision base class.
Definition: RevisionRecord.php:45
ParserOutput
Definition: ParserOutput.php:25
$context
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition: hooks.txt:2675
ArticleViewTest\testViewMissingUserPage
testViewMissingUserPage()
Definition: ArticleViewTest.php:373
MediaWikiTestCase\getTestUser
static getTestUser( $groups=[])
Convenience method for getting an immutable test user.
Definition: MediaWikiTestCase.php:179
ArticleViewTest\testArticleRevisionViewCustomHook
testArticleRevisionViewCustomHook()
Definition: ArticleViewTest.php:468
ArticleViewTest\testArticleAfterFetchContentObjectHook
testArticleAfterFetchContentObjectHook()
Definition: ArticleViewTest.php:502
ArticleViewTest
\Article::view()
Definition: ArticleViewTest.php:11
ArticleViewTest\testUnhiddenViewOfDeletedRevision
testUnhiddenViewOfDeletedRevision()
Definition: ArticleViewTest.php:301
ArticleViewTest\setUp
setUp()
Definition: ArticleViewTest.php:13
ArticleViewTest\testViewOfMissingRevision
testViewOfMissingRevision()
Definition: ArticleViewTest.php:262
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:592
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
ArticleViewTest\testArticleViewHeaderHook
testArticleViewHeaderHook()
Definition: ArticleViewTest.php:406
Revision
Definition: Revision.php:41
RevDelList\setVisibility
setVisibility(array $params)
Set the visibility for the revisions in this list.
Definition: RevDelList.php:108
ArticleViewTest\testViewOfDeletedRevision
testViewOfDeletedRevision()
Definition: ArticleViewTest.php:277
DerivativeContext
An IContextSource implementation which will inherit context from another source but allow individual ...
Definition: DerivativeContext.php:30
Article\newFromWikiPage
static newFromWikiPage(WikiPage $page, IContextSource $context)
Create an Article object of the appropriate class for the given page.
Definition: Article.php:192
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:964
WikiPage\factory
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
Definition: WikiPage.php:127
RevDelRevisionList
List for revision table items.
Definition: RevDelRevisionList.php:34
MediaWikiTestCase
Definition: MediaWikiTestCase.php:16
MediaWikiTestCase\hideDeprecated
hideDeprecated( $function)
Don't throw a warning if $function is deprecated and called later.
Definition: MediaWikiTestCase.php:1940
ArticleViewTest\testViewCached
testViewCached()
Definition: ArticleViewTest.php:111
Article\getContext
getContext()
Gets the context this Article is executed in.
Definition: Article.php:2232
use
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
Definition: MIT-LICENSE.txt:10
MediaWikiTestCase\getDefaultWikitextNS
getDefaultWikitextNS()
Returns the ID of a namespace that defaults to Wikitext.
Definition: MediaWikiTestCase.php:2177
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:545
$output
$output
Definition: SyntaxHighlight.php:334
ArticleViewTest\testViewMissingPage
testViewMissingPage()
Definition: ArticleViewTest.php:329
RequestContext
Group all the pieces relevant to the context of a request into one instance.
Definition: RequestContext.php:32
MediaWikiTestCase\setUserLang
setUserLang( $lang)
Definition: MediaWikiTestCase.php:1054
WikitextContent
Content object for wiki text pages.
Definition: WikitextContent.php:35
array
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))
ContextSource\setContext
setContext(IContextSource $context)
Definition: ContextSource.php:55
ArticleViewTest\testViewNonText
testViewNonText()
Definition: ArticleViewTest.php:159
Revision\MutableRevisionRecord
Mutable RevisionRecord implementation, for building new revision entries programmatically.
Definition: MutableRevisionRecord.php:41
ArticleViewTest\testShowMissingArticleHook
testShowMissingArticleHook()
Definition: ArticleViewTest.php:538
ArticleViewTest\testViewUserPageOfNonexistingUser
testViewUserPageOfNonexistingUser()
Definition: ArticleViewTest.php:390
ArticleViewTest\testGetOldId
testGetOldId()
Article::getOldId() Article::getRevIdFetched()
Definition: ArticleViewTest.php:60
$handler
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub 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 modifiable modifiable after all normalizations have been except for the $wgMaxImageArea check set to true or false to override the $wgMaxImageArea check result gives extension the possibility to transform it themselves $handler
Definition: hooks.txt:813
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:432
ArticleViewTest\getPage
getPage( $title, array $revisionContents=[], array &$revisions=[])
Definition: ArticleViewTest.php:32
Content
Base interface for content objects.
Definition: Content.php:34
Title
Represents a title within MediaWiki.
Definition: Title.php:39
$cache
$cache
Definition: mcc.php:33
ArticleViewTest\testView
testView()
Definition: ArticleViewTest.php:98
$rev
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
Definition: hooks.txt:1808
as
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
Definition: distributors.txt:9
NS_USER
const NS_USER
Definition: Defines.php:66
$content
$content
Definition: pageupdater.txt:72
NS_MEDIAWIKI
const NS_MEDIAWIKI
Definition: Defines.php:72
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
Article
Class for viewing MediaWiki article and history.
Definition: Article.php:38
MediaWikiTestCase\setTemporaryHook
setTemporaryHook( $hookName, $handler)
Create a temporary hook handler which will be reset by tearDown.
Definition: MediaWikiTestCase.php:2291
MediaWikiServices
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 MediaWikiServices
Definition: injection.txt:23
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 use $formDescriptor instead 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
ArticleViewTest\testViewDeletedPage
testViewDeletedPage()
Definition: ArticleViewTest.php:340
ArticleViewTest\testViewOfOldRevision
testViewOfOldRevision()
Definition: ArticleViewTest.php:229
Revision\SlotRecord
Value object representing a content slot associated with a page revision.
Definition: SlotRecord.php:39