MediaWiki master
DevelopmentSettings.php
Go to the documentation of this file.
1<?php
14
26// $wgDebugDumpSql = true;
27// $wgDebugRawPage = true;
28// $wgDebugToolbar = true;
29
34// Enable logging of all errors
35error_reporting( -1 );
36
37// Enable showing of errors, but avoid breaking non-HTML responses
38if ( MW_ENTRY_POINT === 'index' ) {
39 ini_set( 'display_errors', '1' );
40}
41
49
50// Use of wfWarn() should cause tests to fail
52
53// Enable showing of errors
55$wgShowHostnames = true;
56
57// Enable log files
58$logDir = getenv( 'MW_LOG_DIR' );
59if ( $logDir ) {
60 if ( !file_exists( $logDir ) ) {
61 mkdir( $logDir );
62 }
63 $logFileNames = [
64 'debug-cli' => 'mw-debug-cli',
65 'debug-web' => 'mw-debug-web',
66 'db' => 'mw-dberror',
67 'ratelimit' => 'mw-ratelimit',
68 'error' => 'mw-error',
69 ];
70 // For PHPUnit tests run in parallel via ComposerLaunchParallel,
71 // there will be an environment variable containing the group ID
72 // of the batch of tests being run in a process. Use this to group
73 // those logs together.
74 $splitGroupLogId = getenv( 'MW_PHPUNIT_SPLIT_GROUP_ID' );
75
76 foreach ( $logFileNames as $key => $logFileName ) {
77 if ( $splitGroupLogId ) {
78 $logFileNames[$key] = "$logDir/$logFileName.split-group-$splitGroupLogId.log";
79 } else {
80 $logFileNames[$key] = "$logDir/$logFileName.log";
81 }
82 }
83
84 if ( MW_ENTRY_POINT === 'cli' ) {
85 $wgDebugLogFile = $logFileNames['debug-cli'];
86 } else {
87 $wgDebugLogFile = $logFileNames['debug-web'];
88 }
89 $wgDBerrorLog = $logFileNames['db'];
90 $wgDebugLogGroups['ratelimit'] = $logFileNames['ratelimit'];
91 $wgDebugLogGroups['error'] = $logFileNames['error'];
92 $wgDebugLogGroups['exception'] = $logFileNames['error'];
93}
94unset( $logDir );
95
103
104// Set almost infinite rate limits. This allows integration tests to run unthrottled
105// in CI and for devs locally (T225796), but doesn't turn a large chunk of production
106// code completely off during testing (T284804)
107foreach ( $wgRateLimits as $right => &$limit ) {
108 foreach ( $limit as $group => &$groupLimit ) {
109 $groupLimit[0] = PHP_INT_MAX;
110 }
111}
112
113// Enable Special:JavaScriptTest and allow `npm run qunit` to work
114// https://www.mediawiki.org/wiki/Manual:JavaScript_unit_testing
116
117// Enable development/experimental endpoints
118$wgRestAPIAdditionalRouteFiles[] = 'includes/Rest/coreDevelopmentRoutes.json';
119$wgRestAPIAdditionalRouteFiles[] = 'includes/Rest/content.v1.json';
120$wgRestAPIAdditionalRouteFiles[] = 'includes/Rest/specs.v0.json';
121
122// Greatly raise the limits on short/long term login attempts,
123// so that automated tests run in parallel don't error.
125 [ 'count' => 1000, 'seconds' => 300 ],
126 [ 'count' => 100000, 'seconds' => 60 * 60 * 48 ],
127];
128
129// Run deferred updates before sending a response to the client.
130// This ensures that in end-to-end tests, a GET request will see the
131// effect of all previous POST requests (T230211).
132// Caveat: this does not wait for jobs to be executed, and it does
133// not wait for database replication to complete.
135
136// Set size limits for parsing small enough so we can test them,
137// but not so small that they interfere with other tests.
138$wgMaxArticleSize = 20; // in Kilobyte
139$wgParsoidSettings['wt2htmlLimits']['wikitextSize'] = 20 * 1024; // $wgMaxArticleSize, in byte
140$wgParsoidSettings['html2wtLimits']['htmlSize'] = 100 * 1024; // in characters!
141
142// Enable Vue dev mode by default, so that Vue devtools are functional.
144
145// Disable rate limiting of temp account creation and temp account name
146// acquisition, to facilitate local development and testing
149
158
159// Enable MariaDB/MySQL strict mode (T108255)
160$wgSQLMode = 'STRICT_ALL_TABLES,ONLY_FULL_GROUP_BY';
162
163// Localisation Cache to StaticArray (T218207)
164$wgLocalisationCacheConf['store'] = 'array';
165
166// Experimental Book Referencing feature (T236255)
168
169// The default value is false, but for development it is useful to set this to the system temp
170// directory by default (T218207)
171$wgCacheDirectory = TempFSFile::getUsableTempDirectory() .
172 DIRECTORY_SEPARATOR .
173 rawurlencode( MediaWiki\WikiMap\WikiMap::getCurrentWikiId() );
174
175// Enable uploads for FileImporter browser tests (T190829)
176$wgEnableUploads = true;
177
178// Enable en-x-piglatin variant conversion for testing
180// Enable x-xss language code for testing correct message escaping
182
183// Enable the new wikitext mode for browser testing (T270240)
185// Currently the default, but repeated here for safety since it would break many source editor tests.
186$wgDefaultUserOptions['visualeditor-newwikitext'] = 0;
187
188// Enable creation of temp user accounts on edit (T355880, T359043)
189$wgAutoCreateTempUser['enabled'] = true;
global $wgRestAPIAdditionalRouteFiles
global $wgMaxArticleSize
global $wgCacheDirectory
global $wgSQLMode
Experimental changes that may later become the default.
global $wgEnableJavaScriptTest
if(MW_ENTRY_POINT==='index') global $wgShowHostnames
global $wgPasswordAttemptThrottle
$wgTempAccountCreationThrottle
$wgVueDevelopmentMode
global $wgCiteBookReferencing
global $wgLocalisationCacheConf
global $wgUsePigLatinVariant
global $wgAutoCreateTempUser
if(MW_ENTRY_POINT==='index') global $wgShowExceptionDetails
global $wgEnableUploads
global $wgDBStrictWarnings
global $wgVisualEditorEnableWikitext
if(MW_ENTRY_POINT==='index') global $wgDebugLogGroups
if(MW_ENTRY_POINT==='index') global $wgDevelopmentWarnings
Debugging for MediaWiki.
if(MW_ENTRY_POINT==='index') global $wgDBerrorLog
if(MW_ENTRY_POINT==='index') global $wgDebugLogFile
global $wgForceDeferredUpdatesPreSend
global $wgParsoidSettings
$wgTempAccountNameAcquisitionThrottle
global $wgDefaultUserOptions
global $wgRateLimits
Make testing possible (or easier)
const MW_ENTRY_POINT
Definition api.php:35
This class is used to hold the location and do limited manipulation of files stored temporarily (this...
A helper class for throttling authentication attempts.