MediaWiki  1.32.5
RevisionStoreTest.php
Go to the documentation of this file.
1 <?php
2 
4 
7 use InvalidArgumentException;
16 use Title;
20 use Wikimedia\TestingAccessWrapper;
22 
24 
25  private function useTextId() {
27 
29  }
30 
38  private function getRevisionStore(
39  $loadBalancer = null,
40  $blobStore = null,
41  $WANObjectCache = null
42  ) {
44  // the migration stage should be irrelevant, since all the tests that interact with
45  // the database are in RevisionStoreDbTest, not here.
46 
47  return new RevisionStore(
48  $loadBalancer ?: $this->getMockLoadBalancer(),
49  $blobStore ?: $this->getMockSqlBlobStore(),
50  $WANObjectCache ?: $this->getHashWANObjectCache(),
51  MediaWikiServices::getInstance()->getCommentStore(),
52  MediaWikiServices::getInstance()->getContentModelStore(),
53  MediaWikiServices::getInstance()->getSlotRoleStore(),
55  MediaWikiServices::getInstance()->getActorMigration()
56  );
57  }
58 
62  private function getMockLoadBalancer() {
63  return $this->getMockBuilder( LoadBalancer::class )
64  ->disableOriginalConstructor()->getMock();
65  }
66 
70  private function getMockDatabase() {
71  return $this->getMockBuilder( Database::class )
72  ->disableOriginalConstructor()->getMock();
73  }
74 
78  private function getMockSqlBlobStore() {
79  return $this->getMockBuilder( SqlBlobStore::class )
80  ->disableOriginalConstructor()->getMock();
81  }
82 
86  private function getMockCommentStore() {
87  return $this->getMockBuilder( CommentStore::class )
88  ->disableOriginalConstructor()->getMock();
89  }
90 
91  private function getHashWANObjectCache() {
92  return new WANObjectCache( [ 'cache' => new \HashBagOStuff() ] );
93  }
94 
95  public function provideSetContentHandlerUseDB() {
96  return [
97  // ContentHandlerUseDB can be true of false pre migration.
98  [ false, SCHEMA_COMPAT_OLD, false ],
99  [ true, SCHEMA_COMPAT_OLD, false ],
100  // During and after migration it can not be false...
103  [ false, SCHEMA_COMPAT_NEW, true ],
104  // ...but it can be true.
107  [ true, SCHEMA_COMPAT_NEW, false ],
108  ];
109  }
110 
116  public function testSetContentHandlerUseDB( $contentHandlerDb, $migrationMode, $expectedFail ) {
117  if ( $expectedFail ) {
118  $this->setExpectedException( MWException::class );
119  }
120 
121  $nameTables = MediaWikiServices::getInstance()->getNameTableStoreFactory();
122 
123  $store = new RevisionStore(
124  $this->getMockLoadBalancer(),
125  $this->getMockSqlBlobStore(),
126  $this->getHashWANObjectCache(),
127  $this->getMockCommentStore(),
128  $nameTables->getContentModels(),
129  $nameTables->getSlotRoles(),
130  $migrationMode,
131  MediaWikiServices::getInstance()->getActorMigration()
132  );
133 
134  $store->setContentHandlerUseDB( $contentHandlerDb );
135  $this->assertSame( $contentHandlerDb, $store->getContentHandlerUseDB() );
136  }
137 
138  public function testGetTitle_successFromPageId() {
139  $mockLoadBalancer = $this->getMockLoadBalancer();
140  // Title calls wfGetDB() so we have to set the main service
141  $this->setService( 'DBLoadBalancer', $mockLoadBalancer );
142 
143  $db = $this->getMockDatabase();
144  // Title calls wfGetDB() which uses a regular Connection
145  $mockLoadBalancer->expects( $this->atLeastOnce() )
146  ->method( 'getConnection' )
147  ->willReturn( $db );
148 
149  // First call to Title::newFromID, faking no result (db lag?)
150  $db->expects( $this->at( 0 ) )
151  ->method( 'selectRow' )
152  ->with(
153  'page',
154  $this->anything(),
155  [ 'page_id' => 1 ]
156  )
157  ->willReturn( (object)[
158  'page_namespace' => '1',
159  'page_title' => 'Food',
160  ] );
161 
162  $store = $this->getRevisionStore( $mockLoadBalancer );
163  $title = $store->getTitle( 1, 2, RevisionStore::READ_NORMAL );
164 
165  $this->assertSame( 1, $title->getNamespace() );
166  $this->assertSame( 'Food', $title->getDBkey() );
167  }
168 
170  $mockLoadBalancer = $this->getMockLoadBalancer();
171  // Title calls wfGetDB() so we have to set the main service
172  $this->setService( 'DBLoadBalancer', $mockLoadBalancer );
173 
174  $db = $this->getMockDatabase();
175  // Title calls wfGetDB() which uses a regular Connection
176  // Assert that the first call uses a REPLICA and the second falls back to master
177  $mockLoadBalancer->expects( $this->exactly( 2 ) )
178  ->method( 'getConnection' )
179  ->willReturn( $db );
180  // RevisionStore getTitle uses a ConnectionRef
181  $mockLoadBalancer->expects( $this->atLeastOnce() )
182  ->method( 'getConnectionRef' )
183  ->willReturn( $db );
184 
185  // First call to Title::newFromID, faking no result (db lag?)
186  $db->expects( $this->at( 0 ) )
187  ->method( 'selectRow' )
188  ->with(
189  'page',
190  $this->anything(),
191  [ 'page_id' => 1 ]
192  )
193  ->willReturn( false );
194 
195  // First select using rev_id, faking no result (db lag?)
196  $db->expects( $this->at( 1 ) )
197  ->method( 'selectRow' )
198  ->with(
199  [ 'revision', 'page' ],
200  $this->anything(),
201  [ 'rev_id' => 2 ]
202  )
203  ->willReturn( false );
204 
205  // Second call to Title::newFromID, no result
206  $db->expects( $this->at( 2 ) )
207  ->method( 'selectRow' )
208  ->with(
209  'page',
210  $this->anything(),
211  [ 'page_id' => 1 ]
212  )
213  ->willReturn( (object)[
214  'page_namespace' => '2',
215  'page_title' => 'Foodey',
216  ] );
217 
218  $store = $this->getRevisionStore( $mockLoadBalancer );
219  $title = $store->getTitle( 1, 2, RevisionStore::READ_NORMAL );
220 
221  $this->assertSame( 2, $title->getNamespace() );
222  $this->assertSame( 'Foodey', $title->getDBkey() );
223  }
224 
225  public function testGetTitle_successFromRevId() {
226  $mockLoadBalancer = $this->getMockLoadBalancer();
227  // Title calls wfGetDB() so we have to set the main service
228  $this->setService( 'DBLoadBalancer', $mockLoadBalancer );
229 
230  $db = $this->getMockDatabase();
231  // Title calls wfGetDB() which uses a regular Connection
232  $mockLoadBalancer->expects( $this->atLeastOnce() )
233  ->method( 'getConnection' )
234  ->willReturn( $db );
235  // RevisionStore getTitle uses a ConnectionRef
236  $mockLoadBalancer->expects( $this->atLeastOnce() )
237  ->method( 'getConnectionRef' )
238  ->willReturn( $db );
239 
240  // First call to Title::newFromID, faking no result (db lag?)
241  $db->expects( $this->at( 0 ) )
242  ->method( 'selectRow' )
243  ->with(
244  'page',
245  $this->anything(),
246  [ 'page_id' => 1 ]
247  )
248  ->willReturn( false );
249 
250  // First select using rev_id, faking no result (db lag?)
251  $db->expects( $this->at( 1 ) )
252  ->method( 'selectRow' )
253  ->with(
254  [ 'revision', 'page' ],
255  $this->anything(),
256  [ 'rev_id' => 2 ]
257  )
258  ->willReturn( (object)[
259  'page_namespace' => '1',
260  'page_title' => 'Food2',
261  ] );
262 
263  $store = $this->getRevisionStore( $mockLoadBalancer );
264  $title = $store->getTitle( 1, 2, RevisionStore::READ_NORMAL );
265 
266  $this->assertSame( 1, $title->getNamespace() );
267  $this->assertSame( 'Food2', $title->getDBkey() );
268  }
269 
271  $mockLoadBalancer = $this->getMockLoadBalancer();
272  // Title calls wfGetDB() so we have to set the main service
273  $this->setService( 'DBLoadBalancer', $mockLoadBalancer );
274 
275  $db = $this->getMockDatabase();
276  // Title calls wfGetDB() which uses a regular Connection
277  // Assert that the first call uses a REPLICA and the second falls back to master
278  $mockLoadBalancer->expects( $this->exactly( 2 ) )
279  ->method( 'getConnection' )
280  ->willReturn( $db );
281  // RevisionStore getTitle uses a ConnectionRef
282  $mockLoadBalancer->expects( $this->atLeastOnce() )
283  ->method( 'getConnectionRef' )
284  ->willReturn( $db );
285 
286  // First call to Title::newFromID, faking no result (db lag?)
287  $db->expects( $this->at( 0 ) )
288  ->method( 'selectRow' )
289  ->with(
290  'page',
291  $this->anything(),
292  [ 'page_id' => 1 ]
293  )
294  ->willReturn( false );
295 
296  // First select using rev_id, faking no result (db lag?)
297  $db->expects( $this->at( 1 ) )
298  ->method( 'selectRow' )
299  ->with(
300  [ 'revision', 'page' ],
301  $this->anything(),
302  [ 'rev_id' => 2 ]
303  )
304  ->willReturn( false );
305 
306  // Second call to Title::newFromID, no result
307  $db->expects( $this->at( 2 ) )
308  ->method( 'selectRow' )
309  ->with(
310  'page',
311  $this->anything(),
312  [ 'page_id' => 1 ]
313  )
314  ->willReturn( false );
315 
316  // Second select using rev_id, result
317  $db->expects( $this->at( 3 ) )
318  ->method( 'selectRow' )
319  ->with(
320  [ 'revision', 'page' ],
321  $this->anything(),
322  [ 'rev_id' => 2 ]
323  )
324  ->willReturn( (object)[
325  'page_namespace' => '2',
326  'page_title' => 'Foodey',
327  ] );
328 
329  $store = $this->getRevisionStore( $mockLoadBalancer );
330  $title = $store->getTitle( 1, 2, RevisionStore::READ_NORMAL );
331 
332  $this->assertSame( 2, $title->getNamespace() );
333  $this->assertSame( 'Foodey', $title->getDBkey() );
334  }
335 
340  $mockLoadBalancer = $this->getMockLoadBalancer();
341  // Title calls wfGetDB() so we have to set the main service
342  $this->setService( 'DBLoadBalancer', $mockLoadBalancer );
343 
344  $db = $this->getMockDatabase();
345  // Title calls wfGetDB() which uses a regular Connection
346  // Assert that the first call uses a REPLICA and the second falls back to master
347 
348  // RevisionStore getTitle uses getConnectionRef
349  // Title::newFromID uses getConnection
350  foreach ( [ 'getConnection', 'getConnectionRef' ] as $method ) {
351  $mockLoadBalancer->expects( $this->exactly( 2 ) )
352  ->method( $method )
353  ->willReturnCallback( function ( $masterOrReplica ) use ( $db ) {
354  static $callCounter = 0;
355  $callCounter++;
356  // The first call should be to a REPLICA, and the second a MASTER.
357  if ( $callCounter === 1 ) {
358  $this->assertSame( DB_REPLICA, $masterOrReplica );
359  } elseif ( $callCounter === 2 ) {
360  $this->assertSame( DB_MASTER, $masterOrReplica );
361  }
362  return $db;
363  } );
364  }
365  // First and third call to Title::newFromID, faking no result
366  foreach ( [ 0, 2 ] as $counter ) {
367  $db->expects( $this->at( $counter ) )
368  ->method( 'selectRow' )
369  ->with(
370  'page',
371  $this->anything(),
372  [ 'page_id' => 1 ]
373  )
374  ->willReturn( false );
375  }
376 
377  foreach ( [ 1, 3 ] as $counter ) {
378  $db->expects( $this->at( $counter ) )
379  ->method( 'selectRow' )
380  ->with(
381  [ 'revision', 'page' ],
382  $this->anything(),
383  [ 'rev_id' => 2 ]
384  )
385  ->willReturn( false );
386  }
387 
388  $store = $this->getRevisionStore( $mockLoadBalancer );
389 
390  $this->setExpectedException( RevisionAccessException::class );
391  $store->getTitle( 1, 2, RevisionStore::READ_NORMAL );
392  }
393 
395  yield 'windows-1252, old_flags is empty' => [
396  'windows-1252',
397  'en',
398  [
399  'old_flags' => '',
400  'old_text' => "S\xF6me Content",
401  ],
402  'Söme Content'
403  ];
404 
405  yield 'windows-1252, old_flags is null' => [
406  'windows-1252',
407  'en',
408  [
409  'old_flags' => null,
410  'old_text' => "S\xF6me Content",
411  ],
412  'Söme Content'
413  ];
414  }
415 
421  public function testNewRevisionFromRow_legacyEncoding_applied( $encoding, $locale, $row, $text ) {
422  if ( !$this->useTextId() ) {
423  $this->markTestSkipped( 'No longer applicable with MCR schema' );
424  }
425 
426  $cache = new WANObjectCache( [ 'cache' => new HashBagOStuff() ] );
427  $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
428 
429  $blobStore = new SqlBlobStore( $lb, $cache );
430  $blobStore->setLegacyEncoding( $encoding, Language::factory( $locale ) );
431 
432  $store = $this->getRevisionStore( $lb, $blobStore, $cache );
433 
434  $record = $store->newRevisionFromRow(
435  $this->makeRow( $row ),
436  0,
437  Title::newFromText( __METHOD__ . '-UTPage' )
438  );
439 
440  $this->assertSame( $text, $record->getContent( SlotRecord::MAIN )->serialize() );
441  }
442 
447  if ( !$this->useTextId() ) {
448  $this->markTestSkipped( 'No longer applicable with MCR schema' );
449  }
450 
451  $row = [
452  'old_flags' => 'utf-8',
453  'old_text' => 'Söme Content',
454  ];
455 
456  $cache = new WANObjectCache( [ 'cache' => new HashBagOStuff() ] );
457  $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
458 
459  $blobStore = new SqlBlobStore( $lb, $cache );
460  $blobStore->setLegacyEncoding( 'windows-1252', Language::factory( 'en' ) );
461 
462  $store = $this->getRevisionStore( $lb, $blobStore, $cache );
463 
464  $record = $store->newRevisionFromRow(
465  $this->makeRow( $row ),
466  0,
467  Title::newFromText( __METHOD__ . '-UTPage' )
468  );
469  $this->assertSame( 'Söme Content', $record->getContent( SlotRecord::MAIN )->serialize() );
470  }
471 
472  private function makeRow( array $array ) {
473  $row = $array + [
474  'rev_id' => 7,
475  'rev_page' => 5,
476  'rev_timestamp' => '20110101000000',
477  'rev_user_text' => 'Tester',
478  'rev_user' => 17,
479  'rev_minor_edit' => 0,
480  'rev_deleted' => 0,
481  'rev_len' => 100,
482  'rev_parent_id' => 0,
483  'rev_sha1' => 'deadbeef',
484  'rev_comment_text' => 'Testing',
485  'rev_comment_data' => '{}',
486  'rev_comment_cid' => 111,
487  'page_namespace' => 0,
488  'page_title' => 'TEST',
489  'page_id' => 5,
490  'page_latest' => 7,
491  'page_is_redirect' => 0,
492  'page_len' => 100,
493  'user_name' => 'Tester',
494  ];
495 
496  if ( $this->useTextId() ) {
497  $row += [
498  'rev_content_format' => CONTENT_FORMAT_TEXT,
499  'rev_content_model' => CONTENT_MODEL_TEXT,
500  'rev_text_id' => 11,
501  'old_id' => 11,
502  'old_text' => 'Hello World',
503  'old_flags' => 'utf-8',
504  ];
505  } else {
506  if ( !isset( $row['content'] ) && isset( $array['old_text'] ) ) {
507  $row['content'] = [
508  'main' => new WikitextContent( $array['old_text'] ),
509  ];
510  }
511  }
512 
513  return (object)$row;
514  }
515 
516  public function provideMigrationConstruction() {
517  return [
525  ];
526  }
527 
532  public function testMigrationConstruction( $migration, $expectException ) {
533  if ( $expectException ) {
534  $this->setExpectedException( InvalidArgumentException::class );
535  }
536  $loadBalancer = $this->getMockLoadBalancer();
537  $blobStore = $this->getMockSqlBlobStore();
538  $cache = $this->getHashWANObjectCache();
539  $commentStore = $this->getMockCommentStore();
541  $nameTables = $services->getNameTableStoreFactory();
542  $contentModelStore = $nameTables->getContentModels();
543  $slotRoleStore = $nameTables->getSlotRoles();
544  $store = new RevisionStore(
545  $loadBalancer,
546  $blobStore,
547  $cache,
548  $commentStore,
549  $nameTables->getContentModels(),
550  $nameTables->getSlotRoles(),
551  $migration,
552  $services->getActorMigration()
553  );
554  if ( !$expectException ) {
555  $store = TestingAccessWrapper::newFromObject( $store );
556  $this->assertSame( $loadBalancer, $store->loadBalancer );
557  $this->assertSame( $blobStore, $store->blobStore );
558  $this->assertSame( $cache, $store->cache );
559  $this->assertSame( $commentStore, $store->commentStore );
560  $this->assertSame( $contentModelStore, $store->contentModelStore );
561  $this->assertSame( $slotRoleStore, $store->slotRoleStore );
562  $this->assertSame( $migration, $store->mcrMigrationStage );
563  }
564  }
565 
566 }
Wikimedia\Rdbms\Database
Relational database abstraction object.
Definition: Database.php:48
Revision\RevisionAccessException
Exception representing a failure to look up a revision.
Definition: RevisionAccessException.php:33
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:280
MediaWiki\Tests\Revision\RevisionStoreTest\getRevisionStore
getRevisionStore( $loadBalancer=null, $blobStore=null, $WANObjectCache=null)
Definition: RevisionStoreTest.php:38
SCHEMA_COMPAT_READ_NEW
const SCHEMA_COMPAT_READ_NEW
Definition: Defines.php:287
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
HashBagOStuff
Simple store for keeping values in an associative array for the current process.
Definition: HashBagOStuff.php:31
Revision\RevisionStore
Service for looking up page revisions.
Definition: RevisionStore.php:76
MediaWiki\Storage\SqlBlobStore
Service for storing and loading Content objects.
Definition: SqlBlobStore.php:50
MediaWiki\Tests\Revision
Definition: McrReadNewRevisionStoreDbTest.php:2
MediaWiki\Tests\Revision\RevisionStoreTest\testSetContentHandlerUseDB
testSetContentHandlerUseDB( $contentHandlerDb, $migrationMode, $expectedFail)
provideSetContentHandlerUseDB \MediaWiki\Revision\RevisionStore::getContentHandlerUseDB \MediaWiki\Re...
Definition: RevisionStoreTest.php:116
anything
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 so they can t rely on Unix and must forbid reads to even standard directories like tmp lest users read each others files We cannot assume that the user has the ability to install or run any programs not written as web accessible PHP scripts Since anything that works on cheap shared hosting will work if you have shell or root access MediaWiki s design is based around catering to the lowest common denominator Although we support higher end setups as the way many things work by default is tailored toward shared hosting These defaults are unconventional from the point of view of and they certainly aren t ideal for someone who s installing MediaWiki as MediaWiki does not conform to normal Unix filesystem layout Hopefully we ll offer direct support for standard layouts in the but for now *any change to the location of files is unsupported *Moving things and leaving symlinks will *probably *not break anything
Definition: distributors.txt:39
MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_successFromRevId
testGetTitle_successFromRevId()
Definition: RevisionStoreTest.php:225
CommentStore
CommentStore handles storage of comments (edit summaries, log reasons, etc) in the database.
Definition: CommentStore.php:31
$wgMultiContentRevisionSchemaMigrationStage
int $wgMultiContentRevisionSchemaMigrationStage
RevisionStore table schema migration stage (content, slots, content_models & slot_roles tables).
Definition: DefaultSettings.php:8993
MediaWiki\Tests\Revision\RevisionStoreTest\provideSetContentHandlerUseDB
provideSetContentHandlerUseDB()
Definition: RevisionStoreTest.php:95
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
MWException
MediaWiki exception.
Definition: MWException.php:26
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:964
MediaWikiTestCase
Definition: MediaWikiTestCase.php:16
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
CONTENT_FORMAT_TEXT
const CONTENT_FORMAT_TEXT
Definition: Defines.php:256
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
DB_MASTER
const DB_MASTER
Definition: defines.php:26
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))
MediaWiki\Tests\Revision\RevisionStoreTest\getMockCommentStore
getMockCommentStore()
Definition: RevisionStoreTest.php:86
Wikimedia\Rdbms\LoadBalancer
Database connection, tracking, load balancing, and transaction manager for a cluster.
Definition: LoadBalancer.php:41
MediaWiki\Tests\Revision\RevisionStoreTest\testNewRevisionFromRow_legacyEncoding_applied
testNewRevisionFromRow_legacyEncoding_applied( $encoding, $locale, $row, $text)
provideNewRevisionFromRow_legacyEncoding_applied
Definition: RevisionStoreTest.php:421
MediaWiki\MediaWikiServices\getInstance
static getInstance()
Returns the global default instance of the top level service locator.
Definition: MediaWikiServices.php:120
MediaWiki\Tests\Revision\RevisionStoreTest\provideNewRevisionFromRow_legacyEncoding_applied
provideNewRevisionFromRow_legacyEncoding_applied()
Definition: RevisionStoreTest.php:394
MediaWiki\Tests\Revision\RevisionStoreTest\makeRow
makeRow(array $array)
Definition: RevisionStoreTest.php:472
MediaWiki\Tests\Revision\RevisionStoreTest\testNewRevisionFromRow_legacyEncoding_ignored
testNewRevisionFromRow_legacyEncoding_ignored()
\MediaWiki\Revision\RevisionStore::newRevisionFromRow
Definition: RevisionStoreTest.php:446
SCHEMA_COMPAT_WRITE_OLD
const SCHEMA_COMPAT_WRITE_OLD
Definition: Defines.php:284
WANObjectCache
Multi-datacenter aware caching interface.
Definition: WANObjectCache.php:118
SCHEMA_COMPAT_WRITE_NEW
const SCHEMA_COMPAT_WRITE_NEW
Definition: Defines.php:286
Revision\RevisionStore\setContentHandlerUseDB
setContentHandlerUseDB( $contentHandlerUseDB)
Definition: RevisionStore.php:254
MediaWiki\Tests\Revision\RevisionStoreTest\getMockDatabase
getMockDatabase()
Definition: RevisionStoreTest.php:70
MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_correctFallbackAndthrowsExceptionAfterFallbacks
testGetTitle_correctFallbackAndthrowsExceptionAfterFallbacks()
\MediaWiki\Revision\RevisionStore::getTitle
Definition: RevisionStoreTest.php:339
Revision\SlotRecord\MAIN
const MAIN
Definition: SlotRecord.php:41
MediaWiki\Tests\Revision\RevisionStoreTest\useTextId
useTextId()
Definition: RevisionStoreTest.php:25
MediaWiki\Tests\Revision\RevisionStoreTest
Definition: RevisionStoreTest.php:23
Title
Represents a title within MediaWiki.
Definition: Title.php:39
$cache
$cache
Definition: mcc.php:33
MediaWiki\Tests\Revision\RevisionStoreTest\getHashWANObjectCache
getHashWANObjectCache()
Definition: RevisionStoreTest.php:91
SCHEMA_COMPAT_NEW
const SCHEMA_COMPAT_NEW
Definition: Defines.php:291
MediaWiki\Tests\Revision\RevisionStoreTest\getMockLoadBalancer
getMockLoadBalancer()
Definition: RevisionStoreTest.php:62
SCHEMA_COMPAT_OLD
const SCHEMA_COMPAT_OLD
Definition: Defines.php:290
MediaWiki\Tests\Revision\RevisionStoreTest\testMigrationConstruction
testMigrationConstruction( $migration, $expectException)
\MediaWiki\Revision\RevisionStore::__construct provideMigrationConstruction
Definition: RevisionStoreTest.php:532
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
SCHEMA_COMPAT_WRITE_BOTH
const SCHEMA_COMPAT_WRITE_BOTH
Definition: Defines.php:288
MediaWiki\Tests\Revision\RevisionStoreTest\getMockSqlBlobStore
getMockSqlBlobStore()
Definition: RevisionStoreTest.php:78
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:2044
MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_successFromRevIdOnFallback
testGetTitle_successFromRevIdOnFallback()
Definition: RevisionStoreTest.php:270
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:214
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
$services
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $services
Definition: hooks.txt:2278
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
CONTENT_MODEL_TEXT
const CONTENT_MODEL_TEXT
Definition: Defines.php:238
MediaWikiTestCase\setService
setService( $name, $object)
Sets a service, maintaining a stashed version of the previous service to be restored in tearDown.
Definition: MediaWikiTestCase.php:646
SCHEMA_COMPAT_READ_BOTH
const SCHEMA_COMPAT_READ_BOTH
Definition: Defines.php:289
MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_successFromPageIdOnFallback
testGetTitle_successFromPageIdOnFallback()
Definition: RevisionStoreTest.php:169
Language
Internationalisation code.
Definition: Language.php:35
SCHEMA_COMPAT_READ_OLD
const SCHEMA_COMPAT_READ_OLD
Definition: Defines.php:285
MediaWikiTestCase\$db
Database $db
Primary database.
Definition: MediaWikiTestCase.php:60
MediaWiki\Tests\Revision\RevisionStoreTest\testGetTitle_successFromPageId
testGetTitle_successFromPageId()
Definition: RevisionStoreTest.php:138
Revision\SlotRecord
Value object representing a content slot associated with a page revision.
Definition: SlotRecord.php:39
MediaWiki\Tests\Revision\RevisionStoreTest\provideMigrationConstruction
provideMigrationConstruction()
Definition: RevisionStoreTest.php:516