Merge "Update docs/hooks.txt for ShowSearchHitTitle"
[mediawiki.git] / includes / Defines.php
blob35c2a2d8adea2ff5edcbe0389ff20f719bb093aa
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/time/defines.php';
25 require_once __DIR__ . '/libs/rdbms/defines.php';
26 require_once __DIR__ . '/compat/normal/UtfNormalDefines.php';
28 /**
29 * @defgroup Constants MediaWiki constants
32 # Obsolete aliases
33 define( 'DB_SLAVE', -1 );
35 /**@{
36 * Obsolete IDatabase::makeList() constants
37 * These are also available as Database class constants
39 define( 'LIST_COMMA', IDatabase::LIST_COMMA );
40 define( 'LIST_AND', IDatabase::LIST_AND );
41 define( 'LIST_SET', IDatabase::LIST_SET );
42 define( 'LIST_NAMES', IDatabase::LIST_NAMES );
43 define( 'LIST_OR', IDatabase::LIST_OR );
44 /**@}*/
46 /**@{
47 * Virtual namespaces; don't appear in the page database
49 define( 'NS_MEDIA', -2 );
50 define( 'NS_SPECIAL', -1 );
51 /**@}*/
53 /**@{
54 * Real namespaces
56 * Number 100 and beyond are reserved for custom namespaces;
57 * DO NOT assign standard namespaces at 100 or beyond.
58 * DO NOT Change integer values as they are most probably hardcoded everywhere
59 * see bug #696 which talked about that.
61 define( 'NS_MAIN', 0 );
62 define( 'NS_TALK', 1 );
63 define( 'NS_USER', 2 );
64 define( 'NS_USER_TALK', 3 );
65 define( 'NS_PROJECT', 4 );
66 define( 'NS_PROJECT_TALK', 5 );
67 define( 'NS_FILE', 6 );
68 define( 'NS_FILE_TALK', 7 );
69 define( 'NS_MEDIAWIKI', 8 );
70 define( 'NS_MEDIAWIKI_TALK', 9 );
71 define( 'NS_TEMPLATE', 10 );
72 define( 'NS_TEMPLATE_TALK', 11 );
73 define( 'NS_HELP', 12 );
74 define( 'NS_HELP_TALK', 13 );
75 define( 'NS_CATEGORY', 14 );
76 define( 'NS_CATEGORY_TALK', 15 );
78 /**
79 * NS_IMAGE and NS_IMAGE_TALK are the pre-v1.14 names for NS_FILE and
80 * NS_FILE_TALK respectively, and are kept for compatibility.
82 * When writing code that should be compatible with older MediaWiki
83 * versions, either stick to the old names or define the new constants
84 * yourself, if they're not defined already.
86 * @deprecated since 1.14
88 define( 'NS_IMAGE', NS_FILE );
89 /**
90 * @deprecated since 1.14
92 define( 'NS_IMAGE_TALK', NS_FILE_TALK );
93 /**@}*/
95 /**@{
96 * Cache type
98 define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works
99 define( 'CACHE_NONE', 0 ); // Do not cache
100 define( 'CACHE_DB', 1 ); // Store cache objects in the DB
101 define( 'CACHE_MEMCACHED', 2 ); // MemCached, must specify servers in $wgMemCacheServers
102 define( 'CACHE_ACCEL', 3 ); // APC, XCache or WinCache
103 /**@}*/
105 /**@{
106 * Antivirus result codes, for use in $wgAntivirusSetup.
108 define( 'AV_NO_VIRUS', 0 ); # scan ok, no virus found
109 define( 'AV_VIRUS_FOUND', 1 ); # virus found!
110 define( 'AV_SCAN_ABORTED', -1 ); # scan aborted, the file is probably immune
111 define( 'AV_SCAN_FAILED', false ); # scan failed (scanner not found or error in scanner)
112 /**@}*/
114 /**@{
115 * Anti-lock flags
116 * Was used by $wgAntiLockFlags, which was removed with 1.25
117 * Constants kept to not have warnings when used in LocalSettings
119 define( 'ALF_PRELOAD_LINKS', 1 ); // unused
120 define( 'ALF_PRELOAD_EXISTENCE', 2 ); // unused
121 define( 'ALF_NO_LINK_LOCK', 4 ); // unused
122 define( 'ALF_NO_BLOCK_LOCK', 8 ); // unused
123 /**@}*/
125 /**@{
126 * Date format selectors; used in user preference storage and by
127 * Language::date() and co.
129 define( 'MW_DATE_DEFAULT', 'default' );
130 define( 'MW_DATE_MDY', 'mdy' );
131 define( 'MW_DATE_DMY', 'dmy' );
132 define( 'MW_DATE_YMD', 'ymd' );
133 define( 'MW_DATE_ISO', 'ISO 8601' );
134 /**@}*/
136 /**@{
137 * RecentChange type identifiers
139 define( 'RC_EDIT', 0 );
140 define( 'RC_NEW', 1 );
141 define( 'RC_LOG', 3 );
142 define( 'RC_EXTERNAL', 5 );
143 define( 'RC_CATEGORIZE', 6 );
144 /**@}*/
146 /**@{
147 * Article edit flags
149 define( 'EDIT_NEW', 1 );
150 define( 'EDIT_UPDATE', 2 );
151 define( 'EDIT_MINOR', 4 );
152 define( 'EDIT_SUPPRESS_RC', 8 );
153 define( 'EDIT_FORCE_BOT', 16 );
154 define( 'EDIT_DEFER_UPDATES', 32 ); // Unused since 1.27
155 define( 'EDIT_AUTOSUMMARY', 64 );
156 define( 'EDIT_INTERNAL', 128 );
157 /**@}*/
159 /**@{
160 * Hook support constants
162 define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 );
163 define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 );
164 define( 'MW_SUPPORTS_CONTENTHANDLER', 1 );
165 define( 'MW_EDITFILTERMERGED_SUPPORTS_API', 1 );
166 /**@}*/
168 /** Support for $wgResourceModules */
169 define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 );
171 /**@{
172 * Allowed values for Parser::$mOutputType
173 * Parameter to Parser::startExternalParse().
174 * Use of Parser consts is preferred:
175 * - Parser::OT_HTML
176 * - Parser::OT_WIKI
177 * - Parser::OT_PREPROCESS
178 * - Parser::OT_MSG
179 * - Parser::OT_PLAIN
181 define( 'OT_HTML', 1 );
182 define( 'OT_WIKI', 2 );
183 define( 'OT_PREPROCESS', 3 );
184 define( 'OT_MSG', 3 ); // b/c alias for OT_PREPROCESS
185 define( 'OT_PLAIN', 4 );
186 /**@}*/
188 /**@{
189 * Flags for Parser::setFunctionHook
190 * Use of Parser consts is preferred:
191 * - Parser::SFH_NO_HASH
192 * - Parser::SFH_OBJECT_ARGS
194 define( 'SFH_NO_HASH', 1 );
195 define( 'SFH_OBJECT_ARGS', 2 );
196 /**@}*/
198 /**@{
199 * Autopromote conditions (must be here and not in Autopromote.php, so that
200 * they're loaded for DefaultSettings.php before AutoLoader.php)
202 define( 'APCOND_EDITCOUNT', 1 );
203 define( 'APCOND_AGE', 2 );
204 define( 'APCOND_EMAILCONFIRMED', 3 );
205 define( 'APCOND_INGROUPS', 4 );
206 define( 'APCOND_ISIP', 5 );
207 define( 'APCOND_IPINRANGE', 6 );
208 define( 'APCOND_AGE_FROM_EDIT', 7 );
209 define( 'APCOND_BLOCKED', 8 );
210 define( 'APCOND_ISBOT', 9 );
211 /**@}*/
213 /** @{
214 * Protocol constants for wfExpandUrl()
216 define( 'PROTO_HTTP', 'http://' );
217 define( 'PROTO_HTTPS', 'https://' );
218 define( 'PROTO_RELATIVE', '//' );
219 define( 'PROTO_CURRENT', null );
220 define( 'PROTO_CANONICAL', 1 );
221 define( 'PROTO_INTERNAL', 2 );
222 /**@}*/
224 /**@{
225 * Content model ids, used by Content and ContentHandler.
226 * These IDs will be exposed in the API and XML dumps.
228 * Extensions that define their own content model IDs should take
229 * care to avoid conflicts. Using the extension name as a prefix is recommended,
230 * for example 'myextension-somecontent'.
232 define( 'CONTENT_MODEL_WIKITEXT', 'wikitext' );
233 define( 'CONTENT_MODEL_JAVASCRIPT', 'javascript' );
234 define( 'CONTENT_MODEL_CSS', 'css' );
235 define( 'CONTENT_MODEL_TEXT', 'text' );
236 define( 'CONTENT_MODEL_JSON', 'json' );
237 /**@}*/
239 /**@{
240 * Content formats, used by Content and ContentHandler.
241 * These should be MIME types, and will be exposed in the API and XML dumps.
243 * Extensions are free to use the below formats, or define their own.
244 * It is recommended to stick with the conventions for MIME types.
246 // wikitext
247 define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' );
248 // for js pages
249 define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' );
250 // for css pages
251 define( 'CONTENT_FORMAT_CSS', 'text/css' );
252 // for future use, e.g. with some plain-html messages.
253 define( 'CONTENT_FORMAT_TEXT', 'text/plain' );
254 // for future use, e.g. with some plain-html messages.
255 define( 'CONTENT_FORMAT_HTML', 'text/html' );
256 // for future use with the api and for extensions
257 define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' );
258 // for future use with the api, and for use by extensions
259 define( 'CONTENT_FORMAT_JSON', 'application/json' );
260 // for future use with the api, and for use by extensions
261 define( 'CONTENT_FORMAT_XML', 'application/xml' );
262 /**@}*/
264 /**@{
265 * Max string length for shell invocations; based on binfmts.h
267 define( 'SHELL_MAX_ARG_STRLEN', '100000' );
268 /**@}*/