Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 56 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | /** |
3 | * Extra settings useful for MediaWiki development. |
4 | * |
5 | * To enable built-in debug and development settings, add the |
6 | * following to your LocalSettings.php file. |
7 | * |
8 | * require "$IP/includes/DevelopmentSettings.php"; |
9 | * |
10 | * @file |
11 | */ |
12 | |
13 | /** |
14 | * Ad-hoc debugging |
15 | * |
16 | * To keep your Git copy clean and easier to work with, it is recommended |
17 | * to copy this to your LocalSettings.php and enable them as-needed. |
18 | * These are not enabled by default as they make the wiki considerably |
19 | * slower and/or significantly alter how things work or look. |
20 | * |
21 | * See https://www.mediawiki.org/wiki/How_to_debug |
22 | */ |
23 | |
24 | // $wgDebugDumpSql = true; |
25 | // $wgDebugRawPage = true; |
26 | // $wgDebugToolbar = true; |
27 | |
28 | /** |
29 | * Debugging for PHP |
30 | */ |
31 | |
32 | // Enable logging of all errors |
33 | error_reporting( -1 ); |
34 | |
35 | // Enable showing of errors, but avoid breaking non-HTML responses |
36 | if ( MW_ENTRY_POINT === 'index' ) { |
37 | ini_set( 'display_errors', '1' ); |
38 | } |
39 | |
40 | /** |
41 | * Debugging for MediaWiki |
42 | */ |
43 | |
44 | global $wgDevelopmentWarnings, $wgShowExceptionDetails, $wgShowHostnames, |
45 | $wgDebugLogFile, |
46 | $wgDBerrorLog, $wgDebugLogGroups; |
47 | |
48 | // Use of wfWarn() should cause tests to fail |
49 | $wgDevelopmentWarnings = true; |
50 | |
51 | // Enable showing of errors |
52 | $wgShowExceptionDetails = true; |
53 | $wgShowHostnames = true; |
54 | |
55 | // Enable log files |
56 | $logDir = getenv( 'MW_LOG_DIR' ); |
57 | if ( $logDir ) { |
58 | if ( !file_exists( $logDir ) ) { |
59 | mkdir( $logDir ); |
60 | } |
61 | if ( MW_ENTRY_POINT === 'cli' ) { |
62 | $wgDebugLogFile = "$logDir/mw-debug-cli.log"; |
63 | } else { |
64 | $wgDebugLogFile = "$logDir/mw-debug-www.log"; |
65 | } |
66 | $wgDBerrorLog = "$logDir/mw-dberror.log"; |
67 | $wgDebugLogGroups['ratelimit'] = "$logDir/mw-ratelimit.log"; |
68 | $wgDebugLogGroups['error'] = "$logDir/mw-error.log"; |
69 | $wgDebugLogGroups['exception'] = "$logDir/mw-error.log"; |
70 | } |
71 | unset( $logDir ); |
72 | |
73 | /** |
74 | * Make testing possible (or easier) |
75 | */ |
76 | |
77 | global $wgRateLimits, $wgEnableJavaScriptTest, $wgRestAPIAdditionalRouteFiles, |
78 | $wgPasswordAttemptThrottle, $wgForceDeferredUpdatesPreSend, |
79 | $wgParsoidSettings, $wgMaxArticleSize; |
80 | |
81 | // Set almost infinite rate limits. This allows integration tests to run unthrottled |
82 | // in CI and for devs locally (T225796), but doesn't turn a large chunk of production |
83 | // code completely off during testing (T284804) |
84 | foreach ( $wgRateLimits as $right => &$limit ) { |
85 | foreach ( $limit as $group => &$groupLimit ) { |
86 | $groupLimit[0] = PHP_INT_MAX; |
87 | } |
88 | } |
89 | |
90 | // Enable Special:JavaScriptTest and allow `npm run qunit` to work |
91 | // https://www.mediawiki.org/wiki/Manual:JavaScript_unit_testing |
92 | $wgEnableJavaScriptTest = true; |
93 | |
94 | // Enable development/experimental endpoints |
95 | $wgRestAPIAdditionalRouteFiles[] = 'includes/Rest/coreDevelopmentRoutes.json'; |
96 | |
97 | // Greatly raise the limits on short/long term login attempts, |
98 | // so that automated tests run in parallel don't error. |
99 | $wgPasswordAttemptThrottle = [ |
100 | [ 'count' => 1000, 'seconds' => 300 ], |
101 | [ 'count' => 100000, 'seconds' => 60 * 60 * 48 ], |
102 | ]; |
103 | |
104 | // Run deferred updates before sending a response to the client. |
105 | // This ensures that in end-to-end tests, a GET request will see the |
106 | // effect of all previous POST requests (T230211). |
107 | // Caveat: this does not wait for jobs to be executed, and it does |
108 | // not wait for database replication to complete. |
109 | $wgForceDeferredUpdatesPreSend = true; |
110 | |
111 | // Set size limits for parsing small enough so we can test them, |
112 | // but not so small that they interfere with other tests. |
113 | $wgMaxArticleSize = 20; // in Kilobyte |
114 | $wgParsoidSettings['wt2htmlLimits']['wikitextSize'] = 20 * 1024; // $wgMaxArticleSize, in byte |
115 | $wgParsoidSettings['html2wtLimits']['htmlSize'] = 100 * 1024; // in characters! |
116 | |
117 | // Enable Vue dev mode by default, so that Vue devtools are functional. |
118 | $wgVueDevelopmentMode = true; |
119 | |
120 | // Disable rate limiting of temp account creation and temp account name |
121 | // acquisition, to facilitate local development and testing |
122 | $wgTempAccountCreationThrottle = []; |
123 | $wgTempAccountNameAcquisitionThrottle = []; |
124 | |
125 | /** |
126 | * Experimental changes that may later become the default. |
127 | * (Must reference a Phabricator ticket) |
128 | */ |
129 | |
130 | global $wgSQLMode, $wgDBStrictWarnings, $wgLocalisationCacheConf, $wgCiteBookReferencing, |
131 | $wgCacheDirectory, $wgEnableUploads, $wgUsePigLatinVariant, |
132 | $wgVisualEditorEnableWikitext, $wgDefaultUserOptions, $wgAutoCreateTempUser; |
133 | |
134 | // Enable MariaDB/MySQL strict mode (T108255) |
135 | $wgSQLMode = 'STRICT_ALL_TABLES,ONLY_FULL_GROUP_BY'; |
136 | $wgDBStrictWarnings = true; |
137 | |
138 | // Localisation Cache to StaticArray (T218207) |
139 | $wgLocalisationCacheConf['store'] = 'array'; |
140 | |
141 | // Experimental Book Referencing feature (T236255) |
142 | $wgCiteBookReferencing = true; |
143 | |
144 | // The default value is false, but for development it is useful to set this to the system temp |
145 | // directory by default (T218207) |
146 | $wgCacheDirectory = TempFSFile::getUsableTempDirectory() . |
147 | DIRECTORY_SEPARATOR . |
148 | rawurlencode( MediaWiki\WikiMap\WikiMap::getCurrentWikiId() ); |
149 | |
150 | // Enable uploads for FileImporter browser tests (T190829) |
151 | $wgEnableUploads = true; |
152 | |
153 | // Enable en-x-piglatin variant conversion for testing |
154 | $wgUsePigLatinVariant = true; |
155 | // Enable x-xss language code for testing correct message escaping |
156 | $wgUseXssLanguage = true; |
157 | |
158 | // Enable the new wikitext mode for browser testing (T270240) |
159 | $wgVisualEditorEnableWikitext = true; |
160 | // Currently the default, but repeated here for safety since it would break many source editor tests. |
161 | $wgDefaultUserOptions['visualeditor-newwikitext'] = 0; |
162 | |
163 | // Enable creation of temp user accounts on edit (T355880, T359043) |
164 | $wgAutoCreateTempUser['enabled'] = true; |