Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 128
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * A few constants that might be needed during LocalSettings.php.
4 *
5 * @license GPL-2.0-or-later
6 * @file
7 */
8
9require_once __DIR__ . '/libs/Mime/defines.php';
10require_once __DIR__ . '/libs/Rdbms/defines.php';
11
12use Wikimedia\Rdbms\IDatabase;
13
14/**
15 * The running version of MediaWiki.
16 *
17 * This replaces the $wgVersion global found in earlier versions. When updating
18 * the XX part of 1.XX.YY, please remember to also bump the stand-alone duplicate
19 * of this in PHPVersionCheck.
20 *
21 * @since 1.35 (also backported to 1.33.3 and 1.34.1)
22 */
23define( 'MW_VERSION', '1.46.0-alpha' );
24
25/** @{
26 * Obsolete IDatabase::makeList() constants
27 * These are also available as Database class constants
28 */
29define( 'LIST_COMMA', IDatabase::LIST_COMMA );
30define( 'LIST_AND', IDatabase::LIST_AND );
31define( 'LIST_SET', IDatabase::LIST_SET );
32define( 'LIST_NAMES', IDatabase::LIST_NAMES );
33define( 'LIST_OR', IDatabase::LIST_OR );
34/** @} */
35
36/** @{
37 * Virtual namespaces; don't appear in the page database
38 */
39define( 'NS_MEDIA', -2 );
40define( 'NS_SPECIAL', -1 );
41/** @} */
42
43/** @{
44 * Real namespaces
45 *
46 * Number 100 and beyond are reserved for custom namespaces;
47 * DO NOT assign standard namespaces at 100 or beyond.
48 * DO NOT Change integer values as they are most probably hardcoded everywhere
49 * see T2696 which talked about that.
50 */
51define( 'NS_MAIN', 0 );
52define( 'NS_TALK', 1 );
53define( 'NS_USER', 2 );
54define( 'NS_USER_TALK', 3 );
55define( 'NS_PROJECT', 4 );
56define( 'NS_PROJECT_TALK', 5 );
57define( 'NS_FILE', 6 );
58define( 'NS_FILE_TALK', 7 );
59define( 'NS_MEDIAWIKI', 8 );
60define( 'NS_MEDIAWIKI_TALK', 9 );
61define( 'NS_TEMPLATE', 10 );
62define( 'NS_TEMPLATE_TALK', 11 );
63define( 'NS_HELP', 12 );
64define( 'NS_HELP_TALK', 13 );
65define( 'NS_CATEGORY', 14 );
66define( 'NS_CATEGORY_TALK', 15 );
67/** @} */
68
69/** @{
70 * Cache type
71 */
72define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works
73define( 'CACHE_NONE', 0 ); // Do not cache
74define( 'CACHE_DB', 1 ); // Store cache objects in the DB
75define( 'CACHE_MEMCACHED', 'memcached-php' ); // Backwards-compatability alias for Memcached
76define( 'CACHE_ACCEL', 3 ); // APC or APCu
77define( 'CACHE_HASH', 'hash' ); // A HashBagOStuff, mostly useful for testing. Not configurable
78/** @} */
79
80/** @{
81 * Antivirus result codes, for use in $wgAntivirusSetup.
82 */
83define( 'AV_NO_VIRUS', 0 );  # scan ok, no virus found
84define( 'AV_VIRUS_FOUND', 1 );  # virus found!
85define( 'AV_SCAN_ABORTED', -1 );  # scan aborted, the file is probably immune
86define( 'AV_SCAN_FAILED', false );  # scan failed (scanner not found or error in scanner)
87/** @} */
88
89/** @{
90 * Date format selectors; used in user preference storage and by
91 * Language::date() and co.
92 */
93define( 'MW_DATE_DEFAULT', 'default' );
94define( 'MW_DATE_MDY', 'mdy' );
95define( 'MW_DATE_DMY', 'dmy' );
96define( 'MW_DATE_YMD', 'ymd' );
97define( 'MW_DATE_ISO', 'ISO 8601' );
98/** @} */
99
100/** @{
101 * RecentChange type identifiers
102 */
103define( 'RC_EDIT', 0 );
104define( 'RC_NEW', 1 );
105define( 'RC_LOG', 3 );
106define( 'RC_EXTERNAL', 5 );
107define( 'RC_CATEGORIZE', 6 );
108/** @} */
109
110/** @{
111 * Article edit flags
112 */
113/** Article is assumed to be non-existent, fail if it exists. */
114define( 'EDIT_NEW', 1 );
115
116/** Article is assumed to be pre-existing, fail if it doesn't exist. */
117define( 'EDIT_UPDATE', 2 );
118
119/** Mark this edit minor, if the user is allowed to do so */
120define( 'EDIT_MINOR', 4 );
121
122/** Do not notify other users (e.g. via RecentChanges or watchlist) */
123define( 'EDIT_SILENT', 8 );
124
125/** @deprecated since 1.44, use EDIT_SILENT instead */
126define( 'EDIT_SUPPRESS_RC', EDIT_SILENT );
127
128/** Mark the edit a "bot" edit regardless of user rights */
129define( 'EDIT_FORCE_BOT', 16 );
130
131/** @deprecated since 1.27, updates are always deferred */
132define( 'EDIT_DEFER_UPDATES', 32 );
133
134/** Fill in blank summaries with generated text where possible */
135define( 'EDIT_AUTOSUMMARY', 64 );
136
137/** Signal that the page retrieve/save cycle happened entirely in this request. */
138define( 'EDIT_INTERNAL', 128 );
139
140/** The edit is a side effect and does not represent an active user contribution. */
141define( 'EDIT_IMPLICIT', 256 );
142/** @} */
143
144/** @{
145 * Hook support constants
146 */
147define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 );
148define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 );
149define( 'MW_SUPPORTS_CONTENTHANDLER', 1 );
150define( 'MW_EDITFILTERMERGED_SUPPORTS_API', 1 );
151/** @} */
152
153/** Support for $wgResourceModules */
154define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 );
155
156/**
157 * Indicate that the Interwiki extension should not be loaded (it is now
158 * in core).
159 */
160define( 'MW_HAS_SPECIAL_INTERWIKI', 1 );
161
162/** @{
163 * Allowed values for Parser::$mOutputType
164 * Parameter to Parser::startExternalParse().
165 * Use of Parser consts is preferred:
166 * - Parser::OT_HTML
167 * - Parser::OT_WIKI
168 * - Parser::OT_PREPROCESS
169 * - Parser::OT_PLAIN
170 */
171define( 'OT_HTML', 1 );
172define( 'OT_WIKI', 2 );
173define( 'OT_PREPROCESS', 3 );
174define( 'OT_PLAIN', 4 );
175/** @} */
176
177/** @{
178 * Flags for Parser::setFunctionHook
179 * Use of Parser consts is preferred:
180 * - Parser::SFH_NO_HASH
181 * - Parser::SFH_OBJECT_ARGS
182 */
183define( 'SFH_NO_HASH', 1 );
184define( 'SFH_OBJECT_ARGS', 2 );
185/** @} */
186
187/** @{
188 * Autopromote conditions
189 */
190define( 'APCOND_EDITCOUNT', 1 );
191define( 'APCOND_AGE', 2 );
192define( 'APCOND_EMAILCONFIRMED', 3 );
193define( 'APCOND_INGROUPS', 4 );
194define( 'APCOND_ISIP', 5 );
195define( 'APCOND_IPINRANGE', 6 );
196define( 'APCOND_AGE_FROM_EDIT', 7 );
197define( 'APCOND_BLOCKED', 8 );
198define( 'APCOND_ISBOT', 9 );
199/** @} */
200
201/** @{
202 * Conditional user defaults conditions
203 *
204 * Strings are used to make the values easier to use in extension.json
205 * @since 1.42
206 */
207define( 'CUDCOND_AFTER', 'registered-after' );
208define( 'CUDCOND_ANON', 'anonymous-user' );
209define( 'CUDCOND_NAMED', 'named-user' );
210define( 'CUDCOND_USERGROUP', 'usergroup' );
211/** @} */
212
213/** @{
214 * Protocol constants for UrlUtils::expand()
215 * PROTO_FALLBACK is @since 1.39
216 */
217define( 'PROTO_HTTP', 'http://' );
218define( 'PROTO_HTTPS', 'https://' );
219define( 'PROTO_RELATIVE', '//' );
220define( 'PROTO_FALLBACK', null );
221// Legacy alias for PROTO_FALLBACK from when the current request's protocol was always the fallback
222define( 'PROTO_CURRENT', PROTO_FALLBACK );
223define( 'PROTO_CANONICAL', 1 );
224define( 'PROTO_INTERNAL', 2 );
225/** @} */
226
227/** @{
228 * Content model ids, used by Content and ContentHandler.
229 * These IDs will be exposed in the API and XML dumps.
230 *
231 * Extensions that define their own content model IDs should take
232 * care to avoid conflicts. Using the extension name as a prefix is recommended,
233 * for example 'myextension-somecontent'.
234 */
235define( 'CONTENT_MODEL_WIKITEXT', 'wikitext' );
236define( 'CONTENT_MODEL_JAVASCRIPT', 'javascript' );
237define( 'CONTENT_MODEL_CSS', 'css' );
238define( 'CONTENT_MODEL_TEXT', 'text' );
239define( 'CONTENT_MODEL_JSON', 'json' );
240/** @since 1.45 */
241define( 'CONTENT_MODEL_VUE', 'vue' );
242define( 'CONTENT_MODEL_UNKNOWN', 'unknown' );
243/** @} */
244
245/** @{
246 * Content formats, used by Content and ContentHandler.
247 * These should be MIME types, and will be exposed in the API and XML dumps.
248 *
249 * Extensions are free to use the below formats, or define their own.
250 * It is recommended to stick with the conventions for MIME types.
251 */
252/** Wikitext */
253define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' );
254/** For JS pages */
255define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' );
256/** For CSS pages */
257define( 'CONTENT_FORMAT_CSS', 'text/css' );
258/** For Vue pages */
259define( 'CONTENT_FORMAT_VUE', 'application/vue+xml' );
260/** For future use, e.g. with some plain HTML messages. */
261define( 'CONTENT_FORMAT_TEXT', 'text/plain' );
262/** For future use, e.g. with some plain HTML messages. */
263define( 'CONTENT_FORMAT_HTML', 'text/html' );
264/** For future use with the API and for extensions */
265define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' );
266/** For future use with the API, and for use by extensions */
267define( 'CONTENT_FORMAT_JSON', 'application/json' );
268/** For future use with the API, and for use by extensions */
269define( 'CONTENT_FORMAT_XML', 'application/xml' );
270/** @} */
271
272/** @{
273 * Max string length for shell invocations; based on binfmts.h
274 */
275define( 'SHELL_MAX_ARG_STRLEN', '100000' );
276/** @} */
277
278/** @{
279 * Schema compatibility flags.
280 *
281 * Used as flags in a bit field that indicates whether the old or new schema (or both)
282 * are read or written.
283 *
284 * - SCHEMA_COMPAT_WRITE_OLD: Whether information is written to the old schema.
285 * - SCHEMA_COMPAT_READ_OLD: Whether information stored in the old schema is read.
286 * - SCHEMA_COMPAT_WRITE_TEMP: Whether information is written to a temporary
287 *   intermediate schema.
288 * - SCHEMA_COMPAT_READ_TEMP: Whether information is read from the temporary
289 *   intermediate schema.
290 * - SCHEMA_COMPAT_WRITE_NEW: Whether information is written to the new schema
291 * - SCHEMA_COMPAT_READ_NEW: Whether information is read from the new schema
292 */
293define( 'SCHEMA_COMPAT_WRITE_OLD', 0x01 );
294define( 'SCHEMA_COMPAT_READ_OLD', 0x02 );
295define( 'SCHEMA_COMPAT_WRITE_TEMP', 0x10 );
296define( 'SCHEMA_COMPAT_READ_TEMP', 0x20 );
297define( 'SCHEMA_COMPAT_WRITE_NEW', 0x100 );
298define( 'SCHEMA_COMPAT_READ_NEW', 0x200 );
299define( 'SCHEMA_COMPAT_WRITE_MASK',
300    SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_WRITE_TEMP | SCHEMA_COMPAT_WRITE_NEW );
301define( 'SCHEMA_COMPAT_READ_MASK',
302    SCHEMA_COMPAT_READ_OLD | SCHEMA_COMPAT_READ_TEMP | SCHEMA_COMPAT_READ_NEW );
303define( 'SCHEMA_COMPAT_WRITE_BOTH', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_WRITE_NEW );
304define( 'SCHEMA_COMPAT_WRITE_OLD_AND_TEMP', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_WRITE_TEMP );
305define( 'SCHEMA_COMPAT_WRITE_TEMP_AND_NEW', SCHEMA_COMPAT_WRITE_TEMP | SCHEMA_COMPAT_WRITE_NEW );
306define( 'SCHEMA_COMPAT_READ_BOTH', SCHEMA_COMPAT_READ_OLD | SCHEMA_COMPAT_READ_NEW );
307define( 'SCHEMA_COMPAT_OLD', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_READ_OLD );
308define( 'SCHEMA_COMPAT_TEMP', SCHEMA_COMPAT_WRITE_TEMP | SCHEMA_COMPAT_READ_TEMP );
309define( 'SCHEMA_COMPAT_NEW', SCHEMA_COMPAT_WRITE_NEW | SCHEMA_COMPAT_READ_NEW );
310/** @} */
311
312/** @{
313 * Schema change migration flags.
314 *
315 * Used as values of a feature flag for an orderly transition from an old
316 * schema to a new schema. The numeric values of these constants are compatible with the
317 * SCHEMA_COMPAT_XXX bitfield semantics. High bits are used to ensure that the numeric
318 * ordering follows the order in which the migration stages should be used.
319 *
320 * Do not use these constants to query the feature flag.  If you wish to check if your
321 * code should perform a particular kind of read or write operation, use the appropriate
322 * SCHEMA_COMPAT_XXX flag.  It is generally an error to use MIGRATION_XXX constants in a bitwise operation.
323 *
324 * - MIGRATION_OLD: Only read and write the old schema. The new schema need not
325 *   even exist. This is used from when the patch is merged until the schema
326 *   change is actually applied to the database.
327 * - MIGRATION_WRITE_BOTH: Write both the old and new schema. Read the new
328 *   schema preferentially, falling back to the old. This is used while the
329 *   change is being tested, allowing easy roll-back to the old schema.
330 * - MIGRATION_WRITE_NEW: Write only the new schema. Read the new schema
331 *   preferentially, falling back to the old. This is used while running the
332 *   maintenance script to migrate existing entries in the old schema to the
333 *   new schema.
334 * - MIGRATION_NEW: Only read and write the new schema. The old schema (and the
335 *   feature flag) may now be removed.
336 */
337define( 'MIGRATION_OLD', 0x00000000 | SCHEMA_COMPAT_OLD );
338define( 'MIGRATION_WRITE_BOTH', 0x10000000 | SCHEMA_COMPAT_READ_BOTH | SCHEMA_COMPAT_WRITE_BOTH );
339define( 'MIGRATION_WRITE_NEW', 0x20000000 | SCHEMA_COMPAT_READ_BOTH | SCHEMA_COMPAT_WRITE_NEW );
340define( 'MIGRATION_NEW', 0x30000000 | SCHEMA_COMPAT_NEW );
341/** @} */
342
343/** @{
344 * XML dump schema versions, for use with XmlDumpWriter.
345 * See also the corresponding export-nnnn.xsd files in the docs directory,
346 * which are also listed at <https://www.mediawiki.org/xml/>.
347 * Note that not all old schema versions are represented here, as several
348 * were already unsupported at the time these constants were introduced.
349 */
350define( 'XML_DUMP_SCHEMA_VERSION_10', '0.10' );
351define( 'XML_DUMP_SCHEMA_VERSION_11', '0.11' );
352/** @} */