Merge "PrefixSearch: Implement searching in multiple namespaces"
[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 /**
24 * @defgroup Constants MediaWiki constants
25 */
26
27 # Obsolete aliases
28 define( 'DB_SLAVE', -1 );
29
30 /**@{
31 * Virtual namespaces; don't appear in the page database
32 */
33 define( 'NS_MEDIA', -2 );
34 define( 'NS_SPECIAL', -1 );
35 /**@}*/
36
37 /**@{
38 * Real namespaces
39 *
40 * Number 100 and beyond are reserved for custom namespaces;
41 * DO NOT assign standard namespaces at 100 or beyond.
42 * DO NOT Change integer values as they are most probably hardcoded everywhere
43 * see bug #696 which talked about that.
44 */
45 define( 'NS_MAIN', 0 );
46 define( 'NS_TALK', 1 );
47 define( 'NS_USER', 2 );
48 define( 'NS_USER_TALK', 3 );
49 define( 'NS_PROJECT', 4 );
50 define( 'NS_PROJECT_TALK', 5 );
51 define( 'NS_FILE', 6 );
52 define( 'NS_FILE_TALK', 7 );
53 define( 'NS_MEDIAWIKI', 8 );
54 define( 'NS_MEDIAWIKI_TALK', 9 );
55 define( 'NS_TEMPLATE', 10 );
56 define( 'NS_TEMPLATE_TALK', 11 );
57 define( 'NS_HELP', 12 );
58 define( 'NS_HELP_TALK', 13 );
59 define( 'NS_CATEGORY', 14 );
60 define( 'NS_CATEGORY_TALK', 15 );
61
62 /**
63 * NS_IMAGE and NS_IMAGE_TALK are the pre-v1.14 names for NS_FILE and
64 * NS_FILE_TALK respectively, and are kept for compatibility.
65 *
66 * When writing code that should be compatible with older MediaWiki
67 * versions, either stick to the old names or define the new constants
68 * yourself, if they're not defined already.
69 */
70 define( 'NS_IMAGE', NS_FILE );
71 define( 'NS_IMAGE_TALK', NS_FILE_TALK );
72 /**@}*/
73
74 /**@{
75 * Cache type
76 */
77 define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works
78 define( 'CACHE_NONE', 0 ); // Do not cache
79 define( 'CACHE_DB', 1 ); // Store cache objects in the DB
80 define( 'CACHE_MEMCACHED', 2 ); // MemCached, must specify servers in $wgMemCacheServers
81 define( 'CACHE_ACCEL', 3 ); // APC, XCache or WinCache
82 /**@}*/
83
84 /**@{
85 * Media types.
86 * This defines constants for the value returned by File::getMediaType()
87 */
88 // unknown format
89 define( 'MEDIATYPE_UNKNOWN', 'UNKNOWN' );
90 // some bitmap image or image source (like psd, etc). Can't scale up.
91 define( 'MEDIATYPE_BITMAP', 'BITMAP' );
92 // some vector drawing (SVG, WMF, PS, ...) or image source (oo-draw, etc). Can scale up.
93 define( 'MEDIATYPE_DRAWING', 'DRAWING' );
94 // simple audio file (ogg, mp3, wav, midi, whatever)
95 define( 'MEDIATYPE_AUDIO', 'AUDIO' );
96 // simple video file (ogg, mpg, etc;
97 // no not include formats here that may contain executable sections or scripts!)
98 define( 'MEDIATYPE_VIDEO', 'VIDEO' );
99 // Scriptable Multimedia (flash, advanced video container formats, etc)
100 define( 'MEDIATYPE_MULTIMEDIA', 'MULTIMEDIA' );
101 // Office Documents, Spreadsheets (office formats possibly containing apples, scripts, etc)
102 define( 'MEDIATYPE_OFFICE', 'OFFICE' );
103 // Plain text (possibly containing program code or scripts)
104 define( 'MEDIATYPE_TEXT', 'TEXT' );
105 // binary executable
106 define( 'MEDIATYPE_EXECUTABLE', 'EXECUTABLE' );
107 // archive file (zip, tar, etc)
108 define( 'MEDIATYPE_ARCHIVE', 'ARCHIVE' );
109 /**@}*/
110
111 /**@{
112 * Antivirus result codes, for use in $wgAntivirusSetup.
113 */
114 define( 'AV_NO_VIRUS', 0 ); # scan ok, no virus found
115 define( 'AV_VIRUS_FOUND', 1 ); # virus found!
116 define( 'AV_SCAN_ABORTED', -1 ); # scan aborted, the file is probably immune
117 define( 'AV_SCAN_FAILED', false ); # scan failed (scanner not found or error in scanner)
118 /**@}*/
119
120 /**@{
121 * Anti-lock flags
122 * Was used by $wgAntiLockFlags, which was removed with 1.25
123 * Constants kept to not have warnings when used in LocalSettings
124 */
125 define( 'ALF_PRELOAD_LINKS', 1 ); // unused
126 define( 'ALF_PRELOAD_EXISTENCE', 2 ); // unused
127 define( 'ALF_NO_LINK_LOCK', 4 ); // unused
128 define( 'ALF_NO_BLOCK_LOCK', 8 ); // unused
129 /**@}*/
130
131 /**@{
132 * Date format selectors; used in user preference storage and by
133 * Language::date() and co.
134 */
135 define( 'MW_DATE_DEFAULT', 'default' );
136 define( 'MW_DATE_MDY', 'mdy' );
137 define( 'MW_DATE_DMY', 'dmy' );
138 define( 'MW_DATE_YMD', 'ymd' );
139 define( 'MW_DATE_ISO', 'ISO 8601' );
140 /**@}*/
141
142 /**@{
143 * RecentChange type identifiers
144 */
145 define( 'RC_EDIT', 0 );
146 define( 'RC_NEW', 1 );
147 define( 'RC_LOG', 3 );
148 define( 'RC_EXTERNAL', 5 );
149 define( 'RC_CATEGORIZE', 6 );
150 /**@}*/
151
152 /**@{
153 * Article edit flags
154 */
155 define( 'EDIT_NEW', 1 );
156 define( 'EDIT_UPDATE', 2 );
157 define( 'EDIT_MINOR', 4 );
158 define( 'EDIT_SUPPRESS_RC', 8 );
159 define( 'EDIT_FORCE_BOT', 16 );
160 define( 'EDIT_DEFER_UPDATES', 32 ); // Unused since 1.27
161 define( 'EDIT_AUTOSUMMARY', 64 );
162 define( 'EDIT_INTERNAL', 128 );
163 /**@}*/
164
165 /**
166 * Database related
167 */
168 require_once __DIR__ . '/libs/rdbms/defines.php';
169
170 /**
171 * Unicode and normalisation related
172 */
173 require_once __DIR__ . '/compat/normal/UtfNormalDefines.php';
174
175 /**@{
176 * Hook support constants
177 */
178 define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 );
179 define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 );
180 define( 'MW_SUPPORTS_CONTENTHANDLER', 1 );
181 define( 'MW_EDITFILTERMERGED_SUPPORTS_API', 1 );
182 /**@}*/
183
184 /** Support for $wgResourceModules */
185 define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 );
186
187 /**@{
188 * Allowed values for Parser::$mOutputType
189 * Parameter to Parser::startExternalParse().
190 * Use of Parser consts is preferred:
191 * - Parser::OT_HTML
192 * - Parser::OT_WIKI
193 * - Parser::OT_PREPROCESS
194 * - Parser::OT_MSG
195 * - Parser::OT_PLAIN
196 */
197 define( 'OT_HTML', 1 );
198 define( 'OT_WIKI', 2 );
199 define( 'OT_PREPROCESS', 3 );
200 define( 'OT_MSG', 3 ); // b/c alias for OT_PREPROCESS
201 define( 'OT_PLAIN', 4 );
202 /**@}*/
203
204 /**@{
205 * Flags for Parser::setFunctionHook
206 * Use of Parser consts is preferred:
207 * - Parser::SFH_NO_HASH
208 * - Parser::SFH_OBJECT_ARGS
209 */
210 define( 'SFH_NO_HASH', 1 );
211 define( 'SFH_OBJECT_ARGS', 2 );
212 /**@}*/
213
214 /**@{
215 * Autopromote conditions (must be here and not in Autopromote.php, so that
216 * they're loaded for DefaultSettings.php before AutoLoader.php)
217 */
218 define( 'APCOND_EDITCOUNT', 1 );
219 define( 'APCOND_AGE', 2 );
220 define( 'APCOND_EMAILCONFIRMED', 3 );
221 define( 'APCOND_INGROUPS', 4 );
222 define( 'APCOND_ISIP', 5 );
223 define( 'APCOND_IPINRANGE', 6 );
224 define( 'APCOND_AGE_FROM_EDIT', 7 );
225 define( 'APCOND_BLOCKED', 8 );
226 define( 'APCOND_ISBOT', 9 );
227 /**@}*/
228
229 /** @{
230 * Protocol constants for wfExpandUrl()
231 */
232 define( 'PROTO_HTTP', 'http://' );
233 define( 'PROTO_HTTPS', 'https://' );
234 define( 'PROTO_RELATIVE', '//' );
235 define( 'PROTO_CURRENT', null );
236 define( 'PROTO_CANONICAL', 1 );
237 define( 'PROTO_INTERNAL', 2 );
238 /**@}*/
239
240 /**@{
241 * Content model ids, used by Content and ContentHandler.
242 * These IDs will be exposed in the API and XML dumps.
243 *
244 * Extensions that define their own content model IDs should take
245 * care to avoid conflicts. Using the extension name as a prefix is recommended,
246 * for example 'myextension-somecontent'.
247 */
248 define( 'CONTENT_MODEL_WIKITEXT', 'wikitext' );
249 define( 'CONTENT_MODEL_JAVASCRIPT', 'javascript' );
250 define( 'CONTENT_MODEL_CSS', 'css' );
251 define( 'CONTENT_MODEL_TEXT', 'text' );
252 define( 'CONTENT_MODEL_JSON', 'json' );
253 /**@}*/
254
255 /**@{
256 * Content formats, used by Content and ContentHandler.
257 * These should be MIME types, and will be exposed in the API and XML dumps.
258 *
259 * Extensions are free to use the below formats, or define their own.
260 * It is recommended to stick with the conventions for MIME types.
261 */
262 // wikitext
263 define( 'CONTENT_FORMAT_WIKITEXT', 'text/x-wiki' );
264 // for js pages
265 define( 'CONTENT_FORMAT_JAVASCRIPT', 'text/javascript' );
266 // for css pages
267 define( 'CONTENT_FORMAT_CSS', 'text/css' );
268 // for future use, e.g. with some plain-html messages.
269 define( 'CONTENT_FORMAT_TEXT', 'text/plain' );
270 // for future use, e.g. with some plain-html messages.
271 define( 'CONTENT_FORMAT_HTML', 'text/html' );
272 // for future use with the api and for extensions
273 define( 'CONTENT_FORMAT_SERIALIZED', 'application/vnd.php.serialized' );
274 // for future use with the api, and for use by extensions
275 define( 'CONTENT_FORMAT_JSON', 'application/json' );
276 // for future use with the api, and for use by extensions
277 define( 'CONTENT_FORMAT_XML', 'application/xml' );
278 /**@}*/
279
280 /**@{
281 * Max string length for shell invocations; based on binfmts.h
282 */
283 define( 'SHELL_MAX_ARG_STRLEN', '100000' );
284 /**@}*/