Bump and prep 1.34.1
[lhc/web/wiklou.git] / includes / Defines.php
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
23 require_once __DIR__ . '/libs/mime/defines.php';
24 require_once __DIR__ . '/libs/rdbms/defines.php';
25
26 use Wikimedia\Rdbms\IDatabase;
27
28 /**
29 * @defgroup Constants MediaWiki constants
30 */
31
32 /**
33 * The running version of MediaWiki.
34 *
35 * This replaces the the $wgVersion global found in earlier versions.
36 *
37 * @since 1.34.1
38 */
39 define( 'MW_VERSION', '1.34.1' );
40
41 # Obsolete aliases
42
43 /** @{
44 * Obsolete IDatabase::makeList() constants
45 * These are also available as Database class constants
46 */
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 /** @} */
53
54 /** @{
55 * Virtual namespaces; don't appear in the page database
56 */
57 define( 'NS_MEDIA', -2 );
58 define( 'NS_SPECIAL', -1 );
59 /** @} */
60
61 /** @{
62 * Real namespaces
63 *
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.
68 */
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 /** @} */
86
87 /** @{
88 * Cache type
89 */
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 /** @} */
96
97 /** @{
98 * Antivirus result codes, for use in $wgAntivirusSetup.
99 */
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 /** @} */
105
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
110 */
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 /** @} */
116
117 /** @{
118 * Date format selectors; used in user preference storage and by
119 * Language::date() and co.
120 */
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 /** @} */
127
128 /** @{
129 * RecentChange type identifiers
130 */
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 /** @} */
137
138 /** @{
139 * Article edit flags
140 */
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 /** @} */
150
151 /** @{
152 * Hook support constants
153 */
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 /** @} */
159
160 /** Support for $wgResourceModules */
161 define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 );
162
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
172 */
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 /** @} */
179
180 /** @{
181 * Flags for Parser::setFunctionHook
182 * Use of Parser consts is preferred:
183 * - Parser::SFH_NO_HASH
184 * - Parser::SFH_OBJECT_ARGS
185 */
186 define( 'SFH_NO_HASH', 1 );
187 define( 'SFH_OBJECT_ARGS', 2 );
188 /** @} */
189
190 /** @{
191 * Autopromote conditions (must be here and not in Autopromote.php, so that
192 * they're loaded for DefaultSettings.php before AutoLoader.php)
193 */
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 /** @} */
204
205 /** @{
206 * Protocol constants for wfExpandUrl()
207 */
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 /** @} */
215
216 /** @{
217 * Content model ids, used by Content and ContentHandler.
218 * These IDs will be exposed in the API and XML dumps.
219 *
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'.
223 */
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 /** @} */
230
231 /** @{
232 * Content formats, used by Content and ContentHandler.
233 * These should be MIME types, and will be exposed in the API and XML dumps.
234 *
235 * Extensions are free to use the below formats, or define their own.
236 * It is recommended to stick with the conventions for MIME types.
237 */
238 // wikitext
239 define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' );
240 // for js pages
241 define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' );
242 // for css pages
243 define( 'CONTENT_FORMAT_CSS', 'text/css' );
244 // for future use, e.g. with some plain-html messages.
245 define( 'CONTENT_FORMAT_TEXT', 'text/plain' );
246 // for future use, e.g. with some plain-html messages.
247 define( 'CONTENT_FORMAT_HTML', 'text/html' );
248 // for future use with the api and for extensions
249 define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' );
250 // for future use with the api, and for use by extensions
251 define( 'CONTENT_FORMAT_JSON', 'application/json' );
252 // for future use with the api, and for use by extensions
253 define( 'CONTENT_FORMAT_XML', 'application/xml' );
254 /** @} */
255
256 /** @{
257 * Max string length for shell invocations; based on binfmts.h
258 */
259 define( 'SHELL_MAX_ARG_STRLEN', '100000' );
260 /** @} */
261
262 /** @{
263 * Schema compatibility flags.
264 *
265 * Used as flags in a bit field that indicates whether the old or new schema (or both)
266 * are read or written.
267 *
268 * - SCHEMA_COMPAT_WRITE_OLD: Whether information is written to the old schema.
269 * - SCHEMA_COMPAT_READ_OLD: Whether information stored in the old schema is read.
270 * - SCHEMA_COMPAT_WRITE_NEW: Whether information is written to the new schema.
271 * - SCHEMA_COMPAT_READ_NEW: Whether information stored in the new schema is read.
272 */
273 define( 'SCHEMA_COMPAT_WRITE_OLD', 0x01 );
274 define( 'SCHEMA_COMPAT_READ_OLD', 0x02 );
275 define( 'SCHEMA_COMPAT_WRITE_NEW', 0x10 );
276 define( 'SCHEMA_COMPAT_READ_NEW', 0x20 );
277 define( 'SCHEMA_COMPAT_WRITE_BOTH', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_WRITE_NEW );
278 define( 'SCHEMA_COMPAT_READ_BOTH', SCHEMA_COMPAT_READ_OLD | SCHEMA_COMPAT_READ_NEW );
279 define( 'SCHEMA_COMPAT_OLD', SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_READ_OLD );
280 define( 'SCHEMA_COMPAT_NEW', SCHEMA_COMPAT_WRITE_NEW | SCHEMA_COMPAT_READ_NEW );
281 /** @} */
282
283 /** @{
284 * Schema change migration flags.
285 *
286 * Used as values of a feature flag for an orderly transition from an old
287 * schema to a new schema. The numeric values of these constants are compatible with the
288 * SCHEMA_COMPAT_XXX bitfield semantics. High bits are used to ensure that the numeric
289 * ordering follows the order in which the migration stages should be used.
290 *
291 * - MIGRATION_OLD: Only read and write the old schema. The new schema need not
292 * even exist. This is used from when the patch is merged until the schema
293 * change is actually applied to the database.
294 * - MIGRATION_WRITE_BOTH: Write both the old and new schema. Read the new
295 * schema preferentially, falling back to the old. This is used while the
296 * change is being tested, allowing easy roll-back to the old schema.
297 * - MIGRATION_WRITE_NEW: Write only the new schema. Read the new schema
298 * preferentially, falling back to the old. This is used while running the
299 * maintenance script to migrate existing entries in the old schema to the
300 * new schema.
301 * - MIGRATION_NEW: Only read and write the new schema. The old schema (and the
302 * feature flag) may now be removed.
303 */
304 define( 'MIGRATION_OLD', 0x00000000 | SCHEMA_COMPAT_OLD );
305 define( 'MIGRATION_WRITE_BOTH', 0x10000000 | SCHEMA_COMPAT_READ_BOTH | SCHEMA_COMPAT_WRITE_BOTH );
306 define( 'MIGRATION_WRITE_NEW', 0x20000000 | SCHEMA_COMPAT_READ_BOTH | SCHEMA_COMPAT_WRITE_NEW );
307 define( 'MIGRATION_NEW', 0x30000000 | SCHEMA_COMPAT_NEW );
308 /** @} */
309
310 /** @{
311 * XML dump schema versions, for use with XmlDumpWriter.
312 * See also the corresponding export-nnnn.xsd files in the docs directory,
313 * which are also listed at <https://www.mediawiki.org/xml/>.
314 * Note that not all old schema versions are represented here, as several
315 * were already unsupported at the time these constants were introduced.
316 */
317 define( 'XML_DUMP_SCHEMA_VERSION_10', '0.10' );
318 define( 'XML_DUMP_SCHEMA_VERSION_11', '0.11' );
319 /** @} */