18 'wgReadOnlyFile' => $readOnlyFile,
24 'file://', # Non-
default
49 [ [
'a' ], [
'a',
'b',
'c' ] ],
50 [ [
'a' ], [
'a',
'b' ] ],
51 [ 1 => [
'a',
'b',
'c' ] ],
90 "%E7%89%B9%E5%88%A5:Contributions/Foobar",
91 wfUrlencode(
"\xE7\x89\xB9\xE5\x88\xA5:Contributions/Foobar" ) );
99 "https://te.wikibooks.org/wiki/ఉబుంటు_వాడుకరి_మార్గదర్శని",
101 .
"%E0%B0%89%E0%B0%AC%E0%B1%81%E0%B0%82%E0%B0%9F%E0%B1%81_"
102 .
"%E0%B0%B5%E0%B0%BE%E0%B0%A1%E0%B1%81%E0%B0%95%E0%B0%B0%E0%B0%BF_"
103 .
"%E0%B0%AE%E0%B0%BE%E0%B0%B0%E0%B1%8D%E0%B0%97%E0%B0%A6%E0%B0%B0"
104 .
"%E0%B1%8D%E0%B0%B6%E0%B0%A8%E0%B0%BF" ) );
142 'wgReadOnly' =>
'reason'
152 [ [
'foo' =>
'bar' ],
'foo=bar' ],
153 [ [
'foo' =>
'' ],
'foo=' ],
154 [ [
'foo' => 1 ],
'foo=1' ],
155 [ [
'foo' =>
true ],
'foo=1' ],
156 [ [
'foo' =>
false ],
'' ],
157 [ [
'foo' =>
null ],
'' ],
158 [ [
'foo' =>
'A&B=5+6@!"\'' ],
'foo=A%26B%3D5%2B6%40%21%22%27' ],
160 [
'foo' =>
'bar',
'baz' =>
'is',
'asdf' =>
'qwerty' ],
161 'foo=bar&baz=is&asdf=qwerty'
163 [ [
'foo' => [
'bar' =>
'baz' ] ],
'foo%5Bbar%5D=baz' ],
165 [
'foo' => [
'bar' =>
'baz',
'qwerty' =>
'asdf' ] ],
166 'foo%5Bbar%5D=baz&foo%5Bqwerty%5D=asdf'
168 [ [
'foo' => [
'bar',
'baz' ] ],
'foo%5B0%5D=bar&foo%5B1%5D=baz' ],
170 [
'foo' => [
'bar' => [
'bar' =>
'baz' ] ] ],
171 'foo%5Bbar%5D%5Bbar%5D=baz'
192 [
'foo' =>
'bar',
'baz' =>
'overridden value' ] ) );
198 [
'foo=bar', [
'foo' =>
'bar' ] ],
199 [
'foo=', [
'foo' =>
'' ] ],
200 [
'foo', [
'foo' =>
'' ] ],
201 [
'foo=bar&qwerty=asdf', [
'foo' =>
'bar',
'qwerty' =>
'asdf' ] ],
202 [
'foo=A%26B%3D5%2B6%40%21%22%27', [
'foo' =>
'A&B=5+6@!"\'' ] ],
203 [
'foo%5Bbar%5D=baz', [
'foo' => [
'bar' =>
'baz' ] ] ],
205 'foo%5Bbar%5D=baz&foo%5Bqwerty%5D=asdf',
206 [
'foo' => [
'bar' =>
'baz',
'qwerty' =>
'asdf' ] ]
208 [
'foo%5B0%5D=bar&foo%5B1%5D=baz', [
'foo' => [ 0 =>
'bar', 1 =>
'baz' ] ] ],
210 'foo%5Bbar%5D%5Bbar%5D=baz',
211 [
'foo' => [
'bar' => [
'bar' =>
'baz' ] ] ]
229 [
'foo=bar&baz=biz' ],
230 [
'foo=A%26B%3D5%2B6%40%21%22%27' ],
231 [
'foo%5Bbar%5D=baz' ],
232 [
'foo%5B0%5D=bar&foo%5B1%5D=baz' ],
233 [
'foo%5Bbar%5D%5Bbar%5D=baz' ],
252 [
'application/xhtml+xml' => 1.0,
254 'text/plain' => 0.3 ] ) );
259 'text/*' => 0.5 ] ) );
263 [
'*/*' => 1.0 ] ) );
266 [
'image/png' => 1.0,
267 'image/svg+xml' => 0.5 ] ) );
277 [
'application/xhtml+xml' => 1.0,
281 [
'text/html' => 1.0 ] ) );
283 'application/xhtml+xml',
285 [
'application/xhtml+xml' => 1.0,
289 [
'application/xhtml+xml' => 1.0,
290 'text/html' => 0.5 ] ) );
294 [
'text/html' => 1.0,
297 'application/xhtml+xml' => 0.2 ],
298 [
'application/xhtml+xml' => 1.0,
299 'text/html' => 0.5 ] ) );
306 [
'application/xhtml+xml' => 1.0,
307 'text/html' => 0.5 ] ) );
311 [
'application/xhtml+xml' => 1.0 ] ) );
322 'wgDebugLogFile' => $debugLogFile,
324 'wgDebugTimestamps' =>
false,
328 wfDebug(
"This is a normal string" );
332 wfDebug(
"This is nöt an ASCII string" );
336 wfDebug(
"\00305This has böth UTF and control chars\003" );
338 " 05This has böth UTF and control chars \n",
366 'compress, gzip' =>
true,
367 'gzip;q=1.0' =>
true,
370 'gzip;q=abcde' =>
true,
371 'gzip;q=12345678.9' =>
true,
375 if (
isset( $_SERVER[
'HTTP_ACCEPT_ENCODING'] ) ) {
376 $old_server_setting = $_SERVER[
'HTTP_ACCEPT_ENCODING'];
379 foreach ( $settings as $encoding => $expect ) {
380 $_SERVER[
'HTTP_ACCEPT_ENCODING'] = $encoding;
386 if (
isset( $old_server_setting ) ) {
396 [ 6 / 7,
'0.86%', 2,
false ],
398 [ 22 / 7,
'3.14286%', 5 ],
401 [ 10 / 3,
'0%', -1 ],
402 [ 3 / 4 / 5,
'0.1%', 1 ],
403 [ 6 / 7 * 8,
'6.8571428571%', 10 ],
406 foreach ( $pcts as $pct ) {
407 if ( !
isset( $pct[2] ) ) {
410 if ( !
isset( $pct[3] ) ) {
437 # Failures returns 0 :(
441 # Int, strings with spaces
450 [
'1m', 1024 * 1024 ],
451 [
'1M', 1024 * 1024 ],
452 [
'1g', 1024 * 1024 * 1024 ],
453 [
'1G', 1024 * 1024 * 1024 ],
480 $successfulMerge =
wfMerge(
"old1\n\nold2",
"old1\n\nnew2",
"new1\n\nold2", $mergedText );
483 $conflictingMerge =
wfMerge(
'old',
'old and mine',
'old and yours', $mergedText );
501 public function testMerge( $old, $mine, $yours, $expectedMergeResult, $expectedText,
502 $expectedMergeAttemptResult ) {
506 $attemptMergeResult =
null;
507 $isMerged =
wfMerge( $old, $mine, $yours, $mergedText, $mergeAttemptResult );
509 $msg =
'Merge should be a ';
510 $msg .= $expectedMergeResult ?
'success' :
'failure';
511 $this->
assertEquals( $expectedMergeResult, $isMerged, $msg );
512 $this->
assertEquals( $expectedMergeAttemptResult, $mergeAttemptResult );
517 'is merged text as expected?' );
522 $EXPECT_MERGE_SUCCESS =
true;
523 $EXPECT_MERGE_FAILURE =
false;
534 "one one one ONE ONE\n" .
547 "one one one ONE ONE\n" .
561 "one one one ONE ONE\n" .
592 $this->
assertEquals( $expected, $actual, $description );
597 $protocols = [
'HTTP' =>
'http:',
'HTTPS' =>
'https:',
'protocol-relative' =>
'' ];
598 foreach ( $protocols as $pDesc => $p ) {
601 "$p//www.example.com",
604 "No matches for empty domains array, $pDesc URL"
607 "$p//www.example.com",
608 [
'www.example.com' ],
610 "Exact match in domains array, $pDesc URL"
613 "$p//www.example.com",
616 "Match without subdomain in domains array, $pDesc URL"
619 "$p//www.example2.com",
620 [
'www.example.com',
'www.example2.com',
'www.example3.com' ],
622 "Exact match with other domains in array, $pDesc URL"
625 "$p//www.example2.com",
626 [
'example.com',
'example2.com',
'example3,com' ],
628 "Match without subdomain with other domains in array, $pDesc URL"
631 "$p//www.example4.com",
632 [
'example.com',
'example2.com',
'example3,com' ],
634 "Domain not in array, $pDesc URL"
637 "$p//nds-nl.wikipedia.org",
638 [
'nl.wikipedia.org' ],
640 "Non-matching substring of domain, $pDesc URL"
665 $expected, $description
672 $this->
assertEquals( $expected, $actual, $description );
677 'wgDBname' =>
'example',
686 'wgDBname' =>
'example',
687 'wgDBprefix' =>
'mw_',
699 $cache = ObjectCache::getLocalClusterInstance();
701 $cache->makeKey(
'foo', 123,
'bar' ),
710 $cache = ObjectCache::getLocalClusterInstance();
714 $cache->makeKey(
'foo',
'bar' )
722 $cache = ObjectCache::getLocalClusterInstance();
724 $cache->makeGlobalKey(
'foo', 123,
'bar' ),
733 [
'eval.php', [
'--help',
'--test' ], [],
734 "'$wgPhpCli' 'eval.php' '--help' '--test'",
735 "Called eval.php --help --test" ],
736 [
'eval.php', [
'--help',
'--test space' ], [
'php' =>
'php5' ],
737 "'php5' 'eval.php' '--help' '--test space'",
738 "Called eval.php --help --test with php option" ],
739 [
'eval.php', [
'--help',
'--test',
'X' ], [
'wrapper' =>
'MWScript.php' ],
740 "'$wgPhpCli' 'MWScript.php' 'eval.php' '--help' '--test' 'X'",
741 "Called eval.php --help --test with wrapper option" ],
744 [
'--help',
'--test',
'y' ],
745 [
'php' =>
'php5',
'wrapper' =>
'MWScript.php' ],
746 "'php5' 'MWScript.php' 'eval.php' '--help' '--test' 'y'",
747 "Called eval.php --help --test with wrapper and php option"
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
$wgPhpCli
Executable path of the PHP cli binary.
$wgReadOnlyFile
If this lock file exists (size > 0), the wiki will be forced into read-only mode.
$wgDebugTimestamps
Prefix debug messages with relative timestamp.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfNegotiateType( $cprefs, $sprefs)
Returns the 'best' match between a client's requested internet media types and the server's list of a...
wfRandom()
Get a random decimal value in the domain of [0, 1), in a way not likely to give duplicate values for ...
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
wfRandomString( $length=32)
Get a random string containing a number of pseudo-random hex characters.
wfClientAcceptsGzip( $force=false)
Whether the client accept gzip encoding.
wfReadOnly()
Check whether the wiki is in read-only mode.
wfExpandIRI( $url)
Take a URL, make sure it's expanded to fully qualified, and replace any encoded non-ASCII Unicode cha...
wfPercent( $nr, $acc=2, $round=true)
wfMerge( $old, $mine, $yours, &$result, &$mergeAttemptResult=null)
wfMerge attempts to merge differences between three texts.
wfShellWikiCmd( $script, array $parameters=[], array $options=[])
Generate a shell-escaped command line string to run a MediaWiki cli script.
wfArrayDiff2( $a, $b)
Like array_diff( $a, $b ) except that it works with two-dimensional arrays.
wfReadOnlyReason()
Check if the site is in read-only mode and return the message if so.
wfGlobalCacheKey(... $args)
Make a cache key with database-agnostic prefix.
wfDebugMem( $exact=false)
Send a line giving PHP memory usage.
wfMemcKey(... $args)
Make a cache key for the local wiki.
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes one or two arrays as input, and returns a CGI-style string, e....
wfCgiToArray( $query)
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns...
wfIsWindows()
Check if the operating system is Windows.
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
wfMatchesDomainList( $url, $domains)
Check whether a given URL has a domain that occurs in a given set of domains.
wfForeignMemcKey( $db, $prefix,... $args)
Make a cache key for a foreign DB.
mimeTypeMatch( $type, $avail)
Checks if a given MIME type matches any of the keys in the given array.
wfMkdirParents( $dir, $mode=null, $caller=null)
Make directory, and make all parent directories if they don't exist.
wfBoolToStr( $value)
Convenience function converts boolean values into "true" or "false" (string) values.
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Database GlobalFunctions.
testCgiToArray( $cgi, $result)
provideCgiToArray wfCgiToArray
testWfArrayDiff2( $a, $b, $expected)
provideForWfArrayDiff2 wfArrayDiff2
testMerge_worksWithLessParameters()
wfMerge
testExpandIRI()
wfExpandIRI
testDebugFunctionTest()
wfDebug wfDebugMem
testWfPercentTest()
wfPercent
testMimeTypeMatch()
mimeTypeMatch
static provideShorthand()
testMerge( $old, $mine, $yours, $expectedMergeResult, $expectedText, $expectedMergeAttemptResult)
static provideCgiToArray()
testArrayToCGI( $array, $result)
provideArrayToCGI wfArrayToCgi
testWfMkdirParents()
wfMkdirParents
testWfMatchesDomainList( $url, $domains, $expected, $description)
provideWfMatchesDomainList wfMatchesDomainList
static provideArrayToCGI()
testNegotiateType()
wfNegotiateType
testClientAcceptsGzipTest()
wfClientAcceptsGzip
testUrlencode()
wfUrlencode
testReadOnlyGlobalChange()
This behaviour could probably be deprecated.
testWfShellWikiCmd( $script, $parameters, $options, $expected, $description)
provideWfShellWikiCmdList wfShellWikiCmd
testWfForeignMemcKey()
wfForeignMemcKey
testReadOnlyEmpty()
Intended to cover the relevant bits of ServiceWiring.php, as well as GlobalFunctions....
testRandomString()
wfRandomString
testCgiRoundTrip( $cgi)
provideCgiRoundTrip wfArrayToCgi
testWfGlobalCacheKey()
wfGlobalCacheKey
testWfShorthandToInteger( $shorthand, $expected)
test
testReadOnlySet()
Intended to cover the relevant bits of ServiceWiring.php, as well as GlobalFunctions....
testArrayToCGI2()
wfArrayToCgi
static provideCgiRoundTrip()
static provideWfShellWikiCmdList()
static provideForWfArrayDiff2()
static provideWfMatchesDomainList()
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 & $options
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
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
processing should stop and the error should be shown to the user * false