91 # Only colorize output if stdout is a terminal.
110 $this->showDiffs = !isset(
$options[
'quick'] );
111 $this->showProgress = !isset(
$options[
'quiet'] );
115 || isset(
$options[
'compare'] ) ) );
117 $this->showOutput = isset(
$options[
'show-output'] );
119 if ( isset(
$options[
'filter'] ) ) {
124 if ( isset(
$options[
'record'] ) ) {
125 echo
"Warning: --record cannot be used with --regex, disabling --record\n";
135 $this->keepUploads = isset(
$options[
'keep-uploads'] );
137 if ( $this->keepUploads ) {
138 $this->uploadDir =
wfTempDir() .
'/mwParser-images';
140 $this->uploadDir =
wfTempDir() .
"/mwParser-" . mt_rand() .
"-images";
144 $this->fuzzSeed = intval(
$options[
'seed'] ) - 1;
147 $this->runDisabled = isset(
$options[
'run-disabled'] );
148 $this->runParsoid = isset(
$options[
'run-parsoid'] );
152 if ( !$this->tidySupport->isEnabled() ) {
153 echo
"Warning: tidy is not installed, skipping some tests\n";
156 if ( !extension_loaded(
'gd' ) ) {
157 echo
"Warning: GD extension is not present, thumbnailing tests will probably fail\n";
161 $this->functionHooks = [];
162 $this->transparentHooks = [];
176 $wgScript =
'/index.php';
177 $wgStylePath =
'/skins';
178 $wgResourceBasePath =
'';
179 $wgExtensionAssetsPath =
'/extensions';
180 $wgArticlePath =
'/wiki/$1';
181 $wgThumbnailScriptPath =
false;
182 $wgLockManagers = [ [
183 'name' =>
'fsLockManager',
184 'class' =>
'FSLockManager',
185 'lockDirectory' => $this->uploadDir .
'/lockdir',
187 'name' =>
'nullLockManager',
188 'class' =>
'NullLockManager',
191 'class' =>
'LocalRepo',
193 'url' =>
'http://example.com/images',
195 'transformVia404' =>
false,
197 'name' =>
'local-backend',
199 'containerPaths' => [
200 'local-public' => $this->uploadDir .
'/public',
201 'local-thumb' => $this->uploadDir .
'/thumb',
202 'local-temp' => $this->uploadDir .
'/temp',
203 'local-deleted' => $this->uploadDir .
'/deleted',
208 $wgNamespaceAliases[
'Image'] =
NS_FILE;
210 # add a namespace shadowing a interwiki link, to test
211 # proper precedence when resolving links. (bug 51680)
212 $wgExtraNamespaces[100] =
'MemoryAlpha';
215 if ( $wgMainCacheType ===
CACHE_DB ) {
218 if ( $wgMessageCacheType ===
CACHE_DB ) {
221 if ( $wgParserCacheType ===
CACHE_DB ) {
235 $wgRequest =
$context->getRequest();
236 $wgParser =
new StubObject(
'wgParser', $wgParserConf[
'class'], [ $wgParserConf ] );
238 if ( $wgStyleDirectory ===
false ) {
239 $wgStyleDirectory =
"$IP/skins";
242 self::setupInterwikis();
243 $wgLocalInterwikis = [
'local',
'mi' ];
246 array_push( $wgExtraInterlanguageLinkPrefixes,
'mul' );
263 # Hack: insert a few Wikipedia in-project interwiki prefixes,
264 # for testing inter-language links
265 Hooks::register(
'InterwikiLoadPrefix',
function ( $prefix, &$iwData ) {
266 static $testInterwikis = [
268 'iw_url' =>
'http://doesnt.matter.org/$1',
273 'iw_url' =>
'http://en.wikipedia.org/wiki/$1',
278 'iw_url' =>
'http://www.usemod.com/cgi-bin/mb.pl?$1',
283 'iw_url' =>
'http://www.memory-alpha.org/en/index.php/$1',
288 'iw_url' =>
'http://zh.wikipedia.org/wiki/$1',
293 'iw_url' =>
'http://es.wikipedia.org/wiki/$1',
298 'iw_url' =>
'http://fr.wikipedia.org/wiki/$1',
303 'iw_url' =>
'http://ru.wikipedia.org/wiki/$1',
308 'iw_url' =>
'http://mi.wikipedia.org/wiki/$1',
313 'iw_url' =>
'http://wikisource.org/wiki/$1',
318 if ( array_key_exists( $prefix, $testInterwikis ) ) {
319 $iwData = $testInterwikis[$prefix];
335 if ( isset(
$options[
'record'] ) ) {
337 $this->recorder->version = isset(
$options[
'setversion'] ) ?
339 } elseif ( isset(
$options[
'compare'] ) ) {
353 if ( substr(
$s, -1 ) ===
"\n" ) {
354 return substr(
$s, 0, -1 );
368 $dictSize = strlen( $dict );
369 $logMaxLength = log( $this->maxFuzzTestLength );
371 ini_set(
'memory_limit', $this->memoryLimit * 1048576 );
381 mt_srand( ++$this->fuzzSeed );
382 $totalLength = mt_rand( 1, $this->maxFuzzTestLength );
385 while ( strlen( $input ) < $totalLength ) {
386 $logHairLength = mt_rand( 0, 1000000 ) / 1000000 * $logMaxLength;
387 $hairLength = min( intval( exp( $logHairLength ) ), $dictSize );
388 $offset = mt_rand( 0, $dictSize - $hairLength );
389 $input .= substr( $dict, $offset, $hairLength );
404 echo
"Test failed with seed {$this->fuzzSeed}\n";
406 printf(
"string(%d) \"%s\"\n\n", strlen( $input ), $input );
416 if ( $numTotal % 100 == 0 ) {
417 $usage = intval( memory_get_usage(
true ) / $this->memoryLimit / 1048576 * 100 );
418 echo
"{$this->fuzzSeed}: $numSuccess/$numTotal (mem: $usage%)\n";
420 echo
"Out of memory:\n";
423 foreach ( $memStats
as $name => $usage ) {
424 echo
"$name: $usage\n";
440 foreach ( $filenames
as $filename ) {
441 $contents = file_get_contents( $filename );
443 '/!!\s*(input|wikitext)\n(.*?)\n!!\s*(result|html|html\/\*|html\/php)/s',
449 $dict .= $match .
"\n";
467 $classes = get_declared_classes();
469 foreach ( $classes
as $class ) {
470 $rc =
new ReflectionClass( $class );
471 $props = $rc->getStaticProperties();
472 $memStats[$class] = strlen(
serialize( $props ) );
473 $methods = $rc->getMethods();
475 foreach ( $methods
as $method ) {
476 $memStats[$class] += strlen(
serialize( $method->getStaticVariables() ) );
480 $functions = get_defined_functions();
482 foreach ( $functions[
'user']
as $function ) {
483 $rf =
new ReflectionFunction( $function );
484 $memStats[
"$function()"] = strlen(
serialize( $rf->getStaticVariables() ) );
515 $this->recorder->start();
520 foreach ( $filenames
as $filename ) {
521 echo
"Running parser tests from: $filename\n";
523 $ok = $this->
runTests( $tests ) && $ok;
527 $this->recorder->report();
529 echo $e->getMessage();
531 $this->recorder->end();
539 foreach ( $tests
as $t ) {
541 $this->
runTest( $t[
'test'], $t[
'input'], $t[
'result'], $t[
'options'], $t[
'config'] );
543 $this->recorder->record( $t[
'test'], $t[
'subtest'], $result );
546 if ( $this->showProgress ) {
562 $class = $wgParserConf[
'class'];
563 $parser =
new $class( [
'preprocessorClass' => $preprocessor ] + $wgParserConf );
569 foreach ( $this->functionHooks
as $tag => $bits ) {
574 foreach ( $this->transparentHooks
as $tag => $callback ) {
596 if ( $this->showProgress ) {
606 if ( isset( $opts[
'djvu'] ) ) {
607 if ( !$this->djVuSupport->isEnabled() ) {
612 if ( isset( $opts[
'tidy'] ) ) {
613 if ( !$this->tidySupport->isEnabled() ) {
620 if ( isset( $opts[
'title'] ) ) {
621 $titleText = $opts[
'title'];
623 $titleText =
'Parser test';
627 $local = isset( $opts[
'local'] );
628 $preprocessor = isset( $opts[
'preprocessor'] ) ? $opts[
'preprocessor'] : null;
632 if ( isset( $opts[
'pst'] ) ) {
634 } elseif ( isset( $opts[
'msg'] ) ) {
636 } elseif ( isset( $opts[
'section'] ) ) {
639 } elseif ( isset( $opts[
'replace'] ) ) {
641 $replace = $opts[
'replace'][1];
643 } elseif ( isset( $opts[
'comment'] ) ) {
645 } elseif ( isset( $opts[
'preload'] ) ) {
651 if ( isset( $opts[
'tidy'] ) ) {
652 $out = preg_replace(
'/\s+$/',
'',
$out );
655 if ( isset( $opts[
'showtitle'] ) ) {
660 $out =
"$title\n$out";
663 if ( isset( $opts[
'showindicators'] ) ) {
666 $indicators .=
"$id=$content\n";
671 if ( isset( $opts[
'ill'] ) ) {
673 } elseif ( isset( $opts[
'cat'] ) ) {
674 $outputPage =
$context->getOutput();
676 $cats = $outputPage->getCategoryLinks();
678 if ( isset( $cats[
'normal'] ) ) {
679 $out = implode(
' ', $cats[
'normal'] );
689 $testResult->expected =
$result;
690 $testResult->actual =
$out;
720 if ( isset( $opts[
$key] ) ) {
736 (?<qstr> # Quoted string
738 (?:[^\\\\"] | \\\\.)*
744 [^"{}] | # Not a quoted string or object, or
745 (?&qstr) | # A quoted string, or
746 (?&json) # A json object (recursively)
752 (?&qstr) # Quoted val
760 (?&json) # JSON object
764 $regex =
'/' . $defs .
'\b
780 $valueregex =
'/' . $defs .
'(?&value)/x';
782 if ( preg_match_all(
$regex, $instring,
$matches, PREG_SET_ORDER ) ) {
784 $key = strtolower( $bits[
'k'] );
785 if ( !isset( $bits[
'v'] ) ) {
788 preg_match_all( $valueregex, $bits[
'v'], $vmatches );
789 $opts[
$key] = array_map( [ $this,
'cleanupOption' ], $vmatches[0] );
790 if ( count( $opts[
$key] ) == 1 ) {
800 if ( substr( $opt, 0, 1 ) ==
'"' ) {
801 return stripcslashes( substr( $opt, 1, -1 ) );
804 if ( substr( $opt, 0, 2 ) ==
'[[' ) {
805 return substr( $opt, 2, -2 );
808 if ( substr( $opt, 0, 1 ) ==
'{' ) {
824 # Find out values for some special options.
826 self::getOptionValue(
'language', $opts,
'en' );
828 self::getOptionValue(
'variant', $opts,
false );
830 self::getOptionValue(
'wgMaxTocLevel', $opts, 999 );
831 $linkHolderBatchSize =
832 self::getOptionValue(
'wgLinkHolderBatchSize', $opts, 1000 );
835 'wgServer' =>
'http://example.org',
836 'wgServerName' =>
'example.org',
837 'wgScript' =>
'/index.php',
838 'wgScriptPath' =>
'',
839 'wgArticlePath' =>
'/wiki/$1',
840 'wgActionPaths' => [],
841 'wgLockManagers' => [ [
842 'name' =>
'fsLockManager',
843 'class' =>
'FSLockManager',
844 'lockDirectory' => $this->uploadDir .
'/lockdir',
846 'name' =>
'nullLockManager',
847 'class' =>
'NullLockManager',
849 'wgLocalFileRepo' => [
850 'class' =>
'LocalRepo',
852 'url' =>
'http://example.com/images',
854 'transformVia404' =>
false,
856 'name' =>
'local-backend',
858 'containerPaths' => [
859 'local-public' => $this->uploadDir,
860 'local-thumb' => $this->uploadDir .
'/thumb',
861 'local-temp' => $this->uploadDir .
'/temp',
862 'local-deleted' => $this->uploadDir .
'/delete',
866 'wgEnableUploads' => self::getOptionValue(
'wgEnableUploads', $opts,
true ),
867 'wgUploadNavigationUrl' =>
false,
868 'wgStylePath' =>
'/skins',
869 'wgSitename' =>
'MediaWiki',
870 'wgLanguageCode' =>
$lang,
871 'wgDBprefix' => $this->db->getType() !=
'oracle' ?
'parsertest_' :
'pt_',
872 'wgRawHtml' => self::getOptionValue(
'wgRawHtml', $opts,
false ),
874 'wgContLang' => null,
875 'wgNamespacesWithSubpages' => [ 0 => isset( $opts[
'subpage'] ) ],
876 'wgMaxTocLevel' => $maxtoclevel,
877 'wgCapitalLinks' =>
true,
878 'wgNoFollowLinks' =>
true,
879 'wgNoFollowDomainExceptions' => [],
880 'wgThumbnailScriptPath' =>
false,
881 'wgUseImageResize' =>
true,
882 'wgSVGConverter' =>
'null',
883 'wgSVGConverters' => [
'null' =>
'echo "1">$output' ],
884 'wgLocaltimezone' =>
'UTC',
885 'wgAllowExternalImages' => self::getOptionValue(
'wgAllowExternalImages', $opts,
true ),
886 'wgThumbLimits' => [ self::getOptionValue(
'thumbsize', $opts, 180 ) ],
887 'wgDefaultLanguageVariant' => $variant,
888 'wgVariantArticlePath' =>
false,
889 'wgGroupPermissions' => [
'*' => [
890 'createaccount' =>
true,
893 'createpage' =>
true,
894 'createtalk' =>
true,
896 'wgNamespaceProtection' => [
NS_MEDIAWIKI =>
'editinterface' ],
897 'wgDefaultExternalStore' => [],
898 'wgForeignFileRepos' => [],
899 'wgLinkHolderBatchSize' => $linkHolderBatchSize,
900 'wgExperimentalHtmlIds' =>
false,
901 'wgExternalLinkTarget' =>
false,
903 'wgAdaptiveMessageCache' =>
true,
904 'wgDisableLangConversion' =>
false,
905 'wgDisableTitleConversion' =>
false,
907 'wgUseTidy' => isset( $opts[
'tidy'] ),
908 'wgTidyConfig' => null,
909 'wgDebugTidy' =>
false,
910 'wgTidyConf' => $IP .
'/includes/tidy/tidy.conf',
912 'wgTidyInternal' => $this->tidySupport->isInternal(),
916 $configLines = explode(
"\n", $config );
918 foreach ( $configLines
as $line ) {
919 list( $var,
$value ) = explode(
'=', $line, 2 );
921 $settings[$var] = eval(
"return $value;" );
925 $this->savedGlobals = [];
928 Hooks::run(
'ParserTestGlobals', [ &$settings ] );
930 foreach ( $settings
as $var => $val ) {
931 if ( array_key_exists( $var,
$GLOBALS ) ) {
932 $this->savedGlobals[$var] =
$GLOBALS[$var];
949 $context->getUser()->setOption(
'thumbsize', 0 );
953 $wgHooks[
'ParserTestParser'][] =
'ParserTestParserHook::setup';
954 $wgHooks[
'ParserGetVariableValueTs'][] =
'ParserTest::getFakeTimestamp';
969 $tables = [
'user',
'user_properties',
'user_former_groups',
'page',
'page_restrictions',
970 'protected_titles',
'revision',
'text',
'pagelinks',
'imagelinks',
971 'categorylinks',
'templatelinks',
'externallinks',
'langlinks',
'iwlinks',
972 'site_stats',
'ipblocks',
'image',
'oldimage',
973 'recentchanges',
'watchlist',
'interwiki',
'logging',
'log_search',
974 'querycache',
'objectcache',
'job',
'l10n_cache',
'redirect',
'querycachetwo',
975 'archive',
'user_groups',
'page_props',
'category'
978 if ( in_array( $this->db->getType(), [
'mysql',
'sqlite',
'oracle' ] ) ) {
979 array_push(
$tables,
'searchindex' );
998 if ( $this->databaseSetupDone ) {
1003 $dbType = $this->db->getType();
1005 if ( $wgDBprefix ===
'parsertest_' || ( $dbType ==
'oracle' && $wgDBprefix ===
'pt_' ) ) {
1006 throw new MWException(
'setupDatabase should be called before setupGlobals' );
1009 $this->databaseSetupDone =
true;
1011 # SqlBagOStuff broke when using temporary tables on r40209 (bug 15892).
1012 # It seems to have been fixed since (r55079?), but regressed at some point before r85701.
1013 # This works around it for now...
1016 # CREATE TEMPORARY TABLE breaks if there is more than one server
1017 if (
wfGetLB()->getServerCount() != 1 ) {
1018 $this->useTemporaryTables =
false;
1021 $temporary = $this->useTemporaryTables || $dbType ==
'postgres';
1022 $prefix = $dbType !=
'oracle' ?
'parsertest_' :
'pt_';
1025 $this->dbClone->useTemporaryTables( $temporary );
1026 $this->dbClone->cloneTableStructure();
1028 if ( $dbType ==
'oracle' ) {
1029 $this->db->query(
'BEGIN FILL_WIKI_INFO; END;' );
1030 # Insert 0 user to prevent FK violations
1033 $this->db->insert(
'user', [
1035 'user_name' =>
'Anonymous' ] );
1038 # Update certain things in site_stats
1039 $this->db->insert(
'site_stats',
1040 [
'ss_row_id' => 1,
'ss_images' => 2,
'ss_good_articles' => 1 ] );
1042 # Reinitialise the LocalisationCache to match the database state
1045 # Clear the message cache
1053 # note that the size/width/height/bits/etc of the file
1054 # are actually set by inspecting the file itself; the arguments
1055 # to recordUpload2 have no effect. That said, we try to make things
1056 # match up so it is less confusing to readers of the code & tests.
1057 $image->recordUpload2(
'',
'Upload of some lame file',
'Some lame file', [
1063 'mime' =>
'image/jpeg',
1065 'sha1' => Wikimedia\base_convert(
'1', 16, 36, 31 ),
1066 'fileExists' =>
true
1067 ], $this->db->timestamp(
'20010115123500' ),
$user );
1070 # again, note that size/width/height below are ignored; see above.
1071 $image->recordUpload2(
'',
'Upload of some lame thumbnail',
'Some lame thumbnail', [
1077 'mime' =>
'image/png',
1079 'sha1' => Wikimedia\base_convert(
'2', 16, 36, 31 ),
1080 'fileExists' =>
true
1081 ], $this->db->timestamp(
'20130225203040' ),
$user );
1084 $image->recordUpload2(
'',
'Upload of some lame SVG',
'Some lame SVG', [
1090 'mime' =>
'image/svg+xml',
1092 'sha1' => Wikimedia\base_convert(
'', 16, 36, 31 ),
1093 'fileExists' =>
true
1094 ], $this->db->timestamp(
'20010115123500' ),
$user );
1096 # This image will be blacklisted in [[MediaWiki:Bad image list]]
1098 $image->recordUpload2(
'',
'zomgnotcensored',
'Borderline image', [
1104 'mime' =>
'image/jpeg',
1106 'sha1' => Wikimedia\base_convert(
'3', 16, 36, 31 ),
1107 'fileExists' =>
true
1108 ], $this->db->timestamp(
'20010115123500' ),
$user );
1111 $image->recordUpload2(
'',
'A pretty movie',
'Will it play', [
1117 'mime' =>
'application/ogg',
1119 'sha1' => Wikimedia\base_convert(
'', 16, 36, 31 ),
1120 'fileExists' =>
true
1121 ], $this->db->timestamp(
'20010115123500' ),
$user );
1125 $image->recordUpload2(
'',
'Upload a DjVu',
'A DjVu', [
1131 'mime' =>
'image/vnd.djvu',
1132 'metadata' =>
'<?xml version="1.0" ?>
1133 <!DOCTYPE DjVuXML PUBLIC "-//W3C//DTD DjVuXML 1.1//EN" "pubtext/DjVuXML-s.dtd">
1136 <BODY><OBJECT height="3508" width="2480">
1137 <PARAM name="DPI" value="300" />
1138 <PARAM name="GAMMA" value="2.2" />
1140 <OBJECT height="3508" width="2480">
1141 <PARAM name="DPI" value="300" />
1142 <PARAM name="GAMMA" value="2.2" />
1144 <OBJECT height="3508" width="2480">
1145 <PARAM name="DPI" value="300" />
1146 <PARAM name="GAMMA" value="2.2" />
1148 <OBJECT height="3508" width="2480">
1149 <PARAM name="DPI" value="300" />
1150 <PARAM name="GAMMA" value="2.2" />
1152 <OBJECT height="3508" width="2480">
1153 <PARAM name="DPI" value="300" />
1154 <PARAM name="GAMMA" value="2.2" />
1158 'sha1' => Wikimedia\base_convert(
'', 16, 36, 31 ),
1159 'fileExists' =>
true
1160 ], $this->db->timestamp(
'20010115123600' ),
$user );
1164 if ( !$this->databaseSetupDone ) {
1170 $this->dbClone->destroy();
1171 $this->databaseSetupDone =
false;
1173 if ( $this->useTemporaryTables ) {
1174 if ( $this->db->getType() ==
'sqlite' ) {
1175 # Under SQLite the searchindex table is virtual and need
1176 # to be explicitly destroyed. See bug 29912
1177 # See also MediaWikiTestCase::destroyDB()
1178 wfDebug( __METHOD__ .
" explicitly destroying sqlite virtual table parsertest_searchindex\n" );
1179 $this->db->query(
"DROP TABLE `parsertest_searchindex`" );
1181 # Don't need to do anything
1189 if ( $this->db->getType() ==
'oracle' ) {
1190 $this->db->query(
"DROP TABLE pt_$table DROP CONSTRAINTS" );
1192 $this->db->query(
"DROP TABLE `parsertest_$table`" );
1196 if ( $this->db->getType() ==
'oracle' ) {
1197 $this->db->query(
'BEGIN FILL_WIKI_INFO; END;' );
1213 if ( $this->keepUploads && is_dir(
$dir ) ) {
1218 if ( file_exists(
$dir ) ) {
1219 wfDebug(
"Already exists!\n" );
1224 copy(
"$IP/tests/phpunit/data/parser/headbg.jpg",
"$dir/3/3a/Foobar.jpg" );
1226 copy(
"$IP/tests/phpunit/data/parser/wiki.png",
"$dir/e/ea/Thumb.png" );
1228 copy(
"$IP/tests/phpunit/data/parser/headbg.jpg",
"$dir/0/09/Bad.jpg" );
1230 file_put_contents(
"$dir/f/ff/Foobar.svg",
1231 '<?xml version="1.0" encoding="utf-8"?>' .
1232 '<svg xmlns="http://www.w3.org/2000/svg"' .
1233 ' version="1.1" width="240" height="180"/>' );
1235 copy(
"$IP/tests/phpunit/data/parser/LoremIpsum.djvu",
"$dir/5/5f/LoremIpsum.djvu" );
1237 copy(
"$IP/tests/phpunit/data/parser/320x240.ogv",
"$dir/0/00/Video.ogv" );
1253 foreach ( $this->savedGlobals
as $var => $val ) {
1263 if ( $this->keepUploads ) {
1270 "$dir/3/3a/Foobar.jpg",
1271 "$dir/thumb/3/3a/Foobar.jpg/*.jpg",
1272 "$dir/e/ea/Thumb.png",
1273 "$dir/0/09/Bad.jpg",
1274 "$dir/5/5f/LoremIpsum.djvu",
1275 "$dir/thumb/5/5f/LoremIpsum.djvu/*-LoremIpsum.djvu.jpg",
1276 "$dir/f/ff/Foobar.svg",
1277 "$dir/thumb/f/ff/Foobar.svg/*-Foobar.svg.png",
1278 "$dir/math/f/a/5/fa50b8b616463173474302ca3e63586b.png",
1279 "$dir/0/00/Video.ogv",
1280 "$dir/thumb/0/00/Video.ogv/120px--Video.ogv.jpg",
1281 "$dir/thumb/0/00/Video.ogv/180px--Video.ogv.jpg",
1282 "$dir/thumb/0/00/Video.ogv/240px--Video.ogv.jpg",
1283 "$dir/thumb/0/00/Video.ogv/320px--Video.ogv.jpg",
1284 "$dir/thumb/0/00/Video.ogv/270px--Video.ogv.jpg",
1285 "$dir/thumb/0/00/Video.ogv/320px-seek=2-Video.ogv.jpg",
1286 "$dir/thumb/0/00/Video.ogv/320px-seek=3.3666666666667-Video.ogv.jpg",
1294 "$dir/thumb/3/3a/Foobar.jpg",
1301 "$dir/thumb/f/ff/Foobar.svg",
1309 "$dir/thumb/0/00/Video.ogv",
1312 "$dir/thumb/5/5f/LoremIpsum.djvu",
1332 foreach ( glob( $pattern )
as $file ) {
1333 if ( file_exists( $file ) ) {
1346 if ( is_dir( $dir ) ) {
1357 print "Running test $desc... ";
1369 if ( $this->showProgress ) {
1370 print $this->
term->color(
'1;32' ) .
'PASSED' . $this->
term->reset() .
"\n";
1387 if ( !$this->showProgress ) {
1388 # In quiet mode we didn't show the 'Testing' message before the
1389 # test, in case it succeeded. Show it now:
1393 print $this->
term->color(
'31' ) .
'FAILED!' . $this->
term->reset() .
"\n";
1395 if ( $this->showOutput ) {
1396 print "--- Expected ---\n{$testResult->expected}\n";
1397 print "--- Actual ---\n{$testResult->actual}\n";
1400 if ( $this->showDiffs ) {
1401 print $this->
quickDiff( $testResult->expected, $testResult->actual );
1402 if ( !$this->
wellFormed( $testResult->actual ) ) {
1403 print "XML error: $this->mXmlError\n";
1417 if ( $this->showProgress ) {
1418 print $this->
term->color(
'1;33' ) .
'SKIPPED' . $this->
term->reset() .
"\n";
1435 $inFileTail =
'expected', $outFileTail =
'actual'
1437 # Windows, or at least the fc utility, is retarded
1439 $prefix =
wfTempDir() .
"{$slash}mwParser-" . mt_rand();
1441 $infile =
"$prefix-$inFileTail";
1444 $outfile =
"$prefix-$outFileTail";
1452 $shellCommand = (
wfIsWindows() && !$wgDiff3 ) ?
'fc' :
'diff -au';
1454 $diff =
wfShellExec(
"$shellCommand $shellInfile $shellOutfile" );
1469 $file = fopen( $filename,
"wt" );
1470 fwrite( $file, $data .
"\n" );
1482 return preg_replace(
1483 [
'/^(-.*)$/m',
'/^(\+.*)$/m' ],
1484 [ $this->
term->color( 34 ) .
'$1' . $this->
term->reset(),
1485 $this->
term->color( 31 ) .
'$1' . $this->
term->reset() ],
1496 "Reading tests from \"$path\"..." .
1497 $this->
term->reset() .
1514 $wgCapitalLinks =
true;
1516 $text = self::chomp( $text );
1521 if ( is_null(
$title ) ) {
1522 throw new MWException(
"invalid title '$name' at line $line\n" );
1526 $page->loadPageData(
'fromdbmaster' );
1528 if (
$page->exists() ) {
1529 if ( $ignoreDuplicate ==
'ignoreduplicate' ) {
1532 throw new MWException(
"duplicate article '$name' at line $line\n" );
1538 $wgCapitalLinks = $oldCapitalLinks;
1552 $wgParser->firstCallInit();
1554 if ( isset( $wgParser->mTagHooks[
$name] ) ) {
1557 echo
" This test suite requires the '$name' hook extension, skipping.\n";
1575 $wgParser->firstCallInit();
1577 if ( isset( $wgParser->mFunctionHooks[
$name] ) ) {
1578 $this->functionHooks[
$name] = $wgParser->mFunctionHooks[
$name];
1580 echo
" This test suite requires the '$name' function hook extension, skipping.\n";
1598 $wgParser->firstCallInit();
1600 if ( isset( $wgParser->mTransparentTagHooks[
$name] ) ) {
1601 $this->transparentHooks[
$name] = $wgParser->mTransparentTagHooks[
$name];
1603 echo
" This test suite requires the '$name' transparent hook extension, skipping.\n";
1617 $parser = xml_parser_create(
"UTF-8" );
1619 # case folding violates XML standard, turn it off
1620 xml_parser_set_option(
$parser, XML_OPTION_CASE_FOLDING,
false );
1623 $err = xml_error_string( xml_get_error_code(
$parser ) );
1624 $position = xml_get_current_byte_index(
$parser );
1626 $this->mXmlError =
"$err at byte $position:\n$fragment";
1638 $start = max( 0, $position - 10 );
1639 $before = $position - $start;
1641 $this->
term->color( 34 ) .
1642 substr( $text, $start, $before ) .
1643 $this->
term->color( 0 ) .
1644 $this->
term->color( 31 ) .
1645 $this->
term->color( 1 ) .
1646 substr( $text, $position, 1 ) .
1647 $this->
term->color( 0 ) .
1648 $this->
term->color( 34 ) .
1649 substr( $text, $position + 1, 9 ) .
1650 $this->
term->color( 0 ) .
1652 $display = str_replace(
"\n",
' ', $fragment );
1654 str_repeat(
' ', $before ) .
1655 $this->
term->color( 31 ) .
1657 $this->
term->color( 0 );
1659 return "$display\n$caret";
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
static newFromContext(IContextSource $context)
Get a ParserOptions object from a IContextSource object.
static getLocalisationCache()
Get the LocalisationCache instance.
static getMainWANInstance()
Get the main WAN cache object.
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 an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
static clearPendingUpdates()
Clear all pending updates without performing them.
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 $out
Database error base class.
static getFakeTimestamp(&$parser, &$ts)
$wgScript
The URL path to index.php.
magic word the default is to use $key to get the and $key value or $key value text $key value html to format the value $key
Group all the pieces relevant to the context of a request into one instance.
__construct($options=[])
Sets terminal colorization and diff/quick modes depending on OS and command-line options (–color and...
runTest($desc, $input, $result, $opts, $config)
Run a given wikitext input through a freshly-constructed wiki parser, and compare the output against ...
static addArticle($name, $text, $line= 'unknown', $ignoreDuplicate= '')
Insert a temporary test article.
listTables()
List of temporary tables to create, without prefix.
wfMkdirParents($dir, $mode=null, $caller=null)
Make directory, and make all parent directories if they don't exist.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $messageMemc
setupGlobals($opts= '', $config= '')
Set up the global variables for a consistent environment for each test.
teardownUploadDir($dir)
Remove the dummy uploads directory.
$wgThumbnailScriptPath
Give a path here to use thumb.php for thumbnail generation on client request, instead of generating t...
if(!isset($args[0])) $lang
getFuzzInput($filenames)
Get an input dictionary from a set of parser test files.
setupUploadDir()
Create a dummy uploads directory which will contain a couple of files in order to pass existence test...
static destroySingleton()
Destroy the singleton instance, so that a new one will be created next time singleton() is called...
$wgLocalFileRepo
File repository structures.
CloneDatabase $dbClone
Database clone helper.
getParser($preprocessor=null)
Get a Parser object.
$wgNamespaceAliases
Namespace aliases.
it s the revision text itself In either if gzip is the revision text is gzipped $flags
$wgHooks['ArticleShow'][]
static hackDocType()
Hack up a private DOCTYPE with HTML's standard entity declarations.
static createNew($name, $params=[])
Add a user to the database, return the user object.
wfShellExec($cmd, &$retval=null, $environ=[], $limits=[], $options=[])
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported...
requireFunctionHook($name)
Steal a callback function from the primary parser, save it for application to our scary parser...
static newFromText($text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
when a variable name is used in a it is silently declared as a new local masking the global
static chomp($s)
Remove last character if it is a newline utility.
static destroySingleton()
Destroy the singleton instance.
wfIsWindows()
Check if the operating system is Windows.
static posix_isatty($fd)
Wrapper for posix_isatty() We default as considering stdin a tty (for nice readline methods) but trea...
static newFromUser($user)
Get a ParserOptions object from a given user.
wfLocalFile($title)
Get an object referring to a locally registered file.
which are not or by specifying more than one search term(only pages containing all of the search terms will appear in the result).</td >< td >
wfGetMessageCacheStorage()
Get the cache object used by the message cache.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
wfDebug($text, $dest= 'all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetParserCacheStorage()
Get the cache object used by the parser cache.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message.Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item.Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page.Return false to stop further processing of the tag $reader:XMLReader object &$pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision.Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag.Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload.Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports.&$fullInterwikiPrefix:Interwiki prefix, may contain colons.&$pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable.Can be used to lazy-load the import sources list.&$importSources:The value of $wgImportSources.Modify as necessary.See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page.$context:IContextSource object &$pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect.&$title:Title object for the current page &$request:WebRequest &$ignoreRedirect:boolean to skip redirect check &$target:Title/string of redirect target &$article:Article object 'InternalParseBeforeLinks':during Parser's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InternalParseBeforeSanitize':during Parser's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings.Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not.Return true without providing an interwiki to continue interwiki search.$prefix:interwiki prefix we are looking for.&$iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user's email has been invalidated successfully.$user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification.Callee may modify $url and $query, URL will be constructed as $url.$query &$url:URL to index.php &$query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) &$article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() &$ip:IP being check &$result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from &$allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn't match your organization.$addr:The e-mail address entered by the user &$result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user &$result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we're looking for a messages file for &$file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED!Use $magicWords in a file listed in $wgExtensionMessagesFiles instead.Use this to define synonyms of magic words depending of the language &$magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces.Do not use this hook to add namespaces.Use CanonicalNamespaces for that.&$namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED!Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead.Use to define aliases of special pages names depending of the language &$specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names.&$names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page's language links.This is called in various places to allow extensions to define the effective language links for a page.$title:The page's Title.&$links:Associative array mapping language codes to prefixed links of the form"language:title".&$linkFlags:Associative array mapping prefixed links to arrays of flags.Currently unused, but planned to provide support for marking individual language links in the UI, e.g.for featured articles. 'LanguageSelector':Hook to change the language selector available on a page.$out:The output page.$cssClassName:CSS class name of the language selector. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts.Return false to skip default processing and return $ret.See documentation for Linker::link() for details on the expected meanings of parameters.$skin:the Skin object $target:the Title that the link is pointing to &$html:the contents that the< a > tag should have(raw HTML) $result
static deleteDirs($dirs)
Delete the specified directories, if they exist.
showSuccess(ParserTestResult $testResult)
Print a happy success message.
static BagOStuff[] $instances
Map of (id => BagOStuff)
static destroySingleton()
Destroy the current singleton instance.
$wgExtraInterlanguageLinkPrefixes
List of additional interwiki prefixes that should be treated as interlanguage links (i...
if($wgScript===false) if($wgLoadScript===false) if($wgArticlePath===false) if(!empty($wgActionPaths)&&!isset($wgActionPaths['view'])) if($wgResourceBasePath===null) if($wgStylePath===false) if($wgLocalStylePath===false) if($wgExtensionAssetsPath===false) if($wgLogo===false) if($wgUploadPath===false) if($wgUploadDirectory===false) if($wgReadOnlyFile===false) if($wgFileCacheDirectory===false) if($wgDeletedDirectory===false) if($wgGitInfoCacheDirectory===false &&$wgCacheDirectory!==false) if($wgEnableParserCache===false) if($wgRightsIcon) if(isset($wgFooterIcons['copyright']['copyright'])&&$wgFooterIcons['copyright']['copyright']===[]) if(isset($wgFooterIcons['poweredby'])&&isset($wgFooterIcons['poweredby']['mediawiki'])&&$wgFooterIcons['poweredby']['mediawiki']['src']===null) $wgNamespaceProtection[NS_MEDIAWIKI]
Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a sysadmin to set $wgName...
static tearDownInterwikis()
Remove the hardcoded interwiki lookup table.
$wgStylePath
The URL path of the skins directory.
static register($name, $callback)
Attach an event handler to a given hook.
wfGetLB($wiki=false)
Get a load balancer object.
$wgParserCacheType
The cache type for storing article HTML.
wfTempDir()
Tries to get the system directory for temporary files.
static getMain()
Static methods.
static singleton()
Get an instance of this class.
static clear($name)
Clears hooks registered via Hooks::register().
$wgCapitalLinks
Set this to false to avoid forcing the first letter of links to capitals.
quickDiff($input, $output, $inFileTail= 'expected', $outFileTail= 'actual')
Run given strings through a diff and return the (colorized) output.
$wgLocalInterwikis
Array for multiple $wgLocalInterwiki values, in case there are several interwiki prefixes that point ...
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
requireHook($name)
Steal a callback function from the primary parser, save it for application to our scary parser...
$wgMessageCacheType
The cache type for storing the contents of the MediaWiki namespace.
controlled by $wgMainCacheType * $parserMemc
showTesting($desc)
"Running test $desc..."
static clearCache()
Clear the self::$mObjects variable For use in parser tests.
teardownGlobals()
Restore default values and perform any necessary clean-up after each test runs.
static destroySingletons()
Destroy the singleton instances.
$wgResourceBasePath
The default 'remoteBasePath' value for instances of ResourceLoaderFileModule.
static resetMain()
Resets singleton returned by getMain().
CACHE_MEMCACHED $wgMainCacheType
dumpToFile($data, $filename)
Write the given string to a file, adding a final newline.
Class to implement stub globals, which are globals that delay loading the their associated module cod...
static setupInterwikis()
Insert hardcoded interwiki in the lookup table.
namespace and then decline to actually register it file or subcat img or subcat $title
A BagOStuff object with no objects in it.
Using a hook running we can avoid having all this option specific stuff in our mainline code Using hooks
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
isSuccess()
Whether the test passed.
extractFragment($text, $position)
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books $tag
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
setupDatabase()
Set up a temporary set of wiki tables to work with for the tests.
static makeContent($text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
showRunFile($path)
Show "Reading tests from ...".
Initialize and detect the DjVu files support.
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
showFailure(ParserTestResult $testResult)
Print a failure message and provide some explanatory output about what went wrong if so configured...
static formatComment($comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
getMemoryBreakdown()
Get a memory usage breakdown.
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
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 local account $user
in the sidebar</td >< td > font color
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object & $output
Initialize and detect the tidy support.
$wgExtraNamespaces
Additional namespaces.
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
Terminal that supports ANSI escape sequences.
static getOptionValue($key, $opts, $default)
Use a regex to find out the value of an option.
showTestResult(ParserTestResult $testResult)
Refactored in 1.22 to use ParserTestResult.
$wgScriptPath
The path we should point to.
colorDiff($text)
Colorize unified diff output if set for ANSI color output.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
wfGetMainCache()
Get the main cache object.
$wgExtensionAssetsPath
The URL path of the extensions directory.
$wgDBprefix
Table name prefix.
DatabaseBase $db
Our connection to the database.
$wgStyleDirectory
Filesystem stylesheets directory.
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 $image
wfEscapeShellArg()
Windows-compatible version of escapeshellarg() Windows doesn't recognise single-quotes in the shell...
$wgLockManagers
Array of configuration arrays for each lock manager.
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
runTestsFromFiles($filenames)
Run a series of tests listed in the given text files.
static getVersion($flags= '', $lang=null)
Return a string of the MediaWiki version with Git revision if available.
Class for a file system (FS) based file backend.
static factory($code)
Get a cached or new language object for a given language code.
Represent the result of a parser test.
showSkipped()
Print a skipped message.
requireTransparentHook($name)
Steal a callback function from the primary parser, save it for application to our scary parser...
fuzzTest($filenames)
Run a fuzz test series Draw input from a set of test files.
static getCanonicalNamespaces($rebuild=false)
Returns array of all defined namespaces with their canonical (English) names.
if(is_null($wgLocalTZoffset)) if(!$wgDBerrorLogTZ) $wgRequest
static & makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
static singleton()
Get the signleton instance of this class.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
static deleteFiles($files)
Delete the specified files, if they exist.
Allows to change the fields on the form that will be generated $name