Manual:Defines.php: Difference between revisions
m editace Tag: 2017 source edit |
m wrong markup :( |
||
Line 5: | Line 5: | ||
</translate> |
</translate> |
||
<translate><!--T:13--> <tvar name=1>Defines.php</tvar> contains "a few constants that might be needed during <tvar name=LocalSettings>{{ll|Manual:LocalSettings.php|LocalSettings.php}}</tvar>.</translate> |
<translate><!--T:13--> <tvar name=1>Defines.php</tvar> contains "a few constants that might be needed during <tvar name=LocalSettings>{{ll|Manual:LocalSettings.php|LocalSettings.php}}</tvar>.</translate> |
||
<translate><!--T:38--> Note: these constants must all be resolvable at compile time by <tvar name=1> |
<translate><!--T:38--> Note: these constants must all be resolvable at compile time by <tvar name=1></tvar>, since this file will not be executed during request startup for a compiled MediaWiki."</translate> |
||
<translate><!--T:37--> Among the constants are [[<tvar name=1>Special:MyLanguage/version</tvar>|version]] constants for the benefit of extensions; [[<tvar name=2>Special:MyLanguage/Unicode normalization considerations</tvar>|Unicode normalisation]] related constants; {{<tvar name=3>ll|Manual:namespace</tvar>|namespace}} constants, including those that provide support for <tvar name=4>{{ll|Manual:$wgResourceModules|$wgResourceModules}}</tvar>; protocol constants for <tvar name=5>[[wfExpandUrl]]</tvar>; and flags for <tvar name=6>{{phpi|Parser::replaceLinkHolders}}</tvar>.</translate> |
<translate><!--T:37--> Among the constants are [[<tvar name=1>Special:MyLanguage/version</tvar>|version]] constants for the benefit of extensions; [[<tvar name=2>Special:MyLanguage/Unicode normalization considerations</tvar>|Unicode normalisation]] related constants; {{<tvar name=3>ll|Manual:namespace</tvar>|namespace}} constants, including those that provide support for <tvar name=4>{{ll|Manual:$wgResourceModules|$wgResourceModules}}</tvar>; protocol constants for <tvar name=5>[[wfExpandUrl]]</tvar>; and flags for <tvar name=6>{{phpi|Parser::replaceLinkHolders}}</tvar>.</translate> |
||
Latest revision as of 22:23, 4 July 2024
MediaWiki file: Defines.php | |
---|---|
Location: | includes/ |
Source code: | master • 1.42.1 • 1.41.2 • 1.39.8 |
Classes: | Find code • Find documentation |
Details[edit]
Defines.php contains "a few constants that might be needed during LocalSettings.php .
Note: these constants must all be resolvable at compile time by HipHop, since this file will not be executed during request startup for a compiled MediaWiki."
Among the constants are version constants for the benefit of extensions; Unicode normalisation related constants; namespace constants, including those that provide support for $wgResourceModules ; protocol constants for wfExpandUrl; and flags for Parser::replaceLinkHolders
.
Constants[edit]
- Database related constants
- Valid database indexes
- Operation-based indexes
- Virtual namespaces ; don't appear in the page database
- Real namespaces
- Cache type
- Media types
- Antivirus result codes, for use in $wgAntivirusSetup
- Anti-lock flags
- Date format selectors; used in user preference storage and by Language ::date() and co.
- RecentChange type identifiers
- Article edit flags
- Flags for Database ::makeList()
- Unicode and normalisation related
- Hook support constants
- Support for $wgResourceModules
- Allowed values for Parser ::$mOutputType
- Flags for Parser::setFunctionHook
- Flags for Parser::replaceLinkHolders
- Autopromote conditions
- Protocol constants for wfExpandUrl()
- Content model ids, used by Content and ContentHandler .
- Content formats, used by Content and ContentHandler.
Flags[edit]
In some cases, bitfields are used for flags. Examples are as follows:
define( 'DBO_DEBUG', 1 );
define( 'DBO_NOBUFFER', 2 );
define( 'DBO_IGNORE', 4 );
define( 'DBO_TRX', 8 ); // automatically start transaction on first query
define( 'DBO_DEFAULT', 16 );
define( 'DBO_PERSISTENT', 32 );
define( 'DBO_SYSDBA', 64 ); // for oracle maintenance
define( 'DBO_DDLMODE', 128 ); // when using schema files: mostly for Oracle
define( 'DBO_SSL', 256 );
define( 'DBO_COMPRESS', 512 );
define( 'ALF_PRELOAD_LINKS', 1 ); // unused
define( 'ALF_PRELOAD_EXISTENCE', 2 ); // unused
define( 'ALF_NO_LINK_LOCK', 4 );
define( 'ALF_NO_BLOCK_LOCK', 8 );
define( 'EDIT_NEW', 1 );
define( 'EDIT_UPDATE', 2 );
define( 'EDIT_MINOR', 4 );
define( 'EDIT_SUPPRESS_RC', 8 );
define( 'EDIT_FORCE_BOT', 16 );
define( 'EDIT_DEFER_UPDATES', 32 );
define( 'EDIT_AUTOSUMMARY', 64 );
These involve the use of bitwise operators. E.g. if you want to set the EDIT_MINOR flag in $flags to true:
$flags |= EDIT_MINOR;
If you want to set both the EDIT_MINOR and EDIT_NEW flags in $flags to true, and all the other flags in $flags to false:
$flags = EDIT_MINOR | EDIT_NEW;
If you want to set the EDIT_MINOR flag in $flags to false:
$flags &= ~EDIT_MINOR;
If you want $isminor to only be true if the EDIT_MINOR flag is set to true in $flags:
$isminor = ( $flags & EDIT_MINOR );