Go to the documentation of this file.
5 use InvalidArgumentException;
22 public function getBlobStore( $legacyEncoding =
false, $compressRevisions =
false ) {
30 if ( $compressRevisions ) {
33 if ( $legacyEncoding ) {
46 $this->assertFalse( $store->getCompressBlobs() );
47 $store->setCompressBlobs(
true );
48 $this->assertTrue( $store->getCompressBlobs() );
58 $this->assertFalse( $store->getLegacyEncoding() );
59 $this->assertNull( $store->getLegacyEncodingConversionLang() );
61 $store->setLegacyEncoding(
'foo', $en );
62 $this->assertSame(
'foo', $store->getLegacyEncoding() );
63 $this->assertSame( $en, $store->getLegacyEncodingConversionLang() );
72 $this->assertSame( 604800, $store->getCacheExpiry() );
73 $store->setCacheExpiry( 12 );
74 $this->assertSame( 12, $store->getCacheExpiry() );
83 $this->assertFalse( $store->getUseExternalStore() );
84 $store->setUseExternalStore(
true );
85 $this->assertTrue( $store->getUseExternalStore() );
89 yield
'(no legacy encoding), empty in empty out' => [
false,
'', [],
'' ];
90 yield
'(no legacy encoding), empty in empty out' => [
false,
'A', [],
'A' ];
91 yield
'(no legacy encoding), error flag -> false' => [
false,
'X', [
'error' ],
false ];
92 yield
'(no legacy encoding), string in with gzip flag returns string' => [
94 false,
"sttttr\002\022\000", [
'gzip' ],
'AAAABBAAA',
96 yield
'(no legacy encoding), string in with object flag returns false' => [
98 false,
"s:4:\"JOJO\";", [
'object' ],
false,
100 yield
'(no legacy encoding), serialized object in with object flag returns string' => [
107 yield
'(no legacy encoding), serialized object in with object & gzip flag returns string' => [
111 [
'object',
'gzip' ],
114 yield
'(ISO-8859-1 encoding), string in string out' => [
116 iconv(
'utf-8',
'ISO-8859-1',
"1®Àþ1" ),
120 yield
'(ISO-8859-1 encoding), serialized object in with gzip flags returns string' => [
122 gzdeflate( iconv(
'utf-8',
'ISO-8859-1',
"4®Àþ4" ) ),
126 yield
'(ISO-8859-1 encoding), serialized object in with object flags returns string' => [
132 yield
'(ISO-8859-1 encoding), serialized object in with object & gzip flags returns string' => [
135 [
'gzip',
'object' ],
138 yield
'T184749 (windows-1252 encoding), string in string out' => [
140 iconv(
'utf-8',
'windows-1252',
"sammansättningar" ),
144 yield
'T184749 (windows-1252 encoding), string in string out with gzip' => [
146 gzdeflate( iconv(
'utf-8',
'windows-1252',
"sammansättningar" ) ),
165 $store->decompressData(
$data, $flags )
176 $store->decompressData(
false, [] );
185 $row->old_text =
"Wiki est l'\xc3\xa9cole superieur !";
186 $row->old_flags = $store->compressData( $row->old_text );
187 $this->assertTrue( strpos( $row->old_flags,
'utf-8' ) !==
false,
188 "Flags should contain 'utf-8'" );
189 $this->assertFalse( strpos( $row->old_flags,
'gzip' ) !==
false,
190 "Flags should not contain 'gzip'" );
191 $this->assertEquals(
"Wiki est l'\xc3\xa9cole superieur !",
192 $row->old_text,
"Direct check" );
203 $row->old_text =
"Wiki est l'\xc3\xa9cole superieur !";
204 $row->old_flags = $store->compressData( $row->old_text );
205 $this->assertTrue( strpos( $row->old_flags,
'utf-8' ) !==
false,
206 "Flags should contain 'utf-8'" );
207 $this->assertTrue( strpos( $row->old_flags,
'gzip' ) !==
false,
208 "Flags should contain 'gzip'" );
209 $this->assertEquals(
"Wiki est l'\xc3\xa9cole superieur !",
210 gzinflate( $row->old_text ),
"Direct check" );
215 yield [
'someText' ];
216 yield [
"sammansättningar" ];
226 $address = $store->storeBlob(
$blob );
227 $this->assertSame(
$blob, $store->getBlob( $address ) );
237 $address = $store->storeBlob(
$blob );
238 $this->assertSame(
$blob, $store->getBlob( $address ) );
250 $address = $store->storeBlob(
$blob );
251 $this->assertSame(
$blob, $store->getBlob( $address ) );
255 yield [
'tt:17', 17 ];
256 yield [
'xy:17',
null ];
257 yield [
'xy:xyzzy',
null ];
265 $this->assertSame( $textId, $store->getTextIdFromAddress( $address ) );
283 $store->getTextIdFromAddress( $address );
processing should stop and the error should be shown to the user * false
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
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
static factory( $code)
Get a cached or new language object for a given language code.
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
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
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
Internationalisation code.
Represents a page (or page fragment) title within MediaWiki.