CentralIdLookup: Add @since to factoryNonLocal()
[mediawiki.git] / includes / Defines.php
blob4fa9a49f2e34c253759838340ea5de1ed7202046
1 <?php
2 /**
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
20 * @file
23 require_once __DIR__ . '/libs/mime/defines.php';
24 require_once __DIR__ . '/libs/rdbms/defines.php';
26 use Wikimedia\Rdbms\IDatabase;
28 /**
29 * @defgroup Constants MediaWiki constants
32 /**
33 * The running version of MediaWiki.
35 * This replaces the $wgVersion global found in earlier versions.
37 * @since 1.35
39 define( 'MW_VERSION', '1.36.0-alpha' );
41 # Obsolete aliases
43 /** @{
44 * Obsolete IDatabase::makeList() constants
45 * These are also available as Database class constants
47 define( 'LIST_COMMA', IDatabase::LIST_COMMA );
48 define( 'LIST_AND', IDatabase::LIST_AND );
49 define( 'LIST_SET', IDatabase::LIST_SET );
50 define( 'LIST_NAMES', IDatabase::LIST_NAMES );
51 define( 'LIST_OR', IDatabase::LIST_OR );
52 /** @} */
54 /** @{
55 * Virtual namespaces; don't appear in the page database
57 define( 'NS_MEDIA', -2 );
58 define( 'NS_SPECIAL', -1 );
59 /** @} */
61 /** @{
62 * Real namespaces
64 * Number 100 and beyond are reserved for custom namespaces;
65 * DO NOT assign standard namespaces at 100 or beyond.
66 * DO NOT Change integer values as they are most probably hardcoded everywhere
67 * see T2696 which talked about that.
69 define( 'NS_MAIN', 0 );
70 define( 'NS_TALK', 1 );
71 define( 'NS_USER', 2 );
72 define( 'NS_USER_TALK', 3 );
73 define( 'NS_PROJECT', 4 );
74 define( 'NS_PROJECT_TALK', 5 );
75 define( 'NS_FILE', 6 );
76 define( 'NS_FILE_TALK', 7 );
77 define( 'NS_MEDIAWIKI', 8 );
78 define( 'NS_MEDIAWIKI_TALK', 9 );
79 define( 'NS_TEMPLATE', 10 );
80 define( 'NS_TEMPLATE_TALK', 11 );
81 define( 'NS_HELP', 12 );
82 define( 'NS_HELP_TALK', 13 );
83 define( 'NS_CATEGORY', 14 );
84 define( 'NS_CATEGORY_TALK', 15 );
85 /** @} */
87 /** @{
88 * Cache type
90 define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works
91 define( 'CACHE_NONE', 0 ); // Do not cache
92 define( 'CACHE_DB', 1 ); // Store cache objects in the DB
93 define( 'CACHE_MEMCACHED', 2 ); // MemCached, must specify servers in $wgMemCacheServers
94 define( 'CACHE_ACCEL', 3 ); // APC or WinCache
95 /** @} */
97 /** @{
98 * Antivirus result codes, for use in $wgAntivirusSetup.
100 define( 'AV_NO_VIRUS', 0 ); # scan ok, no virus found
101 define( 'AV_VIRUS_FOUND', 1 ); # virus found!
102 define( 'AV_SCAN_ABORTED', -1 ); # scan aborted, the file is probably immune
103 define( 'AV_SCAN_FAILED', false ); # scan failed (scanner not found or error in scanner)
104 /** @} */
106 /** @{
107 * Anti-lock flags
108 * Was used by $wgAntiLockFlags, which was removed with 1.25
109 * Constants kept to not have warnings when used in LocalSettings
111 define( 'ALF_PRELOAD_LINKS', 1 ); // unused
112 define( 'ALF_PRELOAD_EXISTENCE', 2 ); // unused
113 define( 'ALF_NO_LINK_LOCK', 4 ); // unused
114 define( 'ALF_NO_BLOCK_LOCK', 8 ); // unused
115 /** @} */
117 /** @{
118 * Date format selectors; used in user preference storage and by
119 * Language::date() and co.
121 define( 'MW_DATE_DEFAULT', 'default' );
122 define( 'MW_DATE_MDY', 'mdy' );
123 define( 'MW_DATE_DMY', 'dmy' );
124 define( 'MW_DATE_YMD', 'ymd' );
125 define( 'MW_DATE_ISO', 'ISO 8601' );
126 /** @} */
128 /** @{
129 * RecentChange type identifiers
131 define( 'RC_EDIT', 0 );
132 define( 'RC_NEW', 1 );
133 define( 'RC_LOG', 3 );
134 define( 'RC_EXTERNAL', 5 );
135 define( 'RC_CATEGORIZE', 6 );
136 /** @} */
138 /** @{
139 * Article edit flags
141 define( 'EDIT_NEW', 1 );
142 define( 'EDIT_UPDATE', 2 );
143 define( 'EDIT_MINOR', 4 );
144 define( 'EDIT_SUPPRESS_RC', 8 );
145 define( 'EDIT_FORCE_BOT', 16 );
146 define( 'EDIT_DEFER_UPDATES', 32 ); // Unused since 1.27
147 define( 'EDIT_AUTOSUMMARY', 64 );
148 define( 'EDIT_INTERNAL', 128 );
149 /** @} */
151 /** @{
152 * Hook support constants
154 define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 );
155 define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 );
156 define( 'MW_SUPPORTS_CONTENTHANDLER', 1 );
157 define( 'MW_EDITFILTERMERGED_SUPPORTS_API', 1 );
158 /** @} */
160 /** Support for $wgResourceModules */
161 define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 );
163 /** @{
164 * Allowed values for Parser::$mOutputType
165 * Parameter to Parser::startExternalParse().
166 * Use of Parser consts is preferred:
167 * - Parser::OT_HTML
168 * - Parser::OT_WIKI
169 * - Parser::OT_PREPROCESS
170 * - Parser::OT_MSG
171 * - Parser::OT_PLAIN
173 define( 'OT_HTML', 1 );
174 define( 'OT_WIKI', 2 );
175 define( 'OT_PREPROCESS', 3 );
176 define( 'OT_MSG', 3 ); // b/c alias for OT_PREPROCESS
177 define( 'OT_PLAIN', 4 );
178 /** @} */
180 /** @{
181 * Flags for Parser::setFunctionHook
182 * Use of Parser consts is preferred:
183 * - Parser::SFH_NO_HASH
184 * - Parser::SFH_OBJECT_ARGS
186 define( 'SFH_NO_HASH', 1 );
187 define( 'SFH_OBJECT_ARGS', 2 );
188 /** @} */
190 /** @{
191 * Autopromote conditions ( must be here, so that they're loaded for
192 * DefaultSettings.php before AutoLoader.php)
194 define( 'APCOND_EDITCOUNT', 1 );
195 define( 'APCOND_AGE', 2 );
196 define( 'APCOND_EMAILCONFIRMED', 3 );
197 define( 'APCOND_INGROUPS', 4 );
198 define( 'APCOND_ISIP', 5 );
199 define( 'APCOND_IPINRANGE', 6 );
200 define( 'APCOND_AGE_FROM_EDIT', 7 );
201 define( 'APCOND_BLOCKED', 8 );
202 define( 'APCOND_ISBOT', 9 );
203 /** @} */
205 /** @{
206 * Protocol constants for wfExpandUrl()
208 define( 'PROTO_HTTP', 'http://' );
209 define( 'PROTO_HTTPS', 'https://' );
210 define( 'PROTO_RELATIVE', '//' );
211 define( 'PROTO_CURRENT', null );
212 define( 'PROTO_CANONICAL', 1 );
213 define( 'PROTO_INTERNAL', 2 );
214 /** @} */
216 /** @{
217 * Content model ids, used by Content and ContentHandler.
218 * These IDs will be exposed in the API and XML dumps.
220 * Extensions that define their own content model IDs should take
221 * care to avoid conflicts. Using the extension name as a prefix is recommended,
222 * for example 'myextension-somecontent'.
224 define( 'CONTENT_MODEL_WIKITEXT', 'wikitext' );
225 define( 'CONTENT_MODEL_JAVASCRIPT', 'javascript' );
226 define( 'CONTENT_MODEL_CSS', 'css' );
227 define( 'CONTENT_MODEL_TEXT', 'text' );
228 define( 'CONTENT_MODEL_JSON', 'json' );
229 define( 'CONTENT_MODEL_UNKNOWN', 'unknown' );
230 /** @} */
232 /** @{
233 * Content formats, used by Content and ContentHandler.
234 * These should be MIME types, and will be exposed in the API and XML dumps.
236 * Extensions are free to use the below formats, or define their own.
237 * It is recommended to stick with the conventions for MIME types.
239 // wikitext
240 define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' );
241 // for js pages
242 define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' );
243 // for css pages
244 define( 'CONTENT_FORMAT_CSS', 'text/css' );
245 // for future use, e.g. with some plain-html messages.
246 define( 'CONTENT_FORMAT_TEXT', 'text/plain' );
247 // for future use, e.g. with some plain-html messages.
248 define( 'CONTENT_FORMAT_HTML', 'text/html' );
249 // for future use with the api and for extensions
250 define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' );
251 // for future use with the api, and for use by extensions
252 define( 'CONTENT_FORMAT_JSON', 'application/json' );
253 // for future use with the api, and for use by extensions
254 define( 'CONTENT_FORMAT_XML', 'application/xml' );
255 /** @} */
257 /** @{
258 * Max string length for shell invocations; based on binfmts.h
260 define( 'SHELL_MAX_ARG_STRLEN', '100000' );
261 /** @} */
263 /** @{
264 * Schema compatibility flags.
266 * Used as flags in a bit field that indicates whether the old or new schema (or both)
267 * are read or written.
269 * - SCHEMA_COMPAT_WRITE_OLD: Whether information is written to the old schema.
270 * - SCHEMA_COMPAT_READ_OLD: Whether information stored in the old schema is read.
271 * - SCHEMA_COMPAT_WRITE_NEW: Whether information is written to the new schema.
272 * - SCHEMA_COMPAT_READ_NEW: Whether information stored in the new schema is read.
274 define( 'SCHEMA_COMPAT_WRITE_OLD', 0x01 );
275 define( 'SCHEMA_COMPAT_READ_OLD', 0x02 );
276 define( 'SCHEMA_COMPAT_WRITE_NEW', 0x10 );
277 define( 'SCHEMA_COMPAT_READ_NEW', 0x20 );
278 define( 'SCHEMA_COMPAT_WRITE_BOTH', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_WRITE_NEW );
279 define( 'SCHEMA_COMPAT_READ_BOTH', SCHEMA_COMPAT_READ_OLD | SCHEMA_COMPAT_READ_NEW );
280 define( 'SCHEMA_COMPAT_OLD', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_READ_OLD );
281 define( 'SCHEMA_COMPAT_NEW', SCHEMA_COMPAT_WRITE_NEW | SCHEMA_COMPAT_READ_NEW );
282 /** @} */
284 /** @{
285 * Schema change migration flags.
287 * Used as values of a feature flag for an orderly transition from an old
288 * schema to a new schema. The numeric values of these constants are compatible with the
289 * SCHEMA_COMPAT_XXX bitfield semantics. High bits are used to ensure that the numeric
290 * ordering follows the order in which the migration stages should be used.
292 * - MIGRATION_OLD: Only read and write the old schema. The new schema need not
293 * even exist. This is used from when the patch is merged until the schema
294 * change is actually applied to the database.
295 * - MIGRATION_WRITE_BOTH: Write both the old and new schema. Read the new
296 * schema preferentially, falling back to the old. This is used while the
297 * change is being tested, allowing easy roll-back to the old schema.
298 * - MIGRATION_WRITE_NEW: Write only the new schema. Read the new schema
299 * preferentially, falling back to the old. This is used while running the
300 * maintenance script to migrate existing entries in the old schema to the
301 * new schema.
302 * - MIGRATION_NEW: Only read and write the new schema. The old schema (and the
303 * feature flag) may now be removed.
305 define( 'MIGRATION_OLD', 0x00000000 | SCHEMA_COMPAT_OLD );
306 define( 'MIGRATION_WRITE_BOTH', 0x10000000 | SCHEMA_COMPAT_READ_BOTH | SCHEMA_COMPAT_WRITE_BOTH );
307 define( 'MIGRATION_WRITE_NEW', 0x20000000 | SCHEMA_COMPAT_READ_BOTH | SCHEMA_COMPAT_WRITE_NEW );
308 define( 'MIGRATION_NEW', 0x30000000 | SCHEMA_COMPAT_NEW );
309 /** @} */
311 /** @{
312 * XML dump schema versions, for use with XmlDumpWriter.
313 * See also the corresponding export-nnnn.xsd files in the docs directory,
314 * which are also listed at <https://www.mediawiki.org/xml/>.
315 * Note that not all old schema versions are represented here, as several
316 * were already unsupported at the time these constants were introduced.
318 define( 'XML_DUMP_SCHEMA_VERSION_10', '0.10' );
319 define( 'XML_DUMP_SCHEMA_VERSION_11', '0.11' );
320 /** @} */