Merge "Move OrderedStreamingForkController class from CirrusSearch to core."
[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 require_once __DIR__ . '/compat/normal/UtfNormalDefines.php';
26
27 use Wikimedia\Rdbms\IDatabase;
28
29 /**
30 * @defgroup Constants MediaWiki constants
31 */
32
33 # Obsolete aliases
34 /**
35 * @deprecated since 1.28
36 */
37 define( 'DB_SLAVE', -1 );
38
39 /**@{
40 * Obsolete IDatabase::makeList() constants
41 * These are also available as Database class constants
42 */
43 define( 'LIST_COMMA', IDatabase::LIST_COMMA );
44 define( 'LIST_AND', IDatabase::LIST_AND );
45 define( 'LIST_SET', IDatabase::LIST_SET );
46 define( 'LIST_NAMES', IDatabase::LIST_NAMES );
47 define( 'LIST_OR', IDatabase::LIST_OR );
48 /**@}*/
49
50 /**@{
51 * Virtual namespaces; don't appear in the page database
52 */
53 define( 'NS_MEDIA', -2 );
54 define( '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 bug #696 which talked about that.
64 */
65 define( 'NS_MAIN', 0 );
66 define( 'NS_TALK', 1 );
67 define( 'NS_USER', 2 );
68 define( 'NS_USER_TALK', 3 );
69 define( 'NS_PROJECT', 4 );
70 define( 'NS_PROJECT_TALK', 5 );
71 define( 'NS_FILE', 6 );
72 define( 'NS_FILE_TALK', 7 );
73 define( 'NS_MEDIAWIKI', 8 );
74 define( 'NS_MEDIAWIKI_TALK', 9 );
75 define( 'NS_TEMPLATE', 10 );
76 define( 'NS_TEMPLATE_TALK', 11 );
77 define( 'NS_HELP', 12 );
78 define( 'NS_HELP_TALK', 13 );
79 define( 'NS_CATEGORY', 14 );
80 define( 'NS_CATEGORY_TALK', 15 );
81
82 /**
83 * NS_IMAGE and NS_IMAGE_TALK are the pre-v1.14 names for NS_FILE and
84 * NS_FILE_TALK respectively, and are kept for compatibility.
85 *
86 * When writing code that should be compatible with older MediaWiki
87 * versions, either stick to the old names or define the new constants
88 * yourself, if they're not defined already.
89 *
90 * @deprecated since 1.14
91 */
92 define( 'NS_IMAGE', NS_FILE );
93 /**
94 * @deprecated since 1.14
95 */
96 define( 'NS_IMAGE_TALK', NS_FILE_TALK );
97 /**@}*/
98
99 /**@{
100 * Cache type
101 */
102 define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works
103 define( 'CACHE_NONE', 0 ); // Do not cache
104 define( 'CACHE_DB', 1 ); // Store cache objects in the DB
105 define( 'CACHE_MEMCACHED', 2 ); // MemCached, must specify servers in $wgMemCacheServers
106 define( 'CACHE_ACCEL', 3 ); // APC, XCache or WinCache
107 /**@}*/
108
109 /**@{
110 * Antivirus result codes, for use in $wgAntivirusSetup.
111 */
112 define( 'AV_NO_VIRUS', 0 ); # scan ok, no virus found
113 define( 'AV_VIRUS_FOUND', 1 ); # virus found!
114 define( 'AV_SCAN_ABORTED', -1 ); # scan aborted, the file is probably immune
115 define( 'AV_SCAN_FAILED', false ); # scan failed (scanner not found or error in scanner)
116 /**@}*/
117
118 /**@{
119 * Anti-lock flags
120 * Was used by $wgAntiLockFlags, which was removed with 1.25
121 * Constants kept to not have warnings when used in LocalSettings
122 */
123 define( 'ALF_PRELOAD_LINKS', 1 ); // unused
124 define( 'ALF_PRELOAD_EXISTENCE', 2 ); // unused
125 define( 'ALF_NO_LINK_LOCK', 4 ); // unused
126 define( 'ALF_NO_BLOCK_LOCK', 8 ); // unused
127 /**@}*/
128
129 /**@{
130 * Date format selectors; used in user preference storage and by
131 * Language::date() and co.
132 */
133 define( 'MW_DATE_DEFAULT', 'default' );
134 define( 'MW_DATE_MDY', 'mdy' );
135 define( 'MW_DATE_DMY', 'dmy' );
136 define( 'MW_DATE_YMD', 'ymd' );
137 define( 'MW_DATE_ISO', 'ISO 8601' );
138 /**@}*/
139
140 /**@{
141 * RecentChange type identifiers
142 */
143 define( 'RC_EDIT', 0 );
144 define( 'RC_NEW', 1 );
145 define( 'RC_LOG', 3 );
146 define( 'RC_EXTERNAL', 5 );
147 define( 'RC_CATEGORIZE', 6 );
148 /**@}*/
149
150 /**@{
151 * Article edit flags
152 */
153 define( 'EDIT_NEW', 1 );
154 define( 'EDIT_UPDATE', 2 );
155 define( 'EDIT_MINOR', 4 );
156 define( 'EDIT_SUPPRESS_RC', 8 );
157 define( 'EDIT_FORCE_BOT', 16 );
158 define( 'EDIT_DEFER_UPDATES', 32 ); // Unused since 1.27
159 define( 'EDIT_AUTOSUMMARY', 64 );
160 define( 'EDIT_INTERNAL', 128 );
161 /**@}*/
162
163 /**@{
164 * Hook support constants
165 */
166 define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 );
167 define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 );
168 define( 'MW_SUPPORTS_CONTENTHANDLER', 1 );
169 define( 'MW_EDITFILTERMERGED_SUPPORTS_API', 1 );
170 /**@}*/
171
172 /** Support for $wgResourceModules */
173 define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 );
174
175 /**@{
176 * Allowed values for Parser::$mOutputType
177 * Parameter to Parser::startExternalParse().
178 * Use of Parser consts is preferred:
179 * - Parser::OT_HTML
180 * - Parser::OT_WIKI
181 * - Parser::OT_PREPROCESS
182 * - Parser::OT_MSG
183 * - Parser::OT_PLAIN
184 */
185 define( 'OT_HTML', 1 );
186 define( 'OT_WIKI', 2 );
187 define( 'OT_PREPROCESS', 3 );
188 define( 'OT_MSG', 3 ); // b/c alias for OT_PREPROCESS
189 define( 'OT_PLAIN', 4 );
190 /**@}*/
191
192 /**@{
193 * Flags for Parser::setFunctionHook
194 * Use of Parser consts is preferred:
195 * - Parser::SFH_NO_HASH
196 * - Parser::SFH_OBJECT_ARGS
197 */
198 define( 'SFH_NO_HASH', 1 );
199 define( 'SFH_OBJECT_ARGS', 2 );
200 /**@}*/
201
202 /**@{
203 * Autopromote conditions (must be here and not in Autopromote.php, so that
204 * they're loaded for DefaultSettings.php before AutoLoader.php)
205 */
206 define( 'APCOND_EDITCOUNT', 1 );
207 define( 'APCOND_AGE', 2 );
208 define( 'APCOND_EMAILCONFIRMED', 3 );
209 define( 'APCOND_INGROUPS', 4 );
210 define( 'APCOND_ISIP', 5 );
211 define( 'APCOND_IPINRANGE', 6 );
212 define( 'APCOND_AGE_FROM_EDIT', 7 );
213 define( 'APCOND_BLOCKED', 8 );
214 define( 'APCOND_ISBOT', 9 );
215 /**@}*/
216
217 /** @{
218 * Protocol constants for wfExpandUrl()
219 */
220 define( 'PROTO_HTTP', 'http://' );
221 define( 'PROTO_HTTPS', 'https://' );
222 define( 'PROTO_RELATIVE', '//' );
223 define( 'PROTO_CURRENT', null );
224 define( 'PROTO_CANONICAL', 1 );
225 define( 'PROTO_INTERNAL', 2 );
226 /**@}*/
227
228 /**@{
229 * Content model ids, used by Content and ContentHandler.
230 * These IDs will be exposed in the API and XML dumps.
231 *
232 * Extensions that define their own content model IDs should take
233 * care to avoid conflicts. Using the extension name as a prefix is recommended,
234 * for example 'myextension-somecontent'.
235 */
236 define( 'CONTENT_MODEL_WIKITEXT', 'wikitext' );
237 define( 'CONTENT_MODEL_JAVASCRIPT', 'javascript' );
238 define( 'CONTENT_MODEL_CSS', 'css' );
239 define( 'CONTENT_MODEL_TEXT', 'text' );
240 define( 'CONTENT_MODEL_JSON', 'json' );
241 /**@}*/
242
243 /**@{
244 * Content formats, used by Content and ContentHandler.
245 * These should be MIME types, and will be exposed in the API and XML dumps.
246 *
247 * Extensions are free to use the below formats, or define their own.
248 * It is recommended to stick with the conventions for MIME types.
249 */
250 // wikitext
251 define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' );
252 // for js pages
253 define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' );
254 // for css pages
255 define( 'CONTENT_FORMAT_CSS', 'text/css' );
256 // for future use, e.g. with some plain-html messages.
257 define( 'CONTENT_FORMAT_TEXT', 'text/plain' );
258 // for future use, e.g. with some plain-html messages.
259 define( 'CONTENT_FORMAT_HTML', 'text/html' );
260 // for future use with the api and for extensions
261 define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' );
262 // for future use with the api, and for use by extensions
263 define( 'CONTENT_FORMAT_JSON', 'application/json' );
264 // for future use with the api, and for use by extensions
265 define( 'CONTENT_FORMAT_XML', 'application/xml' );
266 /**@}*/
267
268 /**@{
269 * Max string length for shell invocations; based on binfmts.h
270 */
271 define( 'SHELL_MAX_ARG_STRLEN', '100000' );
272 /**@}*/
273
274 /**@{
275 * Schema change migration flags.
276 *
277 * Used as values of a feature flag for an orderly transition from an old
278 * schema to a new schema.
279 *
280 * - MIGRATION_OLD: Only read and write the old schema. The new schema need not
281 * even exist. This is used from when the patch is merged until the schema
282 * change is actually applied to the database.
283 * - MIGRATION_WRITE_BOTH: Write both the old and new schema. Read the new
284 * schema preferentially, falling back to the old. This is used while the
285 * change is being tested, allowing easy roll-back to the old schema.
286 * - MIGRATION_WRITE_NEW: Write only the new schema. Read the new schema
287 * preferentially, falling back to the old. This is used while running the
288 * maintenance script to migrate existing entries in the old schema to the
289 * new schema.
290 * - MIGRATION_NEW: Only read and write the new schema. The old schema (and the
291 * feature flag) may now be removed.
292 */
293 define( 'MIGRATION_OLD', 0 );
294 define( 'MIGRATION_WRITE_BOTH', 1 );
295 define( 'MIGRATION_WRITE_NEW', 2 );
296 define( 'MIGRATION_NEW', 3 );
297 /**@}*/