21 public function getBlobStore( $legacyEncoding =
false, $compressRevisions =
false ) {
29 if ( $compressRevisions ) {
30 $store->setCompressBlobs( $compressRevisions );
32 if ( $legacyEncoding ) {
33 $store->setLegacyEncoding( $legacyEncoding, Language::factory(
'en' ) );
45 $this->assertFalse( $store->getCompressBlobs() );
46 $store->setCompressBlobs(
true );
47 $this->assertTrue( $store->getCompressBlobs() );
57 $this->assertFalse( $store->getLegacyEncoding() );
58 $this->assertNull( $store->getLegacyEncodingConversionLang() );
59 $en = Language::factory(
'en' );
60 $store->setLegacyEncoding(
'foo', $en );
61 $this->assertSame(
'foo', $store->getLegacyEncoding() );
62 $this->assertSame( $en, $store->getLegacyEncodingConversionLang() );
71 $this->assertSame( 604800, $store->getCacheExpiry() );
72 $store->setCacheExpiry( 12 );
73 $this->assertSame( 12, $store->getCacheExpiry() );
82 $this->assertFalse( $store->getUseExternalStore() );
83 $store->setUseExternalStore(
true );
84 $this->assertTrue( $store->getUseExternalStore() );
88 yield
'(no legacy encoding), false in false out' => [
false,
false, [],
false ];
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), string in with gzip flag returns string' => [
93 false,
"sttttr\002\022\000", [
'gzip' ],
'AAAABBAAA',
95 yield
'(no legacy encoding), string in with object flag returns false' => [
97 false,
"s:4:\"JOJO\";", [
'object' ],
false,
99 yield
'(no legacy encoding), serialized object in with object flag returns string' => [
106 yield
'(no legacy encoding), serialized object in with object & gzip flag returns string' => [
110 [
'object',
'gzip' ],
113 yield
'(ISO-8859-1 encoding), string in string out' => [
115 iconv(
'utf-8',
'ISO-8859-1',
"1®Àþ1" ),
119 yield
'(ISO-8859-1 encoding), serialized object in with gzip flags returns string' => [
121 gzdeflate( iconv(
'utf-8',
'ISO-8859-1',
"4®Àþ4" ) ),
125 yield
'(ISO-8859-1 encoding), serialized object in with object flags returns string' => [
131 yield
'(ISO-8859-1 encoding), serialized object in with object & gzip flags returns string' => [
134 [
'gzip',
'object' ],
137 yield
'T184749 (windows-1252 encoding), string in string out' => [
139 iconv(
'utf-8',
'windows-1252',
"sammansättningar" ),
143 yield
'T184749 (windows-1252 encoding), string in string out with gzip' => [
145 gzdeflate( iconv(
'utf-8',
'windows-1252',
"sammansättningar" ) ),
164 $store->decompressData( $data, $flags )
174 $row->old_text =
"Wiki est l'\xc3\xa9cole superieur !";
175 $row->old_flags = $store->compressData( $row->old_text );
176 $this->assertTrue(
false !== strpos( $row->old_flags,
'utf-8' ),
177 "Flags should contain 'utf-8'" );
178 $this->assertFalse(
false !== strpos( $row->old_flags,
'gzip' ),
179 "Flags should not contain 'gzip'" );
180 $this->assertEquals(
"Wiki est l'\xc3\xa9cole superieur !",
181 $row->old_text,
"Direct check" );
192 $row->old_text =
"Wiki est l'\xc3\xa9cole superieur !";
193 $row->old_flags = $store->compressData( $row->old_text );
194 $this->assertTrue(
false !== strpos( $row->old_flags,
'utf-8' ),
195 "Flags should contain 'utf-8'" );
196 $this->assertTrue(
false !== strpos( $row->old_flags,
'gzip' ),
197 "Flags should contain 'gzip'" );
198 $this->assertEquals(
"Wiki est l'\xc3\xa9cole superieur !",
199 gzinflate( $row->old_text ),
"Direct check" );
204 yield [
'someText' ];
205 yield [
"sammansättningar" ];
215 $address = $store->storeBlob(
$blob );
216 $this->assertSame(
$blob, $store->getBlob( $address ) );
226 $address = $store->storeBlob(
$blob );
227 $this->assertSame(
$blob, $store->getBlob( $address ) );
237 $address = $store->storeBlob(
$blob );
238 $this->assertSame(
$blob, $store->getBlob( $address ) );
Internationalisation code.
Represents a page (or page fragment) title within MediaWiki.
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title 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
processing should stop and the error should be shown to the user * false