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