Prep 1.36.1
[mediawiki.git] / includes / Defines.php
blob455b5c6d8d4387d92d7071327ed3f20f30711b62
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 * The running version of MediaWiki.
31 * This replaces the $wgVersion global found in earlier versions. When updating,
32 * remember to also bump the stand-alone duplicate of this in PHPVersionCheck.
34 * @since 1.35
36 define( 'MW_VERSION', '1.36.1' );
38 /** @{
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 );
47 /** @} */
49 /** @{
50 * Virtual namespaces; don't appear in the page database
52 define( 'NS_MEDIA', -2 );
53 define( 'NS_SPECIAL', -1 );
54 /** @} */
56 /** @{
57 * Real namespaces
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 );
80 /** @} */
82 /** @{
83 * Cache type
85 define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works
86 define( 'CACHE_NONE', 0 ); // Do not cache
87 define( 'CACHE_DB', 1 ); // Store cache objects in the DB
88 define( 'CACHE_MEMCACHED', 2 ); // MemCached, must specify servers in $wgMemCacheServers
89 define( 'CACHE_ACCEL', 3 ); // APC or WinCache
90 /** @} */
92 /** @{
93 * Antivirus result codes, for use in $wgAntivirusSetup.
95 define( 'AV_NO_VIRUS', 0 ); # scan ok, no virus found
96 define( 'AV_VIRUS_FOUND', 1 ); # virus found!
97 define( 'AV_SCAN_ABORTED', -1 ); # scan aborted, the file is probably immune
98 define( 'AV_SCAN_FAILED', false ); # scan failed (scanner not found or error in scanner)
99 /** @} */
101 /** @{
102 * Anti-lock flags
103 * Was used by $wgAntiLockFlags, which was removed with 1.25
104 * Constants kept to not have warnings when used in LocalSettings
106 define( 'ALF_PRELOAD_LINKS', 1 ); // unused
107 define( 'ALF_PRELOAD_EXISTENCE', 2 ); // unused
108 define( 'ALF_NO_LINK_LOCK', 4 ); // unused
109 define( 'ALF_NO_BLOCK_LOCK', 8 ); // unused
110 /** @} */
112 /** @{
113 * Date format selectors; used in user preference storage and by
114 * Language::date() and co.
116 define( 'MW_DATE_DEFAULT', 'default' );
117 define( 'MW_DATE_MDY', 'mdy' );
118 define( 'MW_DATE_DMY', 'dmy' );
119 define( 'MW_DATE_YMD', 'ymd' );
120 define( 'MW_DATE_ISO', 'ISO 8601' );
121 /** @} */
123 /** @{
124 * RecentChange type identifiers
126 define( 'RC_EDIT', 0 );
127 define( 'RC_NEW', 1 );
128 define( 'RC_LOG', 3 );
129 define( 'RC_EXTERNAL', 5 );
130 define( 'RC_CATEGORIZE', 6 );
131 /** @} */
133 /** @{
134 * Article edit flags
136 define( 'EDIT_NEW', 1 );
137 define( 'EDIT_UPDATE', 2 );
138 define( 'EDIT_MINOR', 4 );
139 define( 'EDIT_SUPPRESS_RC', 8 );
140 define( 'EDIT_FORCE_BOT', 16 );
141 define( 'EDIT_DEFER_UPDATES', 32 ); // Unused since 1.27
142 define( 'EDIT_AUTOSUMMARY', 64 );
143 define( 'EDIT_INTERNAL', 128 );
144 /** @} */
146 /** @{
147 * Hook support constants
149 define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 );
150 define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 );
151 define( 'MW_SUPPORTS_CONTENTHANDLER', 1 );
152 define( 'MW_EDITFILTERMERGED_SUPPORTS_API', 1 );
153 /** @} */
155 /** Support for $wgResourceModules */
156 define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 );
158 /** @{
159 * Allowed values for Parser::$mOutputType
160 * Parameter to Parser::startExternalParse().
161 * Use of Parser consts is preferred:
162 * - Parser::OT_HTML
163 * - Parser::OT_WIKI
164 * - Parser::OT_PREPROCESS
165 * - Parser::OT_MSG
166 * - Parser::OT_PLAIN
168 define( 'OT_HTML', 1 );
169 define( 'OT_WIKI', 2 );
170 define( 'OT_PREPROCESS', 3 );
171 define( 'OT_MSG', 3 ); // b/c alias for OT_PREPROCESS
172 define( 'OT_PLAIN', 4 );
173 /** @} */
175 /** @{
176 * Flags for Parser::setFunctionHook
177 * Use of Parser consts is preferred:
178 * - Parser::SFH_NO_HASH
179 * - Parser::SFH_OBJECT_ARGS
181 define( 'SFH_NO_HASH', 1 );
182 define( 'SFH_OBJECT_ARGS', 2 );
183 /** @} */
185 /** @{
186 * Autopromote conditions (must be here, so that they're loaded for
187 * DefaultSettings.php before AutoLoader.php)
189 define( 'APCOND_EDITCOUNT', 1 );
190 define( 'APCOND_AGE', 2 );
191 define( 'APCOND_EMAILCONFIRMED', 3 );
192 define( 'APCOND_INGROUPS', 4 );
193 define( 'APCOND_ISIP', 5 );
194 define( 'APCOND_IPINRANGE', 6 );
195 define( 'APCOND_AGE_FROM_EDIT', 7 );
196 define( 'APCOND_BLOCKED', 8 );
197 define( 'APCOND_ISBOT', 9 );
198 /** @} */
200 /** @{
201 * Protocol constants for wfExpandUrl()
203 define( 'PROTO_HTTP', 'http://' );
204 define( 'PROTO_HTTPS', 'https://' );
205 define( 'PROTO_RELATIVE', '//' );
206 define( 'PROTO_CURRENT', null );
207 define( 'PROTO_CANONICAL', 1 );
208 define( 'PROTO_INTERNAL', 2 );
209 /** @} */
211 /** @{
212 * Content model ids, used by Content and ContentHandler.
213 * These IDs will be exposed in the API and XML dumps.
215 * Extensions that define their own content model IDs should take
216 * care to avoid conflicts. Using the extension name as a prefix is recommended,
217 * for example 'myextension-somecontent'.
219 define( 'CONTENT_MODEL_WIKITEXT', 'wikitext' );
220 define( 'CONTENT_MODEL_JAVASCRIPT', 'javascript' );
221 define( 'CONTENT_MODEL_CSS', 'css' );
222 define( 'CONTENT_MODEL_TEXT', 'text' );
223 define( 'CONTENT_MODEL_JSON', 'json' );
224 define( 'CONTENT_MODEL_UNKNOWN', 'unknown' );
225 /** @} */
227 /** @{
228 * Content formats, used by Content and ContentHandler.
229 * These should be MIME types, and will be exposed in the API and XML dumps.
231 * Extensions are free to use the below formats, or define their own.
232 * It is recommended to stick with the conventions for MIME types.
234 /** Wikitext */
235 define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' );
236 /** For JS pages */
237 define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' );
238 /** For CSS pages */
239 define( 'CONTENT_FORMAT_CSS', 'text/css' );
240 /** For future use, e.g. with some plain HTML messages. */
241 define( 'CONTENT_FORMAT_TEXT', 'text/plain' );
242 /** For future use, e.g. with some plain HTML messages. */
243 define( 'CONTENT_FORMAT_HTML', 'text/html' );
244 /** For future use with the API and for extensions */
245 define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' );
246 /** For future use with the API, and for use by extensions */
247 define( 'CONTENT_FORMAT_JSON', 'application/json' );
248 /** For future use with the API, and for use by extensions */
249 define( 'CONTENT_FORMAT_XML', 'application/xml' );
250 /** @} */
252 /** @{
253 * Max string length for shell invocations; based on binfmts.h
255 define( 'SHELL_MAX_ARG_STRLEN', '100000' );
256 /** @} */
258 /** @{
259 * Schema compatibility flags.
261 * Used as flags in a bit field that indicates whether the old or new schema (or both)
262 * are read or written.
264 * - SCHEMA_COMPAT_WRITE_OLD: Whether information is written to the old schema.
265 * - SCHEMA_COMPAT_READ_OLD: Whether information stored in the old schema is read.
266 * - SCHEMA_COMPAT_WRITE_NEW: Whether information is written to the new schema.
267 * - SCHEMA_COMPAT_READ_NEW: Whether information stored in the new schema is read.
269 define( 'SCHEMA_COMPAT_WRITE_OLD', 0x01 );
270 define( 'SCHEMA_COMPAT_READ_OLD', 0x02 );
271 define( 'SCHEMA_COMPAT_WRITE_NEW', 0x10 );
272 define( 'SCHEMA_COMPAT_READ_NEW', 0x20 );
273 define( 'SCHEMA_COMPAT_WRITE_BOTH', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_WRITE_NEW );
274 define( 'SCHEMA_COMPAT_READ_BOTH', SCHEMA_COMPAT_READ_OLD | SCHEMA_COMPAT_READ_NEW );
275 define( 'SCHEMA_COMPAT_OLD', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_READ_OLD );
276 define( 'SCHEMA_COMPAT_NEW', SCHEMA_COMPAT_WRITE_NEW | SCHEMA_COMPAT_READ_NEW );
277 /** @} */
279 /** @{
280 * Schema change migration flags.
282 * Used as values of a feature flag for an orderly transition from an old
283 * schema to a new schema. The numeric values of these constants are compatible with the
284 * SCHEMA_COMPAT_XXX bitfield semantics. High bits are used to ensure that the numeric
285 * ordering follows the order in which the migration stages should be used.
287 * - MIGRATION_OLD: Only read and write the old schema. The new schema need not
288 * even exist. This is used from when the patch is merged until the schema
289 * change is actually applied to the database.
290 * - MIGRATION_WRITE_BOTH: Write both the old and new schema. Read the new
291 * schema preferentially, falling back to the old. This is used while the
292 * change is being tested, allowing easy roll-back to the old schema.
293 * - MIGRATION_WRITE_NEW: Write only the new schema. Read the new schema
294 * preferentially, falling back to the old. This is used while running the
295 * maintenance script to migrate existing entries in the old schema to the
296 * new schema.
297 * - MIGRATION_NEW: Only read and write the new schema. The old schema (and the
298 * feature flag) may now be removed.
300 define( 'MIGRATION_OLD', 0x00000000 | SCHEMA_COMPAT_OLD );
301 define( 'MIGRATION_WRITE_BOTH', 0x10000000 | SCHEMA_COMPAT_READ_BOTH | SCHEMA_COMPAT_WRITE_BOTH );
302 define( 'MIGRATION_WRITE_NEW', 0x20000000 | SCHEMA_COMPAT_READ_BOTH | SCHEMA_COMPAT_WRITE_NEW );
303 define( 'MIGRATION_NEW', 0x30000000 | SCHEMA_COMPAT_NEW );
304 /** @} */
306 /** @{
307 * XML dump schema versions, for use with XmlDumpWriter.
308 * See also the corresponding export-nnnn.xsd files in the docs directory,
309 * which are also listed at <https://www.mediawiki.org/xml/>.
310 * Note that not all old schema versions are represented here, as several
311 * were already unsupported at the time these constants were introduced.
313 define( 'XML_DUMP_SCHEMA_VERSION_10', '0.10' );
314 define( 'XML_DUMP_SCHEMA_VERSION_11', '0.11' );
315 /** @} */