3 * A few constants that might be needed during LocalSettings.php.
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.
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.
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
23 require_once __DIR__
. '/libs/mime/defines.php';
24 require_once __DIR__
. '/libs/rdbms/defines.php';
26 use Wikimedia\Rdbms\IDatabase
;
29 * @defgroup Constants MediaWiki constants
34 * @deprecated since 1.28, use DB_REPLICA instead
36 define( 'DB_SLAVE', -1 );
39 * Obsolete IDatabase::makeList() constants
40 * These are also available as Database class constants
42 define( 'LIST_COMMA', IDatabase
::LIST_COMMA
);
43 define( 'LIST_AND', IDatabase
::LIST_AND
);
44 define( 'LIST_SET', IDatabase
::LIST_SET
);
45 define( 'LIST_NAMES', IDatabase
::LIST_NAMES
);
46 define( 'LIST_OR', IDatabase
::LIST_OR
);
50 * Virtual namespaces; don't appear in the page database
52 define( 'NS_MEDIA', -2 );
53 define( 'NS_SPECIAL', -1 );
59 * Number 100 and beyond are reserved for custom namespaces;
60 * DO NOT assign standard namespaces at 100 or beyond.
61 * DO NOT Change integer values as they are most probably hardcoded everywhere
62 * see T2696 which talked about that.
64 define( 'NS_MAIN', 0 );
65 define( 'NS_TALK', 1 );
66 define( 'NS_USER', 2 );
67 define( 'NS_USER_TALK', 3 );
68 define( 'NS_PROJECT', 4 );
69 define( 'NS_PROJECT_TALK', 5 );
70 define( 'NS_FILE', 6 );
71 define( 'NS_FILE_TALK', 7 );
72 define( 'NS_MEDIAWIKI', 8 );
73 define( 'NS_MEDIAWIKI_TALK', 9 );
74 define( 'NS_TEMPLATE', 10 );
75 define( 'NS_TEMPLATE_TALK', 11 );
76 define( 'NS_HELP', 12 );
77 define( 'NS_HELP_TALK', 13 );
78 define( 'NS_CATEGORY', 14 );
79 define( 'NS_CATEGORY_TALK', 15 );
82 * NS_IMAGE and NS_IMAGE_TALK are the pre-v1.14 names for NS_FILE and
83 * NS_FILE_TALK respectively, and are kept for compatibility.
85 * When writing code that should be compatible with older MediaWiki
86 * versions, either stick to the old names or define the new constants
87 * yourself, if they're not defined already.
89 * @deprecated since 1.14
91 define( 'NS_IMAGE', NS_FILE
);
93 * @deprecated since 1.14
95 define( 'NS_IMAGE_TALK', NS_FILE_TALK
);
101 define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works
102 define( 'CACHE_NONE', 0 ); // Do not cache
103 define( 'CACHE_DB', 1 ); // Store cache objects in the DB
104 define( 'CACHE_MEMCACHED', 2 ); // MemCached, must specify servers in $wgMemCacheServers
105 define( 'CACHE_ACCEL', 3 ); // APC or WinCache
109 * Antivirus result codes, for use in $wgAntivirusSetup.
111 define( 'AV_NO_VIRUS', 0 ); # scan ok, no virus found
112 define( 'AV_VIRUS_FOUND', 1 ); # virus found!
113 define( 'AV_SCAN_ABORTED', -1 ); # scan aborted, the file is probably immune
114 define( 'AV_SCAN_FAILED', false ); # scan failed (scanner not found or error in scanner)
119 * Was used by $wgAntiLockFlags, which was removed with 1.25
120 * Constants kept to not have warnings when used in LocalSettings
122 define( 'ALF_PRELOAD_LINKS', 1 ); // unused
123 define( 'ALF_PRELOAD_EXISTENCE', 2 ); // unused
124 define( 'ALF_NO_LINK_LOCK', 4 ); // unused
125 define( 'ALF_NO_BLOCK_LOCK', 8 ); // unused
129 * Date format selectors; used in user preference storage and by
130 * Language::date() and co.
132 define( 'MW_DATE_DEFAULT', 'default' );
133 define( 'MW_DATE_MDY', 'mdy' );
134 define( 'MW_DATE_DMY', 'dmy' );
135 define( 'MW_DATE_YMD', 'ymd' );
136 define( 'MW_DATE_ISO', 'ISO 8601' );
140 * RecentChange type identifiers
142 define( 'RC_EDIT', 0 );
143 define( 'RC_NEW', 1 );
144 define( 'RC_LOG', 3 );
145 define( 'RC_EXTERNAL', 5 );
146 define( 'RC_CATEGORIZE', 6 );
152 define( 'EDIT_NEW', 1 );
153 define( 'EDIT_UPDATE', 2 );
154 define( 'EDIT_MINOR', 4 );
155 define( 'EDIT_SUPPRESS_RC', 8 );
156 define( 'EDIT_FORCE_BOT', 16 );
157 define( 'EDIT_DEFER_UPDATES', 32 ); // Unused since 1.27
158 define( 'EDIT_AUTOSUMMARY', 64 );
159 define( 'EDIT_INTERNAL', 128 );
163 * Hook support constants
165 define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 );
166 define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 );
167 define( 'MW_SUPPORTS_CONTENTHANDLER', 1 );
168 define( 'MW_EDITFILTERMERGED_SUPPORTS_API', 1 );
171 /** Support for $wgResourceModules */
172 define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 );
175 * Allowed values for Parser::$mOutputType
176 * Parameter to Parser::startExternalParse().
177 * Use of Parser consts is preferred:
180 * - Parser::OT_PREPROCESS
184 define( 'OT_HTML', 1 );
185 define( 'OT_WIKI', 2 );
186 define( 'OT_PREPROCESS', 3 );
187 define( 'OT_MSG', 3 ); // b/c alias for OT_PREPROCESS
188 define( 'OT_PLAIN', 4 );
192 * Flags for Parser::setFunctionHook
193 * Use of Parser consts is preferred:
194 * - Parser::SFH_NO_HASH
195 * - Parser::SFH_OBJECT_ARGS
197 define( 'SFH_NO_HASH', 1 );
198 define( 'SFH_OBJECT_ARGS', 2 );
202 * Autopromote conditions (must be here and not in Autopromote.php, so that
203 * they're loaded for DefaultSettings.php before AutoLoader.php)
205 define( 'APCOND_EDITCOUNT', 1 );
206 define( 'APCOND_AGE', 2 );
207 define( 'APCOND_EMAILCONFIRMED', 3 );
208 define( 'APCOND_INGROUPS', 4 );
209 define( 'APCOND_ISIP', 5 );
210 define( 'APCOND_IPINRANGE', 6 );
211 define( 'APCOND_AGE_FROM_EDIT', 7 );
212 define( 'APCOND_BLOCKED', 8 );
213 define( 'APCOND_ISBOT', 9 );
217 * Protocol constants for wfExpandUrl()
219 define( 'PROTO_HTTP', 'http://' );
220 define( 'PROTO_HTTPS', 'https://' );
221 define( 'PROTO_RELATIVE', '//' );
222 define( 'PROTO_CURRENT', null );
223 define( 'PROTO_CANONICAL', 1 );
224 define( 'PROTO_INTERNAL', 2 );
228 * Content model ids, used by Content and ContentHandler.
229 * These IDs will be exposed in the API and XML dumps.
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'.
235 define( 'CONTENT_MODEL_WIKITEXT', 'wikitext' );
236 define( 'CONTENT_MODEL_JAVASCRIPT', 'javascript' );
237 define( 'CONTENT_MODEL_CSS', 'css' );
238 define( 'CONTENT_MODEL_TEXT', 'text' );
239 define( 'CONTENT_MODEL_JSON', 'json' );
243 * Content formats, used by Content and ContentHandler.
244 * These should be MIME types, and will be exposed in the API and XML dumps.
246 * Extensions are free to use the below formats, or define their own.
247 * It is recommended to stick with the conventions for MIME types.
250 define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' );
252 define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' );
254 define( 'CONTENT_FORMAT_CSS', 'text/css' );
255 // for future use, e.g. with some plain-html messages.
256 define( 'CONTENT_FORMAT_TEXT', 'text/plain' );
257 // for future use, e.g. with some plain-html messages.
258 define( 'CONTENT_FORMAT_HTML', 'text/html' );
259 // for future use with the api and for extensions
260 define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' );
261 // for future use with the api, and for use by extensions
262 define( 'CONTENT_FORMAT_JSON', 'application/json' );
263 // for future use with the api, and for use by extensions
264 define( 'CONTENT_FORMAT_XML', 'application/xml' );
268 * Max string length for shell invocations; based on binfmts.h
270 define( 'SHELL_MAX_ARG_STRLEN', '100000' );
274 * Schema compatibility flags.
276 * Used as flags in a bit field that indicates whether the old or new schema (or both)
277 * are read or written.
279 * - SCHEMA_COMPAT_WRITE_OLD: Whether information is written to the old schema.
280 * - SCHEMA_COMPAT_READ_OLD: Whether information stored in the old schema is read.
281 * - SCHEMA_COMPAT_WRITE_NEW: Whether information is written to the new schema.
282 * - SCHEMA_COMPAT_READ_NEW: Whether information stored in the new schema is read.
284 define( 'SCHEMA_COMPAT_WRITE_OLD', 0x01 );
285 define( 'SCHEMA_COMPAT_READ_OLD', 0x02 );
286 define( 'SCHEMA_COMPAT_WRITE_NEW', 0x10 );
287 define( 'SCHEMA_COMPAT_READ_NEW', 0x20 );
288 define( 'SCHEMA_COMPAT_WRITE_BOTH', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_WRITE_NEW
);
289 define( 'SCHEMA_COMPAT_READ_BOTH', SCHEMA_COMPAT_READ_OLD | SCHEMA_COMPAT_READ_NEW
);
290 define( 'SCHEMA_COMPAT_OLD', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_READ_OLD
);
291 define( 'SCHEMA_COMPAT_NEW', SCHEMA_COMPAT_WRITE_NEW | SCHEMA_COMPAT_READ_NEW
);
295 * Schema change migration flags.
297 * Used as values of a feature flag for an orderly transition from an old
298 * schema to a new schema. The numeric values of these constants are compatible with the
299 * SCHEMA_COMPAT_XXX bitfield semantics. High bits are used to ensure that the numeric
300 * ordering follows the order in which the migration stages should be used.
302 * - MIGRATION_OLD: Only read and write the old schema. The new schema need not
303 * even exist. This is used from when the patch is merged until the schema
304 * change is actually applied to the database.
305 * - MIGRATION_WRITE_BOTH: Write both the old and new schema. Read the new
306 * schema preferentially, falling back to the old. This is used while the
307 * change is being tested, allowing easy roll-back to the old schema.
308 * - MIGRATION_WRITE_NEW: Write only the new schema. Read the new schema
309 * preferentially, falling back to the old. This is used while running the
310 * maintenance script to migrate existing entries in the old schema to the
312 * - MIGRATION_NEW: Only read and write the new schema. The old schema (and the
313 * feature flag) may now be removed.
315 define( 'MIGRATION_OLD', 0x00000000 | SCHEMA_COMPAT_OLD
);
316 define( 'MIGRATION_WRITE_BOTH', 0x10000000 | SCHEMA_COMPAT_READ_BOTH | SCHEMA_COMPAT_WRITE_BOTH
);
317 define( 'MIGRATION_WRITE_NEW', 0x20000000 | SCHEMA_COMPAT_READ_BOTH | SCHEMA_COMPAT_WRITE_NEW
);
318 define( 'MIGRATION_NEW', 0x30000000 | SCHEMA_COMPAT_NEW
);