2017-10-08 20:17:35 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Extra settings useful for MediaWiki development.
|
|
|
|
|
*
|
|
|
|
|
* To enable built-in debug and development settings, add the
|
|
|
|
|
* following to your LocalSettings.php file.
|
|
|
|
|
*
|
|
|
|
|
* require "$IP/includes/DevelopmentSettings.php";
|
|
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
*/
|
|
|
|
|
|
2024-09-27 19:20:56 +00:00
|
|
|
use Wikimedia\FileBackend\FSFile\TempFSFile;
|
|
|
|
|
|
2022-04-06 00:12:40 +00:00
|
|
|
/**
|
|
|
|
|
* Ad-hoc debugging
|
|
|
|
|
*
|
|
|
|
|
* To keep your Git copy clean and easier to work with, it is recommended
|
|
|
|
|
* to copy this to your LocalSettings.php and enable them as-needed.
|
2022-12-23 12:14:24 +00:00
|
|
|
* These are not enabled by default as they make the wiki considerably
|
2022-04-06 00:12:40 +00:00
|
|
|
* slower and/or significantly alter how things work or look.
|
|
|
|
|
*
|
|
|
|
|
* See https://www.mediawiki.org/wiki/How_to_debug
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// $wgDebugDumpSql = true;
|
|
|
|
|
// $wgDebugRawPage = true;
|
|
|
|
|
// $wgDebugToolbar = true;
|
|
|
|
|
|
2017-10-08 20:17:35 +00:00
|
|
|
/**
|
2019-06-13 01:08:53 +00:00
|
|
|
* Debugging for PHP
|
2017-10-08 20:17:35 +00:00
|
|
|
*/
|
|
|
|
|
|
2023-09-06 21:24:49 +00:00
|
|
|
// Enable logging of all errors
|
2017-10-08 20:17:35 +00:00
|
|
|
error_reporting( -1 );
|
2023-09-06 21:24:49 +00:00
|
|
|
|
|
|
|
|
// Enable showing of errors, but avoid breaking non-HTML responses
|
|
|
|
|
if ( MW_ENTRY_POINT === 'index' ) {
|
|
|
|
|
ini_set( 'display_errors', '1' );
|
|
|
|
|
}
|
2017-10-08 20:17:35 +00:00
|
|
|
|
|
|
|
|
/**
|
2019-06-13 01:08:53 +00:00
|
|
|
* Debugging for MediaWiki
|
2017-10-08 20:17:35 +00:00
|
|
|
*/
|
2019-08-07 14:22:03 +00:00
|
|
|
|
2018-07-17 16:51:36 +00:00
|
|
|
global $wgDevelopmentWarnings, $wgShowExceptionDetails, $wgShowHostnames,
|
2023-12-14 12:33:26 +00:00
|
|
|
$wgDebugLogFile,
|
2020-09-21 16:08:42 +00:00
|
|
|
$wgDBerrorLog, $wgDebugLogGroups;
|
2017-10-08 20:17:35 +00:00
|
|
|
|
|
|
|
|
// Use of wfWarn() should cause tests to fail
|
|
|
|
|
$wgDevelopmentWarnings = true;
|
|
|
|
|
|
|
|
|
|
// Enable showing of errors
|
|
|
|
|
$wgShowExceptionDetails = true;
|
2018-07-17 16:51:36 +00:00
|
|
|
$wgShowHostnames = true;
|
2017-10-08 20:17:35 +00:00
|
|
|
|
|
|
|
|
// Enable log files
|
|
|
|
|
$logDir = getenv( 'MW_LOG_DIR' );
|
|
|
|
|
if ( $logDir ) {
|
2023-11-29 09:01:22 +00:00
|
|
|
if ( !file_exists( $logDir ) ) {
|
|
|
|
|
mkdir( $logDir );
|
|
|
|
|
}
|
2024-09-27 09:45:07 +00:00
|
|
|
$logFileNames = [
|
|
|
|
|
'debug-cli' => 'mw-debug-cli',
|
|
|
|
|
'debug-web' => 'mw-debug-web',
|
|
|
|
|
'db' => 'mw-dberror',
|
|
|
|
|
'ratelimit' => 'mw-ratelimit',
|
|
|
|
|
'error' => 'mw-error',
|
|
|
|
|
];
|
|
|
|
|
// For PHPUnit tests run in parallel via ComposerLaunchParallel,
|
|
|
|
|
// there will be an environment variable containing the group ID
|
|
|
|
|
// of the batch of tests being run in a process. Use this to group
|
|
|
|
|
// those logs together.
|
|
|
|
|
$splitGroupLogId = getenv( 'MW_PHPUNIT_SPLIT_GROUP_ID' );
|
|
|
|
|
|
|
|
|
|
foreach ( $logFileNames as $key => $logFileName ) {
|
|
|
|
|
if ( $splitGroupLogId ) {
|
|
|
|
|
$logFileNames[$key] = "$logDir/$logFileName.split-group-$splitGroupLogId.log";
|
|
|
|
|
} else {
|
|
|
|
|
$logFileNames[$key] = "$logDir/$logFileName.log";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-14 12:33:26 +00:00
|
|
|
if ( MW_ENTRY_POINT === 'cli' ) {
|
2024-09-27 09:45:07 +00:00
|
|
|
$wgDebugLogFile = $logFileNames['debug-cli'];
|
2017-10-08 20:17:35 +00:00
|
|
|
} else {
|
2024-09-27 09:45:07 +00:00
|
|
|
$wgDebugLogFile = $logFileNames['debug-web'];
|
2017-10-08 20:17:35 +00:00
|
|
|
}
|
2024-09-27 09:45:07 +00:00
|
|
|
$wgDBerrorLog = $logFileNames['db'];
|
|
|
|
|
$wgDebugLogGroups['ratelimit'] = $logFileNames['ratelimit'];
|
|
|
|
|
$wgDebugLogGroups['error'] = $logFileNames['error'];
|
|
|
|
|
$wgDebugLogGroups['exception'] = $logFileNames['error'];
|
2017-10-08 20:17:35 +00:00
|
|
|
}
|
|
|
|
|
unset( $logDir );
|
2019-06-17 09:11:39 +00:00
|
|
|
|
2019-08-07 14:22:03 +00:00
|
|
|
/**
|
|
|
|
|
* Make testing possible (or easier)
|
|
|
|
|
*/
|
|
|
|
|
|
2022-02-09 13:09:18 +00:00
|
|
|
global $wgRateLimits, $wgEnableJavaScriptTest, $wgRestAPIAdditionalRouteFiles,
|
2022-10-19 17:58:11 +00:00
|
|
|
$wgPasswordAttemptThrottle, $wgForceDeferredUpdatesPreSend,
|
|
|
|
|
$wgParsoidSettings, $wgMaxArticleSize;
|
2019-08-07 14:22:03 +00:00
|
|
|
|
2021-06-11 17:14:04 +00:00
|
|
|
// Set almost infinite rate limits. This allows integration tests to run unthrottled
|
|
|
|
|
// in CI and for devs locally (T225796), but doesn't turn a large chunk of production
|
|
|
|
|
// code completely off during testing (T284804)
|
|
|
|
|
foreach ( $wgRateLimits as $right => &$limit ) {
|
|
|
|
|
foreach ( $limit as $group => &$groupLimit ) {
|
|
|
|
|
$groupLimit[0] = PHP_INT_MAX;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-07-19 20:53:57 +00:00
|
|
|
|
2020-03-10 10:19:17 +00:00
|
|
|
// Enable Special:JavaScriptTest and allow `npm run qunit` to work
|
|
|
|
|
// https://www.mediawiki.org/wiki/Manual:JavaScript_unit_testing
|
|
|
|
|
$wgEnableJavaScriptTest = true;
|
|
|
|
|
|
2020-03-20 04:23:51 +00:00
|
|
|
// Enable development/experimental endpoints
|
2023-03-05 19:53:11 +00:00
|
|
|
$wgRestAPIAdditionalRouteFiles[] = 'includes/Rest/coreDevelopmentRoutes.json';
|
2024-09-06 11:15:21 +00:00
|
|
|
$wgRestAPIAdditionalRouteFiles[] = 'includes/Rest/content.v1.json';
|
2024-05-06 13:17:08 +00:00
|
|
|
$wgRestAPIAdditionalRouteFiles[] = 'includes/Rest/specs.v0.json';
|
2020-03-20 04:23:51 +00:00
|
|
|
|
2022-01-25 11:54:27 +00:00
|
|
|
// Greatly raise the limits on short/long term login attempts,
|
|
|
|
|
// so that automated tests run in parallel don't error.
|
|
|
|
|
$wgPasswordAttemptThrottle = [
|
|
|
|
|
[ 'count' => 1000, 'seconds' => 300 ],
|
|
|
|
|
[ 'count' => 100000, 'seconds' => 60 * 60 * 48 ],
|
|
|
|
|
];
|
|
|
|
|
|
2022-02-09 13:09:18 +00:00
|
|
|
// Run deferred updates before sending a response to the client.
|
|
|
|
|
// This ensures that in end-to-end tests, a GET request will see the
|
|
|
|
|
// effect of all previous POST requests (T230211).
|
|
|
|
|
// Caveat: this does not wait for jobs to be executed, and it does
|
|
|
|
|
// not wait for database replication to complete.
|
|
|
|
|
$wgForceDeferredUpdatesPreSend = true;
|
|
|
|
|
|
2022-07-31 09:45:00 +00:00
|
|
|
// Set size limits for parsing small enough so we can test them,
|
|
|
|
|
// but not so small that they interfere with other tests.
|
|
|
|
|
$wgMaxArticleSize = 20; // in Kilobyte
|
|
|
|
|
$wgParsoidSettings['wt2htmlLimits']['wikitextSize'] = 20 * 1024; // $wgMaxArticleSize, in byte
|
|
|
|
|
$wgParsoidSettings['html2wtLimits']['htmlSize'] = 100 * 1024; // in characters!
|
|
|
|
|
|
2022-11-15 13:14:46 +00:00
|
|
|
// Enable Vue dev mode by default, so that Vue devtools are functional.
|
|
|
|
|
$wgVueDevelopmentMode = true;
|
|
|
|
|
|
2024-04-24 07:10:36 +00:00
|
|
|
// Disable rate limiting of temp account creation and temp account name
|
|
|
|
|
// acquisition, to facilitate local development and testing
|
|
|
|
|
$wgTempAccountCreationThrottle = [];
|
|
|
|
|
$wgTempAccountNameAcquisitionThrottle = [];
|
|
|
|
|
|
2019-08-07 14:22:03 +00:00
|
|
|
/**
|
|
|
|
|
* Experimental changes that may later become the default.
|
|
|
|
|
* (Must reference a Phabricator ticket)
|
|
|
|
|
*/
|
|
|
|
|
|
2023-12-01 03:35:11 +00:00
|
|
|
global $wgSQLMode, $wgDBStrictWarnings, $wgLocalisationCacheConf, $wgCiteBookReferencing,
|
2022-10-19 17:58:11 +00:00
|
|
|
$wgCacheDirectory, $wgEnableUploads, $wgUsePigLatinVariant,
|
2024-05-14 11:52:01 +00:00
|
|
|
$wgVisualEditorEnableWikitext, $wgDefaultUserOptions, $wgAutoCreateTempUser;
|
2019-08-07 14:22:03 +00:00
|
|
|
|
|
|
|
|
// Enable MariaDB/MySQL strict mode (T108255)
|
2022-04-04 19:49:29 +00:00
|
|
|
$wgSQLMode = 'STRICT_ALL_TABLES,ONLY_FULL_GROUP_BY';
|
2023-12-01 03:35:11 +00:00
|
|
|
$wgDBStrictWarnings = true;
|
2019-08-07 14:22:03 +00:00
|
|
|
|
2019-08-08 10:37:48 +00:00
|
|
|
// Localisation Cache to StaticArray (T218207)
|
|
|
|
|
$wgLocalisationCacheConf['store'] = 'array';
|
2019-10-24 09:57:35 +00:00
|
|
|
|
|
|
|
|
// Experimental Book Referencing feature (T236255)
|
|
|
|
|
$wgCiteBookReferencing = true;
|
2020-02-29 20:36:18 +00:00
|
|
|
|
|
|
|
|
// The default value is false, but for development it is useful to set this to the system temp
|
|
|
|
|
// directory by default (T218207)
|
|
|
|
|
$wgCacheDirectory = TempFSFile::getUsableTempDirectory() .
|
|
|
|
|
DIRECTORY_SEPARATOR .
|
2023-09-06 21:24:49 +00:00
|
|
|
rawurlencode( MediaWiki\WikiMap\WikiMap::getCurrentWikiId() );
|
2019-10-24 13:43:49 +00:00
|
|
|
|
|
|
|
|
// Enable uploads for FileImporter browser tests (T190829)
|
|
|
|
|
$wgEnableUploads = true;
|
2021-01-11 11:48:08 +00:00
|
|
|
|
2022-10-19 17:58:11 +00:00
|
|
|
// Enable en-x-piglatin variant conversion for testing
|
|
|
|
|
$wgUsePigLatinVariant = true;
|
2023-09-20 13:44:20 +00:00
|
|
|
// Enable x-xss language code for testing correct message escaping
|
|
|
|
|
$wgUseXssLanguage = true;
|
2022-10-19 17:58:11 +00:00
|
|
|
|
2021-01-11 11:48:08 +00:00
|
|
|
// Enable the new wikitext mode for browser testing (T270240)
|
|
|
|
|
$wgVisualEditorEnableWikitext = true;
|
2021-01-12 08:46:21 +00:00
|
|
|
// Currently the default, but repeated here for safety since it would break many source editor tests.
|
|
|
|
|
$wgDefaultUserOptions['visualeditor-newwikitext'] = 0;
|
2024-05-14 11:52:01 +00:00
|
|
|
|
2024-05-22 20:20:00 +00:00
|
|
|
// Enable creation of temp user accounts on edit (T355880, T359043)
|
|
|
|
|
$wgAutoCreateTempUser['enabled'] = true;
|