MediaWiki
REL1_19
|
Global functions used everywhere. More...
Go to the source code of this file.
Enumerations | |
enum | TS_DB |
MySQL DATETIME (YYYY-MM-DD HH:MM:SS) More... | |
enum | TS_DB2 |
DB2 format time. More... | |
enum | TS_EXIF |
An Exif timestamp (YYYY:MM:DD HH:MM:SS) More... | |
enum | TS_ISO_8601 |
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z. More... | |
enum | TS_ISO_8601_BASIC |
ISO 8601 basic format with no timezone: 19860209T200000Z. More... | |
enum | TS_MW |
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS) More... | |
enum | TS_ORACLE |
Oracle format time. More... | |
enum | TS_POSTGRES |
Postgres format time. More... | |
enum | TS_RFC2822 |
RFC 2822 format, for E-mail and HTTP headers. More... | |
enum | TS_UNIX |
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC. More... | |
Functions | |
in_string ($needle, $str, $insensitive=false) | |
Find out whether or not a mixed variable exists in a string. | |
mimeTypeMatch ($type, $avail) | |
Checks if a given MIME type matches any of the keys in the given array. | |
swap (&$x, &$y) | |
Swap two variables. | |
wfAcceptToPrefs ($accept, $def= '*/*') | |
Converts an Accept-* header into an array mapping string values to quality factors. | |
wfAppendQuery ($url, $query) | |
Append a query string to an existing URL, which may or may not already have query string parameters already. | |
wfAppendToArrayIfNotDefault ($key, $value, $default, &$changed) | |
Appends to second array if $value differs from that in $default. | |
if(!defined( 'MEDIAWIKI')) | wfArrayDiff2 ($a, $b) |
Like array_diff( $a, $b ) except that it works with two-dimensional arrays. | |
wfArrayDiff2_cmp ($a, $b) | |
wfArrayInsertAfter ($array, $insert, $after) | |
Insert array into another array after the specified *KEY*. | |
wfArrayLookup ($a, $b) | |
Array lookup Returns an array where the values in the first array are replaced by the values in the second array with the corresponding keys. | |
wfArrayMap ($function, $input) | |
Wrapper around array_map() which also taints variables. | |
wfArrayMerge ($array1) | |
Backwards array plus for people who haven't bothered to read the PHP manual XXX: will not darn your socks for you. | |
wfArrayToCGI ($array1, $array2=null, $prefix= '') | |
This function takes two arrays as input, and returns a CGI-style string, e.g. | |
wfAssembleUrl ($urlParts) | |
This function will reassemble a URL parsed with wfParseURL. | |
wfBacktrace () | |
Get a debug backtrace as a string. | |
wfBaseConvert ($input, $sourceBase, $destBase, $pad=1, $lowercase=true) | |
Convert an arbitrarily-long digit string from one numeric base to another, optionally zero-padding to a minimum column width. | |
wfBaseName ($path, $suffix= '') | |
Return the final portion of a pathname. | |
wfBCP47 ($code) | |
Get the normalised IETF language tag See unit test for examples. | |
wfBoolToStr ($value) | |
Convenience function converts boolean values into "true" or "false" (string) values. | |
wfCgiToArray ($query) | |
This is the logical opposite of wfArrayToCGI(): it accepts a query string as its argument and returns the same string in array form. | |
wfCheckEntropy () | |
Check if there is sufficent entropy in php's built-in session generation PHP's built-in session entropy is enabled if: | |
wfCheckLimits ($deflimit=50, $optionname= 'rclimit') | |
Obtain the offset and limit values from the request string; used in special pages. | |
wfClearOutputBuffers () | |
More legible than passing a 'false' parameter to wfResetOutputBuffers(): | |
wfClientAcceptsGzip ($force=false) | |
wfCountDown ($n) | |
Count down from $n to zero on the terminal, with a one-second pause between showing each number. | |
wfCreateObject ($name, $p) | |
Create an object with a given name and an array of construct parameters. | |
wfDebug ($text, $logonly=false) | |
Sends a line to the debug log if enabled or, optionally, to a comment in output. | |
wfDebugBacktrace ($limit=0) | |
Safety wrapper for debug_backtrace(). | |
wfDebugDieBacktrace ($msg= '') | |
Throw a debugging exception. | |
wfDebugLog ($logGroup, $text, $public=true) | |
Send a line to a supplementary debug log file, if configured, or main debug log if not. | |
wfDebugMem ($exact=false) | |
Send a line giving PHP memory usage. | |
wfDebugTimer () | |
Get microsecond timestamps for debug logs. | |
wfDeprecated ($function, $version=false, $component=false) | |
Throws a warning that $function is deprecated. | |
wfDiff ($before, $after, $params= '-u') | |
Returns unified plain-text diff of two texts. | |
wfDl ($extension, $fileName=null) | |
Wrapper function for PHP's dl(). | |
wfDoUpdates ($commit= '') | |
Do any deferred updates and clear the list. | |
wfEmptyMsg ($key) | |
Since wfMsg() and co suck, they don't return false if the message key they looked up didn't exist but a XHTML string, this function checks for the nonexistance of messages by checking the MessageCache::get() result directly. | |
wfErrorLog ($text, $file) | |
Log to a file without getting "file size exceeded" signals. | |
wfEscapeShellArg () | |
Windows-compatible version of escapeshellarg() Windows doesn't recognise single-quotes in the shell, but the escapeshellarg() function puts single quotes in regardless of OS. | |
wfEscapeWikiText ($text) | |
Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc. | |
wfExpandUrl ($url, $defaultProto=PROTO_CURRENT) | |
Expand a potentially local URL to a fully-qualified URL. | |
wfFindFile ($title, $options=array()) | |
Find a file. | |
wfFixSessionID () | |
Override session_id before session startup if php's built-in session generation code is not secure. | |
wfForeignMemcKey ($db, $prefix) | |
Get a cache key for a foreign DB. | |
wfFormatStackFrame ($frame) | |
Return a string representation of frame. | |
wfGenerateToken ($salt= '') | |
Generate a random 32-character hexadecimal token. | |
wfGetAllCallers ($limit=3) | |
Return a string consisting of callers in the stack. | |
wfGetCache ($inputType) | |
Get a cache object. | |
wfGetCaller ($level=2) | |
Get the name of the function which called this function. | |
& | wfGetDB ($db, $groups=array(), $wiki=false) |
Get a Database object. | |
wfGetLangObj ($langcode=false) | |
Return a Language object from $langcode. | |
wfGetLB ($wiki=false) | |
Get a load balancer object. | |
& | wfGetLBFactory () |
Get the load balancer factory object. | |
wfGetMainCache () | |
Get the main cache object. | |
wfGetMessageCacheStorage () | |
Get the cache object used by the message cache. | |
wfGetNull () | |
Get a platform-independent path to the null file, e.g. | |
wfGetParserCacheStorage () | |
Get the cache object used by the parser cache. | |
wfGetPrecompiledData ($name) | |
Get an object from the precompiled serialized directory. | |
wfGetScriptUrl () | |
Get the script URL. | |
wfHostname () | |
Fetch server name for use in error reporting etc. | |
wfHttpError ($code, $label, $desc) | |
Provide a simple HTTP error. | |
wfHttpOnlySafe () | |
wfIncrStats ($key, $count=1) | |
Increment a statistics counter. | |
wfIniGetBool ($setting) | |
Safety wrapper around ini_get() for boolean settings. | |
wfInitShellLocale () | |
Workaround for http://bugs.php.net/bug.php?id=45132 escapeshellarg() destroys non-ASCII characters if LANG is not a UTF-8 locale. | |
wfIsDebugRawPage () | |
Returns true if debug logging should be suppressed if $wgDebugRawPage = false. | |
wfIsHipHop () | |
Check if we are running under HipHop. | |
wfIsWindows () | |
Check if the operating system is Windows. | |
wfLoadExtensionMessages () | |
Load an extension messages file. | |
wfLocalFile ($title) | |
Get an object referring to a locally registered file. | |
wfLogDBError ($text) | |
Log for database errors. | |
wfLogProfilingData () | |
wfMakeUrlIndexes ($url) | |
Make URL indexes, appropriate for the el_index field of externallinks. | |
wfMatchesDomainList ($url, $domains) | |
Check whether a given URL has a domain that occurs in a given set of domains. | |
wfMemcKey () | |
Get a cache key. | |
wfMemoryLimit () | |
Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit;. | |
wfMerge ($old, $mine, $yours, &$result) | |
wfMerge attempts to merge differences between three texts. | |
wfMergeErrorArrays () | |
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g. | |
wfMessage ($key) | |
This is the new function for getting translated interface messages. | |
wfMessageFallback () | |
This function accepts multiple message keys and returns a message instance for the first message which is non-empty. | |
wfMkdirParents ($dir, $mode=null, $caller=null) | |
Make directory, and make all parent directories if they don't exist. | |
wfMsg ($key) | |
Get a message from anywhere, for the current user language. | |
wfMsgExt ($key, $options) | |
Returns message in the requested format. | |
wfMsgForContent ($key) | |
Get a message from anywhere, for the current global language set with $wgLanguageCode. | |
wfMsgForContentNoTrans ($key) | |
Same as above except doesn't transform the message. | |
wfMsgGetKey ($key, $useDB=true, $langCode=false, $transform=true) | |
Fetch a message string value, but don't replace any keys yet. | |
wfMsgHtml ($key) | |
Return an HTML-escaped version of a message. | |
wfMsgNoTrans ($key) | |
Same as above except doesn't transform the message. | |
wfMsgReal ($key, $args, $useDB=true, $forContent=false, $transform=true) | |
Really get a message. | |
wfMsgReplaceArgs ($message, $args) | |
Replace message parameter keys on the given formatted output. | |
wfMsgWikiHtml ($key) | |
Return an HTML version of message Parameter replacements, if any, are done *after* parsing the wiki-text message, so parameters may contain HTML (eg links or form controls). | |
wfNegotiateType ($cprefs, $sprefs) | |
Returns the 'best' match between a client's requested internet media types and the server's list of available types. | |
wfObjectToArray ($objOrArray, $recursive=true) | |
Recursively converts the parameter (an object) to an array with the same data. | |
wfOut ($s) | |
Used to be used for outputting text in the installer/updater. | |
wfParseUrl ($url) | |
parse_url() work-alike, but non-broken. | |
wfPercent ($nr, $acc=2, $round=true) | |
wfQueriesMustScale () | |
Should low-performance queries be disabled? | |
wfRandom () | |
Get a random decimal value between 0 and 1, in a way not likely to give duplicate values for any realistic number of articles. | |
wfReadOnly () | |
Check if the wiki read-only lock file is present. | |
wfReadOnlyReason () | |
wfRecursiveRemoveDir ($dir) | |
Remove a directory and all its content. | |
wfRelativePath ($path, $from) | |
Generate a relative path name to the given file. | |
wfRemoveDotSegments ($urlPath) | |
Remove all dot-segments in the provided URL path. | |
wfReportTime () | |
Returns a HTML comment with the elapsed time since request. | |
wfResetOutputBuffers ($resetGzipEncoding=true) | |
Clear away any user-level output buffers, discarding contents. | |
wfRestoreWarnings () | |
Restore error level to previous value. | |
wfRunHooks ($event, $args=array()) | |
Call hook functions defined in $wgHooks. | |
wfScript ($script= 'index') | |
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScriptExtension etc. | |
wfSetBit (&$dest, $bit, $state=true) | |
As for wfSetVar except setting a bit. | |
wfSetupSession ($sessionId=false) | |
Initialise php session. | |
wfSetVar (&$dest, $source, $force=false) | |
Sets dest to source and returns the original value of dest If source is NULL, it just returns the value, it doesn't set the variable If force is true, it will set the value even if source is NULL. | |
wfShellExec ($cmd, &$retval=null, $environ=array()) | |
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported. | |
wfShellMaintenanceCmd ($script, array $parameters=array(), array $options=array()) | |
Generate a shell-escaped command line string to run a maintenance script. | |
wfShorthandToInteger ($string= '') | |
Converts shorthand byte notation to integer form. | |
wfShowingResults ($offset, $limit) | |
wfSpecialList ($page, $details, $oppositedm=true) | |
Make a list item, used by various special pages. | |
wfSplitWikiID ($wiki) | |
Split a wiki ID into DB name and table prefix. | |
wfStreamFile ($fname, $headers=array()) | |
Stream a file to the browser. | |
wfStripIllegalFilenameChars ($name) | |
Replace all invalid characters with -. | |
wfSuppressWarnings ($end=false) | |
Reference-counted warning suppression. | |
wfTempDir () | |
Tries to get the system directory for temporary files. | |
wfTime () | |
Get the current unix timetstamp with microseconds. | |
wfTimestamp ($outputtype=TS_UNIX, $ts=0) | |
Get a timestamp string in one of various formats. | |
wfTimestampNow () | |
Convenience function; returns MediaWiki timestamp for the present time. | |
wfTimestampOrNull ($outputtype=TS_UNIX, $ts=null) | |
Return a formatted timestamp, or null if input is null. | |
wfUILang () | |
Old function when $wgBetterDirectionality existed Removed in core, kept in extensions for backwards compat. | |
wfUnpack ($format, $data, $length=false) | |
Wrapper around php's unpack. | |
wfUrlencode ($s) | |
We want some things to be included as literal characters in our title URLs for prettiness, which urlencode encodes by default. | |
wfUrlProtocols ($includeProtocolRelative=true) | |
Returns a regular expression of url protocols. | |
wfUrlProtocolsWithoutProtRel () | |
Like wfUrlProtocols(), but excludes '//' from the protocol list. | |
wfUseMW ($req_ver) | |
This function works like "use VERSION" in Perl except it checks the version of MediaWiki, the program will die with a backtrace if the current version of MediaWiki is less than the version provided. | |
wfUsePHP ($req_ver) | |
This function works like "use VERSION" in Perl, the program will die with a backtrace if the current version of PHP is less than the version provided. | |
wfVarDump ($var) | |
A wrapper around the PHP function var_export(). | |
wfViewPrevNext ($offset, $limit, $link, $query= '', $atend=false) | |
Generate (prev x| next x) (20|50|100...) type links for paging. | |
wfWaitForSlaves ($maxLag=false, $wiki=false) | |
Modern version of wfWaitForSlaves(). | |
wfWarn ($msg, $callerOffset=1, $level=E_USER_NOTICE) | |
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings. | |
wfWikiID () | |
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys. |
Global functions used everywhere.
Definition in file GlobalFunctions.php.
enum TS_DB |
MySQL DATETIME (YYYY-MM-DD HH:MM:SS)
Definition at line 2250 of file GlobalFunctions.php.
enum TS_DB2 |
DB2 format time.
Definition at line 2286 of file GlobalFunctions.php.
enum TS_EXIF |
An Exif timestamp (YYYY:MM:DD HH:MM:SS)
Definition at line 2271 of file GlobalFunctions.php.
enum TS_ISO_8601 |
ISO 8601 format with no timezone: 1986-02-09T20:00:00Z.
This is used by Special:Export
Definition at line 2262 of file GlobalFunctions.php.
enum TS_ISO_8601_BASIC |
ISO 8601 basic format with no timezone: 19860209T200000Z.
This is used by ResourceLoader
Definition at line 2291 of file GlobalFunctions.php.
enum TS_MW |
MediaWiki concatenated string timestamp (YYYYMMDDHHMMSS)
Definition at line 2245 of file GlobalFunctions.php.
enum TS_ORACLE |
Oracle format time.
Definition at line 2276 of file GlobalFunctions.php.
enum TS_POSTGRES |
Postgres format time.
Definition at line 2281 of file GlobalFunctions.php.
enum TS_RFC2822 |
RFC 2822 format, for E-mail and HTTP headers.
Definition at line 2255 of file GlobalFunctions.php.
enum TS_UNIX |
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
Definition at line 2240 of file GlobalFunctions.php.
Find out whether or not a mixed variable exists in a string.
$needle | String |
$str | String |
$insensitive | Boolean |
Definition at line 2637 of file GlobalFunctions.php.
Referenced by GlobalTest\testInStringTest().
mimeTypeMatch | ( | $ | type, |
$ | avail | ||
) | [private] |
Checks if a given MIME type matches any of the keys in the given array.
Basic wildcards are accepted in the array keys.
Returns the matching MIME type (or wildcard) if a match, otherwise NULL if no match.
$type | String |
$avail | Array |
Definition at line 2133 of file GlobalFunctions.php.
Referenced by GlobalTest\testMimeTypeMatch(), and wfNegotiateType().
swap | ( | &$ | x, |
&$ | y | ||
) |
Swap two variables.
$x | Mixed |
$y | Mixed |
Definition at line 2471 of file GlobalFunctions.php.
Referenced by GlobalTest\testSwapVarsTest().
wfAcceptToPrefs | ( | $ | accept, |
$ | def = '*/*' |
||
) |
Converts an Accept-* header into an array mapping string values to quality factors.
$accept | String |
$def | String default |
Definition at line 2097 of file GlobalFunctions.php.
Referenced by RdfMetaData\setup().
wfAppendQuery | ( | $ | url, |
$ | query | ||
) |
Append a query string to an existing URL, which may or may not already have query string parameters already.
If so, they will be combined.
$url | String |
$query | Mixed: string or associative array |
Definition at line 424 of file GlobalFunctions.php.
References $url, and wfArrayToCGI().
Referenced by OutputPage\addScriptFile(), ImportSiteScripts\execute(), ForeignAPIRepo\fetchImageQuery(), ImportSiteScripts\fetchScriptList(), FileRepo\getDescriptionRenderUrl(), OutputPage\getHeadLinks(), Title\getLocalURL(), Linker\getUploadUrl(), Linker\link(), ResourceLoader\makeLoaderURL(), Linker\makeThumbLink2(), and FileRepo\makeUrl().
wfAppendToArrayIfNotDefault | ( | $ | key, |
$ | value, | ||
$ | default, | ||
&$ | changed | ||
) |
Appends to second array if $value differs from that in $default.
$key | String|Int |
$value | Mixed |
$default | Mixed |
$changed | Array to alter |
Definition at line 136 of file GlobalFunctions.php.
References $changed.
Referenced by SpecialWatchlist\execute().
if (!defined( 'MEDIAWIKI')) wfArrayDiff2 | ( | $ | a, |
$ | b | ||
) |
Like array_diff( $a, $b ) except that it works with two-dimensional arrays.
$a | array |
$b | array |
Definition at line 88 of file GlobalFunctions.php.
Referenced by WikiPage\doRollback(), EditPage\getEditPermissionErrors(), GlobalTest\testWfArrayDiff2(), and UploadBase\verifyTitlePermissions().
wfArrayDiff2_cmp | ( | $ | a, |
$ | b | ||
) |
wfArrayInsertAfter | ( | $ | array, |
$ | insert, | ||
$ | after | ||
) |
Insert array into another array after the specified *KEY*.
$array | Array: The array. |
$insert | Array: The array to insert. |
$after | Mixed: The key to insert after |
Definition at line 203 of file GlobalFunctions.php.
wfArrayLookup | ( | $ | a, |
$ | b | ||
) |
Array lookup Returns an array where the values in the first array are replaced by the values in the second array with the corresponding keys.
$a | Array |
$b | Array |
Definition at line 124 of file GlobalFunctions.php.
wfArrayMap | ( | $ | function, |
$ | input | ||
) |
Wrapper around array_map() which also taints variables.
$function | Callback |
$input | Array |
Definition at line 249 of file GlobalFunctions.php.
References $input.
Referenced by Installer\envCheckShellLocale().
wfArrayMerge | ( | $ | array1 | ) |
Backwards array plus for people who haven't bothered to read the PHP manual XXX: will not darn your socks for you.
$array1 | Array |
[$array2,[...]] | Arrays |
Definition at line 153 of file GlobalFunctions.php.
References $out.
wfArrayToCGI | ( | $ | array1, |
$ | array2 = null , |
||
$ | prefix = '' |
||
) |
This function takes two arrays as input, and returns a CGI-style string, e.g.
"days=7&limit=100". Options in the first array override options in the second. Options set to null or false will not be output.
$array1 | Array ( String|Array ) |
$array2 | Array ( String|Array ) |
$prefix | String |
Definition at line 332 of file GlobalFunctions.php.
Referenced by SpecialPage\addFeedLinks(), WebRequest\appendQueryArray(), SkinTemplate\buildPersonalUrls(), SpecialContributions\execute(), SpecialNewpages\execute(), PhpHttpRequest\execute(), RedirectSpecialPage\execute(), SpecialPageFactory\executePath(), Title\fixUrlQueryArgs(), WebInstaller_Options\getCCPartnerUrl(), FileRepo\getDescriptionStylesheetUrl(), FormAction\getForm(), FormSpecialPage\getForm(), ResourceLoaderStartUpModule\getScript(), ImageHandler\getScriptedTransform(), WebInstaller\getUrl(), SkinTemplate\outputPage(), PurgeAction\show(), OutputPage\showPermissionsErrorPage(), GlobalTest\testArrayToCGI(), GlobalTest\testArrayToCGI2(), GlobalTest\testCgiRoundTrip(), and wfAppendQuery().
wfAssembleUrl | ( | $ | urlParts | ) |
This function will reassemble a URL parsed with wfParseURL.
This is useful if you need to edit part of a URL and put it back together.
This is the basic structure used (brackets contain keys for $urlParts): [scheme][delimiter][user]:[pass]@[host]:[port][path]?[query]#[fragment]
$urlParts | Array URL parts, as output from wfParseUrl |
Definition at line 527 of file GlobalFunctions.php.
References $result.
Referenced by wfAssembleUrl\testWfAssembleUrl(), and wfExpandUrl().
wfBacktrace | ( | ) |
Get a debug backtrace as a string.
Definition at line 1706 of file GlobalFunctions.php.
References $f, $file, $wgCommandLineMode, and wfDebugBacktrace().
Referenced by ApiBase\debugPrint(), MWDebug\deprecated(), and BackupReader\skippedNamespace().
wfBaseConvert | ( | $ | input, |
$ | sourceBase, | ||
$ | destBase, | ||
$ | pad = 1 , |
||
$ | lowercase = true |
||
) |
Convert an arbitrarily-long digit string from one numeric base to another, optionally zero-padding to a minimum column width.
Supports base 2 through 36; digit values 10-36 are represented as lowercase letters a-z. Input is case-insensitive.
$input | String: of digits |
$sourceBase | Integer: 2-36 |
$destBase | Integer: 2-36 |
$pad | Integer: 1 or greater |
$lowercase | Boolean |
Definition at line 3195 of file GlobalFunctions.php.
Referenced by LSLockManager\__construct(), DBLockManager\__construct(), NewParserTest\addDBData(), Revision\base36Sha1(), SwiftFileBackend\doCreateInternal(), SwiftFileBackend\doStoreInternal(), FileBackendTest\doTestDoOperations(), FileBackendTest\doTestDoOperationsFailing(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), ApiQueryBlocks\execute(), ApiQueryRevisions\extractRowInfo(), FileBackendStore\getContainerSuffixes(), ApiQueryImageInfo\getInfo(), ForeignAPIFile\getSha1(), WikiRevision\getSha1(), FSFile\getSha1Base36(), StoreFileOp\getSourceSha1Base36(), CreateFileOp\getSourceSha1Base36(), User\randomPassword(), ApiQueryAllimages\run(), ParserTest\setupDatabase(), LockManager\sha1Base36(), and UploadStash\stashFile().
wfBaseName | ( | $ | path, |
$ | suffix = '' |
||
) |
Return the final portion of a pathname.
Reimplemented because PHP5's basename() is buggy with multibyte text. http://bugs.php.net/bug.php?id=33898
PHP's basename() only considers '\' a pathchar on Windows and Netware. We'll consider it so always, as we don't want in our Unix paths either.
$path | String |
$suffix | String: to remove if present |
Definition at line 3112 of file GlobalFunctions.php.
References $matches, and $path.
Referenced by ImageBuilder\checkMissingImage(), FSFileBackend\getLocalCopy(), SwiftFileBackend\getLocalCopy(), wfBaseName\testBaseName(), wfRelativePath(), and wfStripIllegalFilenameChars().
wfBCP47 | ( | $ | code | ) |
Get the normalised IETF language tag See unit test for examples.
$code | String: The language code. |
Definition at line 3784 of file GlobalFunctions.php.
Referenced by Language\getHtmlCode(), CoreParserFunctions\language(), Preferences\profilePreferences(), and wfBCP47\testBCP47().
wfBoolToStr | ( | $ | value | ) |
Convenience function converts boolean values into "true" or "false" (string) values.
$value | Boolean |
Definition at line 3608 of file GlobalFunctions.php.
Referenced by LocalSettingsGenerator\__construct(), ApiRsd\formatRsdApiList(), LocalSettingsGenerator\getDefaultText(), MysqlInstaller\getLocalSettings(), and GlobalTest\testClientAcceptsGzipTest().
wfCgiToArray | ( | $ | query | ) |
This is the logical opposite of wfArrayToCGI(): it accepts a query string as its argument and returns the same string in array form.
This allows compa- tibility with legacy functions that accept raw query strings instead of nice arrays. Of course, keys and values are urldecode()d.
$query | String: query string |
Definition at line 377 of file GlobalFunctions.php.
References $keys.
Referenced by WebRequest\appendQuery(), Linker\makeBrokenImageLinkObj(), Linker\makeBrokenLinkObj(), Parser\makeKnownLinkHolder(), Linker\makeKnownLinkObj(), Linker\makeLinkObj(), GlobalTest\testCgiRoundTrip(), GlobalTest\testCgiToArray(), and wfViewPrevNext().
wfCheckEntropy | ( | ) |
Check if there is sufficent entropy in php's built-in session generation PHP's built-in session entropy is enabled if:
Definition at line 3307 of file GlobalFunctions.php.
References wfIsWindows().
Referenced by LoginForm\renewSessionId(), and wfFixSessionID().
wfCheckLimits | ( | $ | deflimit = 50 , |
$ | optionname = 'rclimit' |
||
) |
Obtain the offset and limit values from the request string; used in special pages.
$deflimit | Int default limit if none supplied |
$optionname | String Name of a user preference to check against |
Definition at line 1904 of file GlobalFunctions.php.
More legible than passing a 'false' parameter to wfResetOutputBuffers():
Clear away output buffers, but keep the Content-Encoding header produced by ob_gzhandler, if any.
This should be used for HTTP 304 responses, where you need to preserve the Content-Encoding header of the real result, but also need to suppress the output of ob_gzhandler to keep to spec and avoid breaking Firefox in rare cases where the headers and body are broken over two packets.
Definition at line 2085 of file GlobalFunctions.php.
References wfResetOutputBuffers().
Referenced by OutputPage\checkLastModified().
wfClientAcceptsGzip | ( | $ | force = false | ) |
document
FIXME: We may want to blacklist some broken browsers
$force | Bool |
Definition at line 1870 of file GlobalFunctions.php.
References $result, and wfDebug().
Referenced by HTMLFileCache\loadFromFileCache(), HTMLFileCache\saveToFileCache(), GlobalTest\testClientAcceptsGzipTest(), and wfGzipHandler().
wfCountDown | ( | $ | n | ) |
Count down from $n to zero on the terminal, with a one-second pause between showing each number.
For use in command-line scripts.
$n | int |
Definition at line 3675 of file GlobalFunctions.php.
Referenced by ResetUserTokens\execute(), UpdateMediaWiki\execute(), and userOptions\warn().
wfCreateObject | ( | $ | name, |
$ | p | ||
) |
Create an object with a given name and an array of construct parameters.
$name | String |
$p | Array: parameters |
Definition at line 3276 of file GlobalFunctions.php.
References MWFunction\newObj(), and wfDeprecated().
Sends a line to the debug log if enabled or, optionally, to a comment in output.
In normal operation this is a NOP.
Controlling globals: $wgDebugLogFile - points to the log file $wgProfileOnly - if set, normal debug messages will not be recorded. $wgDebugRawPage - if false, 'action=raw' hits will not result in debug output. $wgDebugComments - if on, some debug items may appear in comments in the HTML output.
$text | String |
$logonly | Bool: set true to avoid appearing in HTML when $wgDebugComments is set |
Definition at line 854 of file GlobalFunctions.php.
References $wgDebugComments, $wgDebugLogFile, $wgDebugLogPrefix, $wgDebugRawPage, $wgOut, $wgProfileOnly, $wgShowDebug, MWDebug\debugMsg(), wfDebugTimer(), wfErrorLog(), wfIsDebugRawPage(), and wfRunHooks().
Referenced by DBABagOStuff\__construct(), UploadFromChunks\__construct(), SearchUpdate\__construct(), UploadFromStash\__construct(), DifferenceEngine\__construct(), WikiXmlError\__construct(), ApiMain\__construct(), LocalisationCache\__construct(), MimeMagic\__construct(), Parser\__construct(), UploadStashFile\__construct(), MemCachedClientforWiki\_debugprint(), StubObject\_unstub(), LogPage\actionText(), ImageGallery\add(), MediaHandler\addMeta(), LoginForm\addNewAccountInternal(), LinkBatch\addObj(), LocalFileMoveBatch\addOlds(), Parser\addTrackingCategory(), Skin\afterContentHook(), LoginForm\attemptAutoCreate(), LoginForm\authenticateUserData(), AutoLoader\autoload(), Parser\braceSubstitution(), SkinTemplate\buildContentActionUrls(), CurlHttpRequest\canFollowRedirects(), EmailNotification\canSendUserTalkEmail(), AjaxResponse\checkLastModified(), OutputPage\checkLastModified(), UploadBase\checkSvgScriptCallback(), UploadBase\checkXMLEncodingMissmatch(), LocalRepo\cleanupDeletedBatch(), UploadBase\cleanupTempFile(), SpecialEditWatchlist\cleanupWatchlist(), UploadStash\clear(), CloneDatabase\cloneTableStructure(), Revision\compressRevisionText(), UploadFromChunks\concatenateChunks(), Article\confirmDelete(), DjVuImage\convertDumpToXML(), EhcacheBagOStuff\createCache(), UploadBase\createFromRequest(), DatabaseIbm_db2\dataSeek(), WikiImporter\debug(), BaseDump\debug(), RecompressTracked\debug(), BagOStuff\debug(), SVGReader\debug(), Profiler\debug(), Block\defaultRetroactiveAutoblock(), EhcacheBagOStuff\delete(), DBABagOStuff\delete(), Block\deleteIfExpired(), User\deleteNewtalk(), MimeMagic\detectMimeType(), UploadBase\detectScript(), UploadBase\detectVirus(), MimeMagic\detectZipType(), WikiDiff3\diff(), Parser\disableCache(), BitmapMetadataHandler\doApp13(), Block\doAutoblock(), FileBackendStore\doClean(), WikiPage\doDeleteArticleReal(), WikiPage\doEdit(), WikiPage\doEditUpdates(), MimeMagic\doGuessMimeType(), FileBackendStore\doPrepare(), WikiFilePage\doPurge(), DatabaseMssql\doQuery(), DatabaseOracle\doQuery(), EhcacheBagOStuff\doRequest(), Block\doRetroactiveAutoblock(), UserrightsPage\doSaveUserGroups(), FileBackendStore\doSecure(), BitmapHandler\doTransform(), DjVuHandler\doTransform(), HTMLCacheUpdate\doUpdate(), LoadBalancer\doWait(), WikiRevision\downloadSource(), MWCryptRand\driftHash(), DatabaseSqlite\duplicateTableStructure(), EditPage\edit(), ZipDirectoryReader\error(), SpecialUserlogout\execute(), ChangesFeed\execute(), SpecialUpload\execute(), CurlHttpRequest\execute(), PhpHttpRequest\execute(), LocalFileRestoreBatch\execute(), PoolWorkArticleView\fallback(), ExternalStoreDB\fetchBlob(), Article\fetchContent(), WikiDiff3\find_middle_snake(), Parser\findColonNoLinks(), RepoGroup\findFile(), FormatMetadata\flattenArray(), FileRepo\freeTemp(), EhcacheBagOStuff\get(), DBABagOStuff\get(), ParserCache\get(), Interwiki\getAllPrefixesCached(), User\getBlockedStatus(), PoolWorkArticleView\getCachedWork(), LoadBalancer\getConnection(), ContextSource\getContext(), SpecialPage\getContext(), Article\getContext(), File\getDescriptionText(), UploadStash\getFile(), FileBackendStore\getFileList(), FSFileBackend\getFileListInternal(), DoubleRedirectJob\getFinalDestination(), GenderCache\getGenderOf(), MediaHandler\getHandler(), DjVuImage\getInfo(), Interwiki\getInterwikiCacheEntry(), ParserCache\getKey(), DatabaseMysql\getLag(), BacklinkCache\getLinks(), BitmapHandler\getMagickVersion(), LoadBalancer\getMasterPos(), GIFHandler\getMetadata(), JpegHandler\getMetadata(), PNGHandler\getMetadata(), PNGMetadataExtractor\getMetadata(), GIFMetadataExtractor\getMetadata(), TiffHandler\getMetadata(), SvgHandler\getMetadata(), DjVuHandler\getMetadata(), DjVuHandler\getMetaTree(), DjVuImage\getMultiPageInfo(), SpecialPageFactory\getPage(), DjVuImage\getPageInfo(), WikiPage\getParserOutput(), SpecialEmailUser\getPermissionsError(), FSFile\getProps(), File\getPropsFromPath(), DisambiguationsPage\getQueryInfo(), DBABagOStuff\getReader(), LoadBalancer\getReaderIndex(), Title\getRestrictionTypes(), ExternalStoreDB\getSlave(), DatabaseBase\getSlavePos(), SpecialEmailUser\getTarget(), ForeignAPIRepo\getThumbUrl(), UploadStashFile\getThumbUrl(), ForeignAPIRepo\getThumbUrlFromCache(), NewParserTest\getUploadDir(), Parser\getUserSig(), Parser\getVariableValue(), File\getViewURL(), DBABagOStuff\getWriter(), XCFHandler\getXCFMetaData(), MimeMagic\guessMimeType(), SqlBagOStuff\handleWriteError(), MWCryptRand\hashAlgo(), OutputPage\haveCacheVaryCookies(), SquidUpdate\HTCPPurge(), ForeignAPIRepo\httpGet(), EditPage\importFormData(), WikiRevision\importLogItem(), WikiRevision\importOldRevision(), WikiRevision\importUpload(), MimeMagic\improveTypeFromExtension(), User\inDnsBlacklist(), ChronologyProtector\initLB(), Block\insert(), HTMLCacheUpdate\insertJobsFromTitles(), ExternalStore\insertToDefault(), DatabaseIbm_db2\installPrint(), Profiler\instance(), EditPage\internalAttemptSave(), User\isBlockedFrom(), FileCacheBase\isCacheGood(), SvgHandler\isEnabled(), DjVuHandler\isEnabled(), FileDependency\isExpired(), LocalisationCache\isExpired(), Block\isExpired(), ExifBitmapHandler\isMetadataValid(), PNGHandler\isMetadataValid(), GIFHandler\isMetadataValid(), Title\isValidMoveTarget(), Block\isWhitelistedFromAutoblocks(), MessageCache\load(), SiteStats\loadAndLazyInit(), ChangesFeed\loadFromCache(), HTMLFileCache\loadFromFileCache(), User\loadFromId(), AjaxResponse\loadFromMemcached(), User\loadFromSession(), User\loadOptions(), Revision\loadText(), DatabaseMysql\lock(), Linker\makeBrokenLink(), Linker\makeExternalImage(), Linker\makeExternalLink(), Linker\makeImageLink2(), DatabaseBase\masterPosWait(), User\matchEditToken(), Skin\newFromKey(), ImportStreamSource\newFromURL(), SVGReader\notice(), RawAction\onView(), CdbReader\open(), DatabaseMysql\open(), DatabaseMssql\open(), CdbWriter\open(), DatabasePostgres\open(), DatabaseIbm_db2\open(), LoadBalancer\openConnection(), DatabaseSqlite\openFile(), LoadBalancer\openForeignConnection(), UploadDumper\outputItem(), SkinTemplate\outputPage(), SearchMySQL\parseQuery(), SearchSqlite\parseQuery(), SearchPostgres\parseQuery(), BacklinkCache\partition(), DiffHistoryBlob\patch(), AjaxDispatcher\performAction(), ApiUpload\performStash(), User\pingLimiter(), SpecialUpload\processUpload(), LocalFile\purgeThumbList(), DatabaseBase\query(), SvgHandler\rasterize(), TextPassDumper\readDump(), TestFileIterator\readNextTest(), MWCryptRand\realGenerate(), LoadBalancer\reallyOpenConnection(), LocalisationCache\recache(), EnhancedChangesList\recentChangesLine(), LocalFile\recordUpload2(), UploadStash\removeFileNoAuth(), WikiPage\replaceSection(), Parser\replaceVariables(), DatabaseOracle\reportQueryError(), DatabaseBase\reportQueryError(), Http\request(), MediaWiki\restInPeace(), DjVuImage\retrieveMetaData(), LoadBalancer\reuseConnection(), DoubleRedirectJob\run(), RequestContext\sanitizeLangCode(), ParserCache\save(), FileCacheBase\saveText(), HTMLFileCache\saveToFileCache(), MessageCache\saveToLocal(), MessageCache\saveToScript(), SearchPostgres\searchQuery(), JpegMetadataExtractor\segmentSplitter(), UserMailer\send(), OutputPage\sendCacheControl(), RecentChange\sendToUDP(), UserMailer\sendWithPear(), EhcacheBagOStuff\set(), DBABagOStuff\set(), ApiMain\setCacheMode(), UploadFromUrlTestSuite\setupUploadDir(), ParserTest\setupUploadDir(), ChronologyProtector\shutdown(), ChronologyProtector\shutdownLB(), LoadBalancer\sleep(), User\spreadBlock(), UploadStash\stashFile(), FileRepo\storeBatch(), ParserTest\teardownDatabase(), GlobalTest\testDebugFunctionTest(), NewParserTest\testParserTest(), ApiUploadTest\testUploadChunks(), WikiImporter\throwXmlError(), SVGReader\throwXmlError(), MWTidy\tidy(), File\transform(), BitmapHandler\transformCustom(), BitmapHandler\transformGd(), BitmapHandler\transformImageMagick(), BitmapHandler\transformImageMagickExt(), RepoGroup\trimCache(), LocalisationCache_BulkLoad\trimCache(), SpecialUploadStash\tryClearStashedUploads(), Article\tryFileCache(), PageArchive\undelete(), PageArchive\undeleteRevisions(), Block\update(), UploadFromChunks\updateChunkStatus(), User\updateNewtalk(), OldLocalFile\upgradeRow(), LocalFile\upgradeRow(), HTMLFileCache\useFileCache(), LogEventsList\userCanBitfield(), Revision\userCanBitfield(), ImageHandler\validateThumbParams(), UploadBase\verifyExtension(), UploadBase\verifyFile(), UploadBase\verifyMimeType(), Article\view(), WikiImporter\warn(), SVGReader\warn(), wfClientAcceptsGzip(), wfDebugBacktrace(), wfDebugLog(), wfDebugMem(), wfDiff(), wfFixSessionID(), wfGetLangObj(), wfMemoryLimit(), wfMerge(), wfMkdirParents(), wfRecursiveRemoveDir(), wfShellExec(), wfTimestamp(), and wfWarn().
wfDebugBacktrace | ( | $ | limit = 0 | ) |
Safety wrapper for debug_backtrace().
With Zend Optimizer 3.2.0 loaded, this causes segfaults under somewhat murky circumstances, which may be triggered in part by stub objects or other fancy talkin'.
Will return an empty array if Zend Optimizer is detected or if debug_backtrace is disabled, otherwise the output from debug_backtrace() (trimmed).
$limit | int This parameter can be used to limit the number of stack frames returned |
Definition at line 1672 of file GlobalFunctions.php.
References $limit, and wfDebug().
Referenced by wfBacktrace(), wfGetAllCallers(), wfGetCaller(), and wfWarn().
wfDebugDieBacktrace | ( | $ | msg = '' | ) |
Throw a debugging exception.
This function previously once exited the process, but now throws an exception instead, with similar results.
$msg | String: message shown when dying. |
Definition at line 1608 of file GlobalFunctions.php.
Referenced by Language\checkTitleEncoding(), ApiBase\dieDebug(), GenerateSitemap\open(), and GenerateSitemap\write().
wfDebugLog | ( | $ | logGroup, |
$ | text, | ||
$ | public = true |
||
) |
Send a line to a supplementary debug log file, if configured, or main debug log if not.
$wgDebugLogGroups[$logGroup] should be set to a filename to send to a separate log.
$logGroup | String |
$text | String |
$public | Bool: whether to log the event in the public log if no private log file is specified, (default true) |
Definition at line 950 of file GlobalFunctions.php.
References $wgDebugLogGroups, wfDebug(), wfErrorLog(), wfHostname(), wfRunHooks(), wfTimestamp(), and wfWikiID().
Referenced by UploadFromChunks\concatenateChunks(), IPTC\convIPTCHelper(), Exif\debug(), Exif\debugFile(), XMPReader\doAttribs(), MediaWiki\doJobs(), DjVuHandler\doTransform(), PoolWorkArticleView\doWork(), XMPReader\endElement(), XMPReader\endElementModeLi(), XMPReader\endElementNested(), CheckUsernames\execute(), LocalFileMoveBatch\execute(), ApiMain\executeActionWithErrorHandling(), PoolWorkArticleView\fallback(), ExternalStoreDB\fetchBlob(), IPTC\getCharset(), RequestContext\getLanguage(), LocalFileMoveBatch\getMoveTriplets(), MessageCache\getMsgFromNamespace(), LoadBalancer\getRandomNonLagged(), LoadBalancer\getReaderIndex(), SpecialSearch\goResult(), ExternalStore\insertToDefault(), EditPage\internalAttemptSave(), User\isCreatableName(), User\isValidUserName(), MagicWord\load(), MessageCache\loadFromDB(), User\loadFromSession(), SquidPurgeClient\log(), PoolCounterWork\logError(), BitmapHandler\logErrorForExternalProcess(), SwiftFileBackend\logException(), FileOp\logFailure(), LocalFile\move(), IPTC\parse(), XMPReader\parse(), XMPReader\parseExtended(), Preprocessor_Hash\preprocessToObj(), Preprocessor_DOM\preprocessToObj(), SvgHandler\rasterize(), MediaHandler\removeBadFile(), LocalFileMoveBatch\removeNonexistentFiles(), MWException\report(), SquidPurgeClientPool\run(), RunJobs\runJobsLog(), XMPReader\saveValue(), WebResponse\setcookie(), XMPReader\startElement(), XMPReader\startElementModeInitial(), XMPReader\startElementModeSeq(), XMPReader\startElementModeSimple(), IPTC\timeHelper(), XMPValidate\validateBoolean(), XMPValidate\validateClosed(), XMPValidate\validateDate(), XMPValidate\validateFlash(), XMPValidate\validateGPS(), XMPValidate\validateInteger(), XMPValidate\validateLangCode(), XMPValidate\validateRating(), XMPValidate\validateRational(), wfSetupSession(), and wfShellExec().
wfDebugMem | ( | $ | exact = false | ) |
Send a line giving PHP memory usage.
$exact | Bool: print exact values instead of kilobytes (default: false) |
Definition at line 931 of file GlobalFunctions.php.
References wfDebug().
Referenced by GlobalTest\testDebugFunctionTest().
wfDebugTimer | ( | ) |
Get microsecond timestamps for debug logs.
Definition at line 914 of file GlobalFunctions.php.
References $wgDebugTimestamps, and $wgRequestTime.
Referenced by wfDebug().
wfDeprecated | ( | $ | function, |
$ | version = false , |
||
$ | component = false |
||
) |
Throws a warning that $function is deprecated.
$function | String |
$version | String|false: Added in 1.19. |
$component | String|false: Added in 1.19. |
Definition at line 989 of file GlobalFunctions.php.
References $version, $wgDeprecationReleaseLimit, MWDebug\deprecated(), and wfWarn().
Referenced by SpecialPage\__call(), WikiError\__construct(), WikiErrorMsg\__construct(), StubContLang\__construct(), WikiXmlError\__construct(), RawPage\__construct(), OutputPage\__construct(), SearchEngine\acceptListRedirects(), HTMLForm\addJS(), SpecialPage\addPage(), CategoryViewer\addSubcategory(), MediaWiki\articleFromTitle(), EditPage\blockedPage(), Block\clear(), LoadBalancer\closeConnecton(), ApiBase\createContext(), WikiPage\createUpdates(), Block\decodeExpiry(), User\decodeOptions(), Article\doRedirect(), Article\doUnwatch(), Article\doWatch(), User\editToken(), Block\encodeExpiry(), Title\escapeCanonicalURL(), Title\escapeFullURL(), DatabaseBase\escapeLike(), Title\escapeLocalURL(), WikiPage\estimateRevisionCount(), SpecialPage\executePath(), SpecialPage\exists(), SpecialPage\file(), Title\fixUrlQueryArgs(), FormatExif\FormatExif(), Block\formatExpiry(), Article\forUpdate(), Block\forUpdate(), SpecialPage\func(), Title\getEscapedText(), Linker\getExternalLinkAttributes(), Language\getFallbackLanguageCode(), SpecialPage\getFile(), WebRequest\getFileSize(), Exif\getFormattedData(), SpecialPage\getGroup(), DatabaseMysql\getLagFromProcesslist(), ContextSource\getLang(), Action\getLang(), DerivativeContext\getLang(), RequestContext\getLang(), SpecialPage\getLang(), SpecialPage\getLocalNameFor(), SpecialPage\getPage(), SpecialPage\getPageByAlias(), User\getPageRenderingHash(), File\getPropsFromPath(), LegacyTemplate\getQuickbarCompensator(), SpecialPage\getRegularPages(), SpecialPage\getRestrictedPages(), ParserOptions\getSkin(), User\getSkin(), OutputPage\getStatusMessage(), SpecialPage\getTitleForAlias(), SpecialPage\getUsablePages(), ApiBase\getValidNamespaces(), MediaWikiTestCase\hideDeprecated(), SpecialPage\includable(), Block\infinity(), Article\info(), SpecialPage\initAliasList(), SpecialPage\initList(), WikiPage\isBigDeletion(), WikiError\isError(), MWNamespace\isMain(), OutputPage\isUserJsAllowed(), User\isValidEmailAddr(), ApiParse\languagesHtml(), Block\load(), Article\loadContent(), Preferences\loadOldSearchNs(), LogPage\logHeader(), LogPage\logName(), Linker\makeBrokenLink(), Linker\makeBrokenLinkObj(), Linker\makeColouredLinkObj(), Exif\makeFormattedData(), Skin\makeGlobalVariablesScript(), Linker\makeSizeLinkObj(), Article\markpatrolled(), SpecialPage\name(), Xml\namespaceSelector(), Block\newFromDB(), DatabaseBase\newFromParams(), DatabaseBase\newFromType(), ChangesList\newFromUser(), EditPage\noCreatePermission(), Block\normaliseRange(), Block\parseExpiryInput(), WikiPage\preSaveTransform(), WikiPage\quickEdit(), DatabaseBase\quote_ident(), EditPage\readOnlyPage(), OutputPage\reduceAllowedModules(), SpecialPage\removePage(), SpecialPage\resolveAlias(), SpecialPage\restriction(), Article\revert(), Revision\revText(), Article\rollback(), OutputPage\setAllowedModules(), ApiMain\setCachePrivate(), SpecialPage\setGroup(), DerivativeContext\setLang(), RequestContext\setLang(), ParserOptions\setSkin(), DatabaseBase\setTimeout(), ApiMain\setVaryCookie(), File\sha1Base36(), LogEventsList\showHeader(), EditPage\spamPage(), Article\unwatch(), Title\updateTitleProtection(), WikiPage\useParserCache(), Title\userCanEditCssSubpage(), Title\userCanEditJsSubpage(), Title\userCanRead(), EditPage\userNotLoggedInPage(), ImageGallery\useSkin(), WikiPage\viewUpdates(), Article\watch(), wfCreateObject(), wfDoUpdates(), wfGetAgent(), wfGetForwardedFor(), wfGetIP(), wfLoadExtensionMessages(), wfOut(), wfStreamFile(), wfUILang(), and wfViewPrevNext().
wfDiff | ( | $ | before, |
$ | after, | ||
$ | params = '-u' |
||
) |
Returns unified plain-text diff of two texts.
Useful for machine processing of diffs.
$before | String: the text before the changes. |
$after | String: the text after the changes. |
$params | String: command-line options for the diff command. |
Definition at line 2993 of file GlobalFunctions.php.
References $wgDiff, wfDebug(), wfEscapeShellArg(), wfRestoreWarnings(), wfSuppressWarnings(), and wfTempDir().
Referenced by Parser_DiffTest\__call(), and CompareParsers\processRevision().
wfDl | ( | $ | extension, |
$ | fileName = null |
||
) |
Wrapper function for PHP's dl().
This doesn't work in most situations from PHP 5.3 onward, and is usually disabled in shared environments anyway.
$extension | String A PHP extension. The file suffix (.so or .dll) should be omitted |
$fileName | String Name of the library, if not $extension.suffix |
Definition at line 2685 of file GlobalFunctions.php.
References wfIniGetBool(), wfIsWindows(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by MimeMagic\__construct(), DatabaseInstaller\checkExtension(), DifferenceEngine\initDiffEngines(), Sqlite\isPresent(), DatabaseMysql\open(), DatabaseIbm_db2\open(), BackupDumper\processArgs(), FormatMetadataTest\setUp(), XMPTest\setUp(), ExifTest\setUp(), JpegTest\setUp(), ExifBitmapTest\setUp(), ExifRotationTest\setUp(), TiffTest\testInvalidFile(), BitmapMetadataHandlerTest\testMultilingualCascade(), BitmapMetadataHandlerTest\testPNGXMP(), and TiffTest\testTiffMetadataExtraction().
wfDoUpdates | ( | $ | commit = '' | ) |
Do any deferred updates and clear the list.
$commit | string |
Definition at line 3176 of file GlobalFunctions.php.
References DeferredUpdates\doUpdates(), and wfDeprecated().
wfEmptyMsg | ( | $ | key | ) |
Since wfMsg() and co suck, they don't return false if the message key they looked up didn't exist but a XHTML string, this function checks for the nonexistance of messages by checking the MessageCache::get() result directly.
$key | String: the message key looked up |
Definition at line 1598 of file GlobalFunctions.php.
References MessageCache\singleton().
Referenced by SpecialRecentChanges\optionsPanel().
wfErrorLog | ( | $ | text, |
$ | file | ||
) |
Log to a file without getting "file size exceeded" signals.
Can also log to TCP or UDP with the syntax udp://host:port/prefix. This will send lines to the specified port, prefixed by the specified prefix and a space.
$text | String |
$file | String filename |
Definition at line 1071 of file GlobalFunctions.php.
References $file, $size, IP\isIPv4(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by RecompressTracked\logToFile(), wfDebug(), wfDebugLog(), wfLogDBError(), and wfLogProfilingData().
wfEscapeShellArg | ( | ) |
Windows-compatible version of escapeshellarg() Windows doesn't recognise single-quotes in the shell, but the escapeshellarg() function puts single quotes in regardless of OS.
Also fixes the locale problems on Linux in PHP 5.2.6+ (bug backported to earlier distro releases of PHP)
varargs |
Definition at line 2722 of file GlobalFunctions.php.
References wfInitShellLocale(), and wfIsWindows().
Referenced by DumpPipeOutput\__construct(), CheckSyntax\buildFileList(), CheckSyntax\checkFileWithCli(), DumpPipeOutput\closeAndRename(), MimeMagic\detectMimeType(), UploadBase\detectVirus(), PopulateImageSha1\doDBUpdates(), DjVuHandler\doTransform(), DifferenceEngine\generateDiffBody(), BitmapHandler\getMagickVersion(), Installer\locateExecutable(), ParserTest\quickDiff(), SvgHandler\rasterize(), Maintenance\readlineEmulation(), CheckStorage\restoreText(), DjVuImage\retrieveMetaData(), Dump7ZipOutput\setup7zCommand(), RecompressTracked\startSlaveProcs(), SevenZipStream\stream_open(), BitmapHandler\transformCustom(), wfDiff(), wfMerge(), RandomImageGenerator\writeImageWithApi(), and RandomImageGenerator\writeImageWithCommandLine().
wfEscapeWikiText | ( | $ | text | ) |
Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc.
making its way through. This is achieved by substituting certain characters with HTML entities. As required by the callers, <nowiki> is not used.
$text | String: text to be escaped |
Definition at line 1918 of file GlobalFunctions.php.
Referenced by MediaHandler\addMeta(), CoreParserFunctions\basepagename(), CoreParserFunctions\basepagenamee(), Parser\braceSubstitution(), Article\delete(), LoginForm\displaySuccessfulLogin(), FileDeleteForm\doDelete(), Article\doDelete(), MovePageForm\doSubmit(), SpecialMergeHistory\execute(), FileDuplicateSearchPage\execute(), SpecialSearch\formHeader(), CoreParserFunctions\fullpagename(), CoreParserFunctions\fullpagenamee(), Parser\getUserSig(), Parser\getVariableValue(), SpecialPasswordReset\onSubmit(), ImagePage\openShowImage(), CoreParserFunctions\pagename(), CoreParserFunctions\pagenamee(), FileDeleteForm\prepareMessage(), LoginForm\processLogin(), ProtectionForm\show(), SpecialSearch\showCreateLink(), UserrightsPage\showEditUserGroupsForm(), EditPage\showIntro(), Article\showMissingArticle(), SpecialSearch\showResults(), EditPage\spamPage(), EditPage\spamPageWithContent(), CoreParserFunctions\subjectpagename(), CoreParserFunctions\subjectpagenamee(), CoreParserFunctions\subpagename(), CoreParserFunctions\subpagenamee(), CoreParserFunctions\talkpagename(), CoreParserFunctions\talkpagenamee(), and SpecialBlock\validateTargetField().
wfExpandUrl | ( | $ | url, |
$ | defaultProto = PROTO_CURRENT |
||
) |
Expand a potentially local URL to a fully-qualified URL.
Assumes $wgServer is correct.
The meaning of the PROTO_* constants is as follows: PROTO_HTTP: Output a URL starting with http:// PROTO_HTTPS: Output a URL starting with https:// PROTO_RELATIVE: Output a URL starting with // (protocol-relative URL) PROTO_CURRENT: Output a URL starting with either http:// or https:// , depending on which protocol was used for the current incoming request PROTO_CANONICAL: For URLs without a domain, like /w/index.php , use $wgCanonicalServer. For protocol-relative URLs, use the protocol of $wgCanonicalServer PROTO_INTERNAL: Like PROTO_CANONICAL, but uses $wgInternalServer instead of $wgCanonicalServer
$url | String: either fully-qualified or a local path + query |
$defaultProto | Mixed: one of the PROTO_* constants. Determines the protocol to use if $url or $wgServer is protocol-relative |
Definition at line 461 of file GlobalFunctions.php.
References $url, $wgCanonicalServer, $wgInternalServer, $wgServer, WebRequest\detectProtocol(), wfAssembleUrl(), wfParseUrl(), and wfRemoveDotSegments().
Referenced by ResourceLoaderFileModule\__construct(), MWHttpRequest\__construct(), ApiQuerySiteinfo\appendGeneralInfo(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendRightsInfo(), ApiQueryLangLinks\execute(), ApiQueryIWLinks\execute(), MWHttpRequest\execute(), SquidUpdate\expand(), ApiQueryInfo\extractPageInfo(), CoreParserFunctions\filepath(), ApiParse\formatIWLinks(), ApiParse\formatLangLinks(), File\getCanonicalUrl(), Title\getCanonicalURL(), RevertFileAction\getFormFields(), WebRequest\getFullRequestURL(), File\getFullUrl(), Title\getFullURL(), OutputPage\getHeadLinks(), ApiQueryImageInfo\getInfo(), Title\getInternalURL(), ApiRsd\getRsdApiList(), ForeignAPIRepo\httpGet(), ResourceLoader\makeLoaderURL(), RevertFileAction\onSuccess(), RSSFeed\outHeader(), RSSFeed\outItem(), OutputPage\output(), ApiQuery\outputGeneralPageInfo(), SpecialUploadStash\outputRemoteScaledThumb(), ChannelFeed\outXmlHeader(), MediaWiki\performRequest(), FileDeleteForm\prepareMessage(), CSSMin\remap(), wfExpandUrl\testWfExpandUrl(), File\transform(), and wfProxyCheck().
wfFindFile | ( | $ | title, |
$ | options = array() |
||
) |
Find a file.
Shortcut for RepoGroup::singleton()->findFile()
$title | String or Title object |
$options | Associative array of options: time: requested time for an archived image, or false for the current version. An image object will be returned which was created at the specified time. |
ignoreRedirect: If true, do not follow file redirects
private: If true, return restricted (deleted) files if the current user is allowed to view them. Otherwise, such files will not be found.
bypassCache: If true, do not use the process-local cache of File objects
Definition at line 3528 of file GlobalFunctions.php.
References $options, $title, and RepoGroup\singleton().
Referenced by SpecialUpload\ajaxGetExistsWarning(), UploadFromUrlTest\deleteFile(), ApiTestCaseUpload\deleteFileByTitle(), MovePageForm\doSubmit(), SpecialFilepath\execute(), ApiMove\execute(), DeleteBatch\execute(), FileDuplicateSearchPage\execute(), Parser\fetchFileAndTitle(), CoreParserFunctions\filepath(), SearchEngine\getNearMatchInternal(), SearchResult\initFromTitle(), Title\isAlwaysKnown(), WikiFilePage\loadFile(), ImagePage\loadFile(), Linker\makeBrokenImageLinkObj(), Linker\makeMediaLinkObj(), Linker\makeThumbLink2(), ApiQuery\outputGeneralPageInfo(), UploadDumper\outputItem(), LegacyTemplate\pageTitleLinks(), SpecialSearch\showHit(), LegacyTemplate\talkLink(), ImageGallery\toHTML(), and Title\validateFileMoveOperation().
wfFixSessionID | ( | ) |
Override session_id before session startup if php's built-in session generation code is not secure.
Definition at line 3319 of file GlobalFunctions.php.
References MWCryptRand\generateHex(), wfCheckEntropy(), and wfDebug().
Referenced by wfSetupSession().
wfForeignMemcKey | ( | $ | db, |
$ | prefix | ||
) |
Get a cache key for a foreign DB.
$db | String |
$prefix | String |
varargs | String |
Definition at line 3423 of file GlobalFunctions.php.
Referenced by UserRightsProxy\invalidateCache().
wfFormatStackFrame | ( | $ | frame | ) |
Return a string representation of frame.
$frame | Array |
Definition at line 1791 of file GlobalFunctions.php.
Referenced by wfGetCaller().
wfGenerateToken | ( | $ | salt = '' | ) |
Generate a random 32-character hexadecimal token.
$salt | Mixed: some sort of salt, if necessary, to add to random characters before hashing. |
Definition at line 3696 of file GlobalFunctions.php.
Referenced by UploadSourceAdapter\registerSource().
wfGetAllCallers | ( | $ | limit = 3 | ) |
Return a string consisting of callers in the stack.
Useful sometimes for profiling specific points.
$limit | The maximum depth of the stack frame to return, or false for the entire stack. |
Definition at line 1776 of file GlobalFunctions.php.
References $limit, and wfDebugBacktrace().
Referenced by MWCryptRand\realGenerate().
wfGetCache | ( | $ | inputType | ) |
Get a cache object.
$inputType | integer Cache type, one the the CACHE_* constants. |
Definition at line 3817 of file GlobalFunctions.php.
References ObjectCache\getInstance().
Referenced by MessageCache\__construct(), LCStore_Accel\__construct(), ResourceLoader\filter(), IcuCollation\getFirstLetterData(), MessageCache\getMostUsedMessages(), ForkController\initChild(), MessageCache\logMessages(), and ResourceLoaderModule\validateScriptFile().
wfGetCaller | ( | $ | level = 2 | ) |
Get the name of the function which called this function.
$level | Int |
Definition at line 1758 of file GlobalFunctions.php.
References wfDebugBacktrace(), and wfFormatStackFrame().
Referenced by StubObject\_unstub(), MWDebug\deprecated(), MWDebug\log(), Parser\parse(), and MWDebug\warning().
Get a Database object.
$db | Integer: index of the connection to get. May be DB_MASTER for the master (for write queries), DB_SLAVE for potentially lagged read queries, or an integer >= 0 for a particular server. |
$groups | Mixed: query groups. An array of group names that this query belongs to. May contain a single string if the query is only in one group. |
$wiki | String: the wiki ID, or false for the current wiki |
Note: multiple calls to wfGetDB(DB_SLAVE) during the course of one request will always return the same object, unless the underlying connection or load balancer is manually destroyed.
Note 2: use $this->getDB() in maintenance scripts that may be invoked by updater to ensure that a proper database is being updated.
Definition at line 3485 of file GlobalFunctions.php.
References wfGetLB().
Referenced by SearchEngine\__construct(), DeletedContribsPager\__construct(), LinksUpdate\__construct(), Block\__construct(), CategoryPager\__construct(), ImageListPager\__construct(), IndexPager\__construct(), SiteStatsInit\__construct(), MergeHistoryPager\__construct(), ContribsPager\__construct(), OutputPage\addCategoryLinks(), User\addGroup(), LinkCache\addLinkObj(), ApiQueryLogEvents\addLogParams(), LogPage\addRelations(), ChangeTags\addTags(), User\addToDatabase(), WatchedItem\addWatch(), Job\batchInsert(), SpecialRecentChanges\buildMainQueryConds(), ImageBuilder\buildTable(), SiteStatsUpdate\cacheUpdate(), TitleListDependency\calculateTimestamps(), userOptions\CHANGER(), CheckStorage\check(), TrackBlobs\checkIntegrity(), SpecialRecentChanges\checkLastModified(), User\checkNewtalk(), Orphans\checkOrphans(), RevisionDeleter\checkRevisionExistence(), Orphans\checkSeparation(), RecompressTracked\checkTrackingTable(), Orphans\checkWidows(), CleanupSpam\cleanupArticle(), SpecialEditWatchlist\cleanupWatchlist(), MessageBlobStore\clear(), User\clearAllNotifications(), User\clearNotification(), SpecialEditWatchlist\clearWatchlist(), ViewCountUpdate\collect(), CgzCopyTransaction\commit(), WikiPage\commitRollback(), EditPage\commitWatch(), CompressOld\compressOldPages(), CompressOld\compressPage(), CompressOld\compressWithConcat(), Title\countAuthorsBetween(), SpecialWatchlist\countItems(), Title\countRevisionsBetween(), SearchEngine\create(), User\createNew(), ConvertLinks\createTempTable(), Block\defaultRetroactiveAutoblock(), Block\delete(), Article\delete(), DifferenceEngine\deletedLink(), RefreshLinks\deleteLinksFromNonexistent(), User\deleteNewtalk(), NukePage\deleteRevisions(), Title\deleteTitleProtection(), FixSlaveDesync\desyncFixPage(), SiteStatsInit\doAllAndCommit(), RecompressTracked\doAllOrphans(), RecompressTracked\doAllPages(), WikiPage\doCascadeProtectionUpdates(), CategoryViewer\doCategoryQuery(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateParentId\doDBUpdates(), PopulateImageSha1\doDBUpdates(), DeleteArchivedFilesImplementation\doDelete(), DeleteArchivedRevisionsImplementation\doDelete(), DeleteOldRevisions\doDelete(), FileDeleteForm\doDelete(), WikiPage\doDeleteArticleReal(), WikiPage\doDeleteUpdates(), WatchedItem\doDuplicateEntries(), WikiPage\doEdit(), WikiPage\doEditUpdates(), SpecialExport\doExport(), SpecialRecentchangeslinked\doMainQuery(), SpecialRecentChanges\doMainQuery(), RecompressTracked\doOrphanList(), RecompressTracked\doPage(), PopulateCategory\doPopulateCategory(), WikiPage\doPurge(), GenderCache\doQuery(), LinkBatch\doQuery(), WikiPage\doQuickEdit(), ReassignEdits\doReassignEdits(), RefreshLinks\doRefreshLinks(), MovePageForm\doSubmit(), ViewCountUpdate\doUpdate(), SiteStatsUpdate\doUpdate(), WikiPage\doUpdateRestrictions(), DeferredUpdates\doUpdates(), UpdateSearchIndex\doUpdateSearchIndex(), LinkHolderArray\doVariants(), User\edits(), Title\estimateRevisionCount(), BenchmarkDeleteTruncate\execute(), StorageTypeStats\execute(), DumpRev\execute(), GetSlaveServer\execute(), DeleteRevision\execute(), FixUserRegistration\execute(), RebuildAll\execute(), RefreshImageCount\execute(), MwSql\execute(), CheckBadRedirects\execute(), CheckImages\execute(), DeleteDefaultMessages\execute(), CleanupSpam\execute(), ClearInterwikiCache\execute(), GetTextMaint\execute(), MigrateUserGroup\execute(), BatchedQueryRunner\execute(), UpdateLogging\execute(), ConvertUserOptions\execute(), DumpSisterSites\execute(), NukePage\execute(), RemoveUnusedAccounts\execute(), ResetUserTokens\execute(), ShowJobs\execute(), UpdateSpecialPages\execute(), ApiProtect\execute(), CheckUsernames\execute(), DeleteImageCache\execute(), DeleteOrphanedRevisions\execute(), OrphanStats\execute(), UpdateRestrictions\execute(), UpdateArticleCount\execute(), CleanupRemovedModules\execute(), DeleteSelfExternals\execute(), RenameDbPrefix\execute(), PatchSql\execute(), SpecialWatchlist\execute(), AttachLatest\execute(), FixTimestamps\execute(), InitStats\execute(), ShowStats\execute(), SpecialTags\execute(), FixDoubleRedirects\execute(), SpecialStatistics\execute(), FixBug20757\execute(), DeleteArchivedRevisions\execute(), DumpLinks\execute(), InitEditCount\execute(), AlterSharedConstraints\execute(), UpdateDoubleWidthSearch\execute(), FetchText\execute(), DeleteBatch\execute(), RebuildFileCache\execute(), RunJobs\execute(), ApiBlock\execute(), NamespaceConflictChecker\execute(), SqliteMaintenance\execute(), ConvertLinks\execute(), RebuildTextIndex\execute(), NukeNS\execute(), MoveBatch\execute(), ImageBuilder\execute(), RefreshImageMetadata\execute(), UpdateMediaWiki\execute(), GenerateSitemap\execute(), QueryPage\execute(), QueryPage\fetchFromCache(), UploadDumper\fetchLocal(), Revision\fetchRevision(), HistoryAction\fetchRevisions(), Parser\fetchScaryTemplateMaybeFromCache(), UploadDumper\fetchUsed(), TitleCleanup\fileExists(), TrackBlobs\findOrphanBlobs(), FixSlaveDesync\findPageLatestCorruption(), RecompressTracked\finishIncompleteMoves(), RefreshLinks\fixLinksFromArticle(), RefreshLinks\fixRedirect(), DoubleRedirectJob\fixRedirects(), Block\formatExpiry(), Language\formatExpiry(), DoubleRedirectsPage\formatResult(), SpecialProtectedtitles\formatRow(), SpecialProtectedpages\formatRow(), LCStore_DB\get(), Interwiki\getAllPrefixesDB(), WikiPage\getAutoDeleteReason(), EditPage\getBaseRevision(), Title\getBrokenLinksFrom(), QueryPage\getCachedTimestamp(), Title\getCascadeProtectionSources(), WikiPage\getContributors(), RevDel_RevisionList\getCurrent(), AllmessagesTablePager\getCustomisedStatuses(), Block\getDatabaseArray(), ResourceLoaderWikiModule\getDB(), SqlBagOStuff\getDB(), BacklinkCache\getDB(), UserRightsProxy\getDB(), ApiQuery\getDB(), Maintenance\getDB(), ApiBase\getDB(), ProtectionForm\getExpiry(), ResourceLoaderModule\getFileDependencies(), DoubleRedirectJob\getFinalDestination(), User\getFirstEditTimestamp(), Title\getFirstRevision(), User\getFormerGroups(), MessageBlobStore\getFromDB(), WikiPage\getHiddenCategories(), DeleteImageCache\getImageCount(), EditPage\getLastDelete(), WikiPage\getLastNAuthors(), PageArchive\getLastRevisionText(), SpecialExport\getLinks(), Title\getLinksFrom(), Title\getLinksTo(), ExternalUser\getLocalUser(), ForeignDBViaLBRepo\getMasterDB(), LocalRepo\getMasterDB(), Category\getMembers(), SpecialStatistics\getMostViewedPages(), ResourceLoaderModule\getMsgBlobMtime(), ApiQuery\getNamedDB(), Title\getNextRevisionID(), Title\getNotificationTimestamp(), SpecialExport\getPagesFromCategory(), SpecialExport\getPagesFromNamespace(), Title\getParentCategories(), nextJobDB\getPendingDbs(), PageArchive\getPreviousRevision(), Title\getPreviousRevisionID(), DisambiguationsPage\getQueryInfo(), NewFilesPager\getQueryInfo(), UsersPager\getQueryInfo(), WithoutInterwikiPage\getQueryInfo(), ActiveUsersPager\getQueryInfo(), ImageListPager\getQueryInfo(), LinkSearchPage\getQueryInfo(), ProtectedPagesPager\getQueryInfo(), Block\getRangeCond(), Title\getRedirectsHere(), WikiPage\getRedirectTarget(), PageArchive\getRevision(), FixBug20757\getRevTextMap(), RollbackEdits\getRollbackTitles(), ForeignDBViaLBRepo\getSlaveDB(), LocalRepo\getSlaveDB(), ResourceLoaderFileModule\getStyles(), Title\getSubpages(), HistoryBlobStub\getText(), HistoryBlobCurStub\getText(), TextPassDumper\getText(), TrackBlobs\getTextClause(), PageArchive\getTextFromRow(), Revision\getTimestampFromId(), Revision\getTitle(), Title\getTitleProtection(), Title\getTouched(), MessageBlobStore\getUpdatesForMessage(), SpecialEditWatchlist\getWatchlist(), SpecialEditWatchlist\getWatchlistInfo(), BackupReader\handleUpload(), User\idForName(), User\idFromName(), WikiImporter\importLogItem(), WikiRevision\importLogItem(), WikiRevision\importOldRevision(), WikiImporter\importRevision(), CheckStorage\importRevision(), WikiImporter\importUpload(), User\incEditCount(), Block\infinity(), Block\initFromRow(), Category\initialize(), BackupDumper\initProgress(), TrackBlobs\initTrackingTable(), Job\insert(), ManualLogEntry\insert(), Block\insert(), Job\insertFields(), MessageBlobStore\insertMessageBlob(), WikiPage\insertRedirectEntry(), User\invalidateCache(), Title\invalidateCache(), HTMLCacheUpdate\invalidateTitles(), WikiPage\isCountable(), PageArchive\isDeleted(), Title\isDeleted(), Title\isDeletedQuick(), RemoveUnusedAccounts\isInactiveAccount(), Title\isNewPage(), Title\isSingleRevRedirect(), Revision\isUnpatrolled(), WatchedItem\isWatched(), SiteStats\jobs(), ImageCleanup\killRow(), ExternalUser\linkToLocal(), PageArchive\listAllPages(), ChangeTags\listDefinedTags(), PageArchive\listFiles(), PageArchive\listPagesByPrefix(), PageArchive\listRevisions(), SiteStats\load(), ArchivedFile\load(), Interwiki\load(), SiteStats\loadAndLazyInit(), User\loadFromDatabase(), MessageCache\loadFromDB(), User\loadGroups(), User\loadOptions(), WikiPage\loadPageData(), Title\loadRestrictions(), Title\loadRestrictionsFromRows(), Revision\loadText(), Profiler\logData(), LinkFilter\makeLikeArray(), DifferenceEngine\markPatrolledLink(), SpecialMergeHistory\merge(), EditPage\mergeChangesInto(), SearchMySQL\minSearchLength(), TitleCleanup\moveIllegalPage(), TitleCleanup\moveInconsistentPage(), RecompressTracked\moveTextRow(), Title\moveTo(), moveToExternal(), Title\moveToInternal(), LinkSearchPage\mungeQuery(), Title\nameOf(), RecentChange\newFromConds(), Revision\newFromConds(), User\newFromConfirmationCode(), RecentChange\newFromId(), Block\newFromID(), Title\newFromID(), UserArray\newFromIDs(), Title\newFromIDs(), SquidUpdate\newFromLinksTo(), Revision\newFromPageId(), Revision\newFromTitle(), ExternalUser\newFromUser(), Block\newLoad(), EmailNotification\notifyOnPageChange(), SiteStats\numberingroup(), SpecialPasswordReset\onSubmit(), SkinTemplate\outputPage(), InfoAction\pageCountInfo(), SiteStats\pagesInNs(), SpecialBlock\parseExpiryInput(), ImageCleanup\pokeFile(), Job\pop(), Job\pop_type(), ResourceLoader\preloadModuleInfo(), Block\purgeExpired(), Title\purgeExpiredRestrictions(), PurgeList\purgeNamespace(), PurgeRedundantText(), purgeStaleMemcachedText(), ImagePage\queryImageLinks(), QueryPage\reallyDoQuery(), RecentChange\reallyMarkPatrolled(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), RebuildRecentchanges\rebuildRecentChangesTablePass2(), RebuildRecentchanges\rebuildRecentChangesTablePass3(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), QueryPage\recache(), SiteStatsInit\refresh(), Category\refreshCounts(), RevDel_List\reloadFromMaster(), Job\removeDuplicates(), User\removeGroup(), WatchlistCleanup\removeWatch(), WatchedItem\removeWatch(), LinkHolderArray\replaceInternal(), WikiPage\replaceSection(), ImportReporter\reportPage(), RevisionListBase\reset(), MediaWikiTestCase\resetDB(), resolveStub(), resolveStubs(), CheckStorage\restoreText(), MediaWikiTestCase\run(), TableCleanup\runTable(), Job\safeBatchInsert(), RecentChange\save(), LogPage\saveContent(), User\saveOptions(), User\saveSettings(), RandomPage\selectRandomPageFromDB(), RevDel_RevisionItem\setBits(), RevDel_ArchiveItem\setBits(), RevDel_ArchivedRevisionItem\setBits(), RevDel_FileItem\setBits(), RevDel_ArchivedFileItem\setBits(), RevDel_LogItem\setBits(), DatabaseTest\setUp(), ParserTest\setupDatabase(), setupTestResources(), RevisionDeleteUser\setUsernameBitfields(), RevDel_List\setVisibility(), SpecialAllpages\showChunk(), MovePageForm\showForm(), SpecialWhatLinksHere\showIndirectLinks(), SpecialBlockList\showList(), SpecialPrefixindex\showPrefixChunk(), SpecialAllpages\showToplevel(), SpecialVersion\softwareInformation(), LCStore_DB\startWrite(), RecompressTracked\syncDBs(), teardownTestResources(), TitlePermissionTest\testActionPermissions(), DatabaseTest\testStoredFunctions(), TrackBlobs\trackOrphanText(), TrackBlobs\trackRevisions(), ResourceLoader\tryRespondFromFileCache(), PageArchive\undeleteRevisions(), SpecialEditWatchlist\unwatchTitles(), SearchIBM_DB2\update(), SearchOracle\update(), SearchSqlite\update(), SearchMySQL\update(), SiteStatsInit\update(), Block\update(), WikiPage\updateCategoryCounts(), MessageBlobStore\updateMessage(), MessageBlobStore\updateModule(), User\updateNewtalk(), Block\updateTimestamp(), SearchIBM_DB2\updateTitle(), SearchOracle\updateTitle(), SearchSqlite\updateTitle(), SearchMySQL\updateTitle(), userOptions\USAGER(), EditPage\userWasLastToEdit(), SpecialEditWatchlist\watchTitles(), SpecialRecentChanges\webOutput(), User\whoIs(), and User\whoIsReal().
wfGetLangObj | ( | $ | langcode = false | ) |
Return a Language object from $langcode.
$langcode | Mixed: either:
|
Definition at line 1228 of file GlobalFunctions.php.
References $wgContLang, $wgLang, $wgLanguageCode, Language\factory(), Language\getLanguageNames(), and wfDebug().
Referenced by SpecialAllmessages\execute(), MessageCache\get(), Title\getPageLanguage(), DifferenceEngine\setTextLanguage(), and wfMsgExt().
Get a load balancer object.
$wiki | String: wiki ID, or false for the current wiki |
Definition at line 3495 of file GlobalFunctions.php.
References wfGetLBFactory().
Referenced by ApiQuerySiteinfo\appendDbReplLagInfo(), nextJobDB\checkJob(), MediaWiki\checkMaxLag(), ApiMain\checkMaxLag(), MysqlUpdater\doTemplatelinksUpdate(), GetLagTimes\execute(), GetSlaveServer\execute(), FixSlaveDesync\execute(), DatabaseLag\execute(), UpdateSpecialPages\execute(), SpecialWatchlist\execute(), SpecialContributions\execute(), InitEditCount\execute(), DeletedContributionsPage\execute(), nextJobDB\getPendingDbs(), Revision\getTimestampFromId(), Skin\lastModified(), Revision\loadText(), Revision\newFromConds(), Revision\newFromPageId(), Revision\newFromTitle(), MediaWikiTestCase\resetDB(), ParserTest\setupDatabase(), RecompressTracked\waitForSlaves(), wfGetDB(), and wfWaitForSlaves().
& wfGetLBFactory | ( | ) |
Get the load balancer factory object.
Definition at line 3504 of file GlobalFunctions.php.
References LBFactory\singleton().
Referenced by DbTestPreviewer\__construct(), BackupDumper\backupDb(), CloneDatabase\changePrefix(), RefreshLinks\deleteLinksFromNonexistent(), SpecialExport\doExport(), MediaWiki\finalCleanup(), TrackBlobs\findOrphanBlobs(), DBLockManager\getConnection(), OrphanStats\getDB(), SqlBagOStuff\getDB(), RecompressTracked\getExtDB(), ExternalStoreDB\getLoadBalancer(), ForkController\prepareEnvironment(), MediaWiki\restInPeace(), and wfGetLB().
wfGetMainCache | ( | ) |
Get the main cache object.
Definition at line 3826 of file GlobalFunctions.php.
References $wgMainCacheType, and ObjectCache\getInstance().
Referenced by DBLockManager\__construct(), LoadMonitor_MySQL\getLagTimes(), UploadFromUrlTestSuite\setUp(), NewParserTest\setUp(), and ParserTest\setUp().
Get the cache object used by the message cache.
Definition at line 3836 of file GlobalFunctions.php.
References $wgMessageCacheType, and ObjectCache\getInstance().
Referenced by UploadFromUrlTestSuite\setUp(), NewParserTest\setUp(), ParserTest\setUp(), and MessageCache\singleton().
wfGetNull | ( | ) |
Get a platform-independent path to the null file, e.g.
/dev/null
Definition at line 3627 of file GlobalFunctions.php.
References wfIsWindows().
Referenced by MWTidy\execExternalTidy(), Dump7ZipOutput\setup7zCommand(), and wfProxyCheck().
Get the cache object used by the parser cache.
Definition at line 3846 of file GlobalFunctions.php.
References $wgParserCacheType, and ObjectCache\getInstance().
Referenced by PurgeParserCache\execute(), UploadFromUrlTestSuite\setUp(), NewParserTest\setUp(), and ParserTest\setUp().
wfGetPrecompiledData | ( | $ | name | ) |
Get an object from the precompiled serialized directory.
$name | String |
Definition at line 3387 of file GlobalFunctions.php.
References $blob, $file, and $IP.
Referenced by Language\getCaseMaps(), IcuCollation\getFirstLetterData(), and Language\transformUsingPairFile().
wfGetScriptUrl | ( | ) |
wfHostname | ( | ) |
Fetch server name for use in error reporting etc.
Use real server name if available, so we know which machine in a server farm generated the current page.
Definition at line 1619 of file GlobalFunctions.php.
Referenced by DifferenceEngine\debug(), DjVuHandler\doTransform(), MWCryptRand\initialRandomState(), Profiler\logData(), BitmapHandler\logErrorForExternalProcess(), RecompressTracked\logToFile(), DatabaseMysql\open(), LoadBalancer\openForeignConnection(), SvgHandler\rasterize(), wfDebugLog(), wfLogDBError(), wfReportTime(), and wfThumbError().
wfHttpError | ( | $ | code, |
$ | label, | ||
$ | desc | ||
) |
Provide a simple HTTP error.
$code | Int|String |
$label | String |
$desc | String |
Definition at line 2000 of file GlobalFunctions.php.
Referenced by AjaxDispatcher\performAction().
wfHttpOnlySafe | ( | ) |
Definition at line 3284 of file GlobalFunctions.php.
References $wgHttpOnlyBlacklist.
Referenced by WebResponse\setcookie(), and wfSetupSession().
wfIncrStats | ( | $ | key, |
$ | count = 1 |
||
) |
Increment a statistics counter.
$key | String |
$count | Int |
Definition at line 2550 of file GlobalFunctions.php.
References $count, $wgAggregateStatsID, $wgDBname, $wgMemc, $wgStatsMethod, $wgUDPProfilerHost, $wgUDPProfilerPort, wfMemcKey(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by Job\batchInsert(), ParserCache\get(), DifferenceEngine\getDiffBody(), ParserCache\getKey(), LoadMonitor_MySQL\getLagTimes(), WikiPage\getParserOutput(), Job\insert(), Job\pop(), Job\pop_type(), Job\removeDuplicates(), Job\safeBatchInsert(), and Article\view().
wfIniGetBool | ( | $ | setting | ) |
Safety wrapper around ini_get() for boolean settings.
The values returned from ini_get() are pre-normalized for settings set via php.ini or php_flag/php_admin_flag... but *not* for those set via php_value/php_admin_value.
It's fairly common for people to use php_value instead of php_flag, which can leave you with an 'off' setting giving a false positive for code that just takes the ini_get() return value as a boolean.
To make things extra interesting, setting via php_value accepts "true" and "yes" as true, but php.ini and php_flag consider them false. :) Unrecognized values go false... again opposite PHP's own coercion from string to bool.
Luckily, 'properly' set settings will always come back as '0' or '1', so we only have to worry about them and the 'improper' settings.
I frickin' hate PHP... :P
$setting | String |
Definition at line 2667 of file GlobalFunctions.php.
Referenced by CurlHttpRequest\canFollowRedirects(), MWHttpRequest\canMakeRequests(), Installer\envCheckCache(), Installer\envCheckMagicQuotes(), Installer\envCheckMagicSybase(), Installer\envCheckMbstring(), Installer\envCheckRegisterGlobals(), Installer\envCheckSafeMode(), Installer\envCheckZE1(), MWHttpRequest\factory(), UploadBase\isEnabled(), ObjectCache\newAccelerator(), UserMailer\send(), WebInstaller\startSession(), wfDl(), wfInitShellLocale(), and wfShellExec().
Workaround for http://bugs.php.net/bug.php?id=45132 escapeshellarg() destroys non-ASCII characters if LANG is not a UTF-8 locale.
Definition at line 2871 of file GlobalFunctions.php.
References $wgShellLocale, and wfIniGetBool().
Referenced by wfEscapeShellArg(), and wfShellExec().
wfIsDebugRawPage | ( | ) |
Returns true if debug logging should be suppressed if $wgDebugRawPage = false.
Definition at line 890 of file GlobalFunctions.php.
Referenced by wfDebug(), and wfLogProfilingData().
wfIsHipHop | ( | ) |
Check if we are running under HipHop.
Definition at line 2461 of file GlobalFunctions.php.
Referenced by UploadForm\getSourceSection(), and UploadBase\isEnabled().
wfIsWindows | ( | ) |
Check if the operating system is Windows.
Definition at line 2448 of file GlobalFunctions.php.
Referenced by ParserTest\__construct(), CdbWriter_DBA\close(), CdbWriter_PHP\close(), FSFileBackend\doMoveInternal(), FSLockManager\doSingleUnlock(), Installer\envCheckGraphics(), BitmapHandler\escapeMagickPath(), RebuildLocalisationCache\execute(), UploadBase\getTitle(), getVars(), FSFileBackend\isLegalRelPath(), ParserTest\quickDiff(), Maintenance\readlineEmulation(), MWCryptRand\realGenerate(), UserMailer\send(), SevenZipStream\stream_open(), StructureTest\testUnitTestFileNamesEndWithTest(), GlobalTest\testWfShellMaintenanceCmd(), MailAddress\toString(), FileRepo\validateFilename(), wfCheckEntropy(), wfDl(), wfEscapeShellArg(), wfGetNull(), wfShellExec(), and wfTempDir().
Load an extension messages file.
Definition at line 3618 of file GlobalFunctions.php.
References wfDeprecated().
wfLocalFile | ( | $ | title | ) |
Get an object referring to a locally registered file.
Returns a valid placeholder object if the file does not exist.
$title | Title|String |
Definition at line 3539 of file GlobalFunctions.php.
References $title, and RepoGroup\singleton().
Referenced by NewParserTest\addDBData(), ImageBuilder\addMissingImage(), SpecialUpload\ajaxGetExistsWarning(), PopulateImageSha1\doDBUpdates(), RevDel_FileList\doPostCommitUpdates(), MovePageForm\doSubmit(), ImageListPager\formatValue(), UploadBase\getLocalFile(), SpecialUpload\getWatchCheck(), WikiRevision\importUpload(), Title\isValidMoveTarget(), WikiFilePage\loadFile(), ImagePage\loadFile(), Title\moveTo(), UploadFromUrlTest\setUp(), ParserTest\setupDatabase(), UploadFromUrlTest\testAsyncUpload(), UploadFromUrlTest\testAsyncUploadWarning(), UploadFromUrlTest\testLeaveMessage(), LocalFileTest\testWfLocalFile(), PageArchive\undelete(), Title\validateFileMoveOperation(), ApiFileRevert\validateParameters(), wfStreamThumb(), and XmlDumpWriter\writeUploads().
wfLogDBError | ( | $ | text | ) |
Log for database errors.
$text | String: database error message. |
Definition at line 970 of file GlobalFunctions.php.
References $wgDBerrorLog, wfErrorLog(), wfHostname(), and wfWikiID().
Referenced by DatabaseMysql\open(), LoadMonitor_MySQL\postConnectionBackoff(), DatabaseBase\query(), LoadBalancer\reportConnectionError(), and DatabaseBase\reportQueryError().
Definition at line 1129 of file GlobalFunctions.php.
References $wgDebugLogFile, $wgDebugRawPage, $wgProfileLimit, $wgRequestTime, $wgUser, Profiler\instance(), wfErrorLog(), and wfIsDebugRawPage().
Referenced by MWExceptionHandler\handle(), and MediaWiki\restInPeace().
wfMakeUrlIndexes | ( | $ | url | ) |
Make URL indexes, appropriate for the el_index field of externallinks.
$url | String |
Definition at line 773 of file GlobalFunctions.php.
References $url, and wfParseUrl().
Referenced by LinksUpdate\getExternalInsertions(), and GlobalTest\testMakeUrlIndexes().
wfMatchesDomainList | ( | $ | url, |
$ | domains | ||
) |
Check whether a given URL has a domain that occurs in a given set of domains.
$url | string URL |
$domains | array Array of domains (strings) |
Definition at line 827 of file GlobalFunctions.php.
References $url, and wfParseUrl().
Referenced by Skin\addToSidebarPlain(), Parser\getExternalLinkAttribs(), and GlobalTest\testWfMatchesDomainList().
wfMemcKey | ( | ) |
Get a cache key.
varargs |
Definition at line 3406 of file GlobalFunctions.php.
References $wgCachePrefix, and wfWikiID().
Referenced by LanguageConverter\__construct(), LoginForm\addNewAccountInternal(), Skin\buildSidebar(), FileCacheBase\cacheMissKey(), MessageCache\clear(), LoginForm\clearLoginThrottle(), User\clearSharedCache(), DeleteImageCache\execute(), CacheStats\execute(), SpecialStatistics\execute(), ChangesFeed\execute(), ResourceLoader\filter(), LCStore_Accel\finishWrite(), LCStore_Accel\get(), WikiPage\getCachedLastEditTime(), Skin\getCachedNotice(), DifferenceEngine\getDiffBody(), IcuCollation\getFirstLetterData(), DateFormatter\getInstance(), Interwiki\getInterwikiCacheEntry(), LoadMonitor_MySQL\getLagTimes(), MessageCache\getMostUsedMessages(), MessageCache\getMsgFromNamespace(), User\getNewtalk(), ParserCache\getOptionsKey(), ParserCache\getParserOutputKey(), LoginForm\incLoginThrottle(), FileCacheBase\incrMissesRecent(), Block\isWhitelistedFromAutoblocks(), ChangeTags\listDefinedTags(), Interwiki\load(), MessageCache\load(), User\loadFromId(), Revision\loadText(), ApiMain\makeHelpMsg(), memsess_key(), SiteStats\numberingroup(), BacklinkCache\partition(), User\pingLimiter(), Preprocessor_Hash\preprocessToObj(), Preprocessor_DOM\preprocessToObj(), LoginForm\processLogin(), RebuildRecentchanges\purgeFeeds(), purgeStaleMemcachedText(), MessageCache\replace(), User\saveToCache(), MessageCache\saveToCaches(), LCStore_Accel\set(), WikiPage\setCachedLastEditTime(), User\setNewtalk(), SpecialAllpages\showToplevel(), LCStore_Accel\startWrite(), ResourceLoaderModule\validateScriptFile(), wfIncrStats(), and wfProxyCheck().
wfMemoryLimit | ( | ) |
Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit;.
Definition at line 3725 of file GlobalFunctions.php.
References $wgMemoryLimit, wfDebug(), wfRestoreWarnings(), wfShorthandToInteger(), and wfSuppressWarnings().
wfMerge | ( | $ | old, |
$ | mine, | ||
$ | yours, | ||
&$ | result | ||
) |
wfMerge attempts to merge differences between three texts.
Returns true for a clean merge and false for failure or a conflict.
$old | String |
$mine | String |
$yours | String |
$result | String |
Definition at line 2919 of file GlobalFunctions.php.
References $result, $wgDiff3, wfDebug(), wfEscapeShellArg(), wfRestoreWarnings(), wfSuppressWarnings(), and wfTempDir().
Referenced by WikiPage\getUndoText(), and EditPage\mergeChangesInto().
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g.
wfMergeErrorArrays( array( array( 'x' ) ), array( array( 'x', '2' ) ), array( array( 'x' ) ), array( array( 'y' ) ) ); returns: array( array( 'x', '2' ), array( 'x' ), array( 'y' ) )
varargs |
Definition at line 181 of file GlobalFunctions.php.
References $out.
Referenced by SpecialImport\execute(), Title\isValidMoveOperation(), and DifferenceEngine\showDiffPage().
wfMessage | ( | $ | key | ) |
This is the new function for getting translated interface messages.
See the Message class for documentation how to use them. The intention is that this function replaces all old wfMsg* functions.
$key | String : Message key. Varargs: normal message parameters. |
Definition at line 1283 of file GlobalFunctions.php.
Referenced by MediaTransformError\__construct(), HTMLSelectAndOtherField\__construct(), MediaHandler\addMeta(), Parser\addTrackingCategory(), SpecialPasswordReset\alterForm(), ProtectionForm\buildCleanupScript(), ProtectionForm\buildForm(), Title\checkUserBlock(), Article\confirmDelete(), LanguageConverter\convertTitle(), MonoBookTemplate\customBox(), Article\delete(), EditPage\displayPermissionsError(), Article\doDelete(), MovePageForm\doSubmit(), ApiQueryTags\doTag(), SpecialTags\doTagRow(), SpecialJavaScriptTest\execute(), SpecialUserlogout\execute(), ApiQueryAllmessages\execute(), SpecialStatistics\execute(), FileDeleteForm\execute(), SpecialListGroupRights\execute(), SpecialListUsers\execute(), LogPage\formatBlockFlag(), ResourceLoader\formatException(), Language\formatExpiry(), SpecialStatistics\formatRow(), SpecialNewpages\formatRow(), Language\formatTimePeriod(), Skin\getCategoryLinks(), ResourceLoaderWikiModule\getContent(), CategoryViewer\getCountMessage(), Title\getDefaultMessageText(), Interwiki\getDescription(), LogPage\getDescription(), ImageHandler\getDimensionsString(), UploadBase\getFilenamePrefixBlacklist(), NewFilesPager\getForm(), SpecialJavaScriptTest\getFrameworkListHtml(), MediaHandler\getGeneralLongDesc(), SpecialPageFactory\getGroup(), User\getGroupMember(), User\getGroupName(), User\getGroupPage(), SpecialStatistics\getGroupStats(), MediaHandler\getLongDesc(), ImageHandler\getLongDesc(), Interwiki\getName(), LogPage\getName(), ProtectionForm\getOptionLabel(), WantedFilesPage\getPageHeader(), SpecialWhatLinksHere\getPrevNext(), RawAction\getRawText(), Block\getRedactedName(), User\getRightDescription(), ImageHandler\getShortDesc(), SpecialBlock\getSuggestedDurations(), HTMLFormField\getTableRow(), HTMLEditTools\getTableRow(), SpecialUpload\getUploadForm(), Parser\getUserSig(), Language\getVariantname(), UserrightsPage\groupCheckboxes(), Title\hasSourceText(), ImagePage\imageLinks(), SpecialJavaScriptTest\initQUnitTesting(), DifferenceEngine\intermediateEditsMsg(), CoreParserFunctions\intFunction(), ImagePage\makeSizeLink(), Licenses\msg(), LogFormatter\msg(), EditPage\noSuchSectionPage(), WikiImporter\notice(), Language\numLink(), SpecialPasswordReset\onSubmit(), RollbackAction\onView(), ImagePage\openShowImage(), CategoryViewer\pagingLinks(), HTMLSelectAndOtherField\parseMessage(), PurgeAction\postText(), PurgeAction\preText(), SpecialPasswordReset\preText(), WatchAction\preText(), UnwatchAction\preText(), SpecialUpload\processVerificationError(), Parser\pstPass2(), CologneBlueTemplate\quickBar(), AllmessagesTablePager\reallyDoQuery(), VectorTemplate\renderPortal(), FileDeleteForm\setHeaders(), EditPage\setHeaders(), Article\setOldSubtitle(), RdfMetaData\setup(), ProtectionForm\show(), ChangesList\showCharacterDifference(), EditPage\showEditTools(), UserrightsPage\showEditUserGroupsForm(), ImagePage\showError(), EditPage\showHeader(), Article\showNamespaceHeader(), Article\showRedirectedFromHeader(), EditPage\showTosSummary(), EditPage\spamPage(), EditPage\spamPageWithContent(), UploadStash\stashFile(), Parser\statelessFetchTemplate(), ChangeTags\tagDescription(), MessageTest\testExists(), MessageTest\testInContentLanguage(), MessageTest\testInLanguage(), MessageTest\testInLanguageThrows(), MessageTest\testKey(), MessageTest\testMessageParams(), MessageTest\testMessageParamSubstitution(), SpecialEmailUser\userForm(), ImagePage\view(), Article\view(), and Language\viewPrevNext().
This function accepts multiple message keys and returns a message instance for the first message which is non-empty.
If all messages are empty then an instance of the first message key is returned.
varargs,: | message keys |
Definition at line 1300 of file GlobalFunctions.php.
References MWFunction\callArray().
Referenced by SkinTemplate\buildContentNavigationUrls(), FileRepo\getDisplayName(), and SkinTemplate\tabAction().
wfMkdirParents | ( | $ | dir, |
$ | mode = null , |
||
$ | caller = null |
||
) |
Make directory, and make all parent directories if they don't exist.
$dir | String: full path to directory to create |
$mode | Integer: chmod value to use, default is $wgDirectoryMode |
$caller | String: optional caller param for debugging. |
Definition at line 2511 of file GlobalFunctions.php.
References $dir, $ok, $wgDirectoryMode, FileBackend\isStoragePath(), wfDebug(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by FileCacheBase\checkCacheDirs(), SqliteInstaller\dataDirOKmaybeCreate(), FSFileBackend\doPrepareInternal(), FSLockManager\doSingleLock(), SvgHandler\doTransform(), BitmapHandler\doTransform(), DjVuHandler\doTransform(), GenerateSitemap\init_path(), ImageCleanup\pokeFile(), MessageCache\saveToLocal(), MessageCache\saveToScript(), UploadFromUrlTestSuite\setupUploadDir(), ParserTest\setupUploadDir(), and LCStore_CDB\startWrite().
wfMsg | ( | $ | key | ) |
Get a message from anywhere, for the current user language.
Use wfMsgForContent() instead if the message should NOT change depending on the user preferences.
$key | String: lookup key for the message, usually defined in languages/Language.php |
Parameters to the message, which can be used to insert variable text into it, can be passed to this function in the following formats:
Definition at line 1322 of file GlobalFunctions.php.
References wfMsgReal().
Referenced by ErrorPageError\__construct(), TransformParameterError\__construct(), UserBlockedError\__construct(), UploadForm\__construct(), HTMLSelectOrOtherField\__construct(), RevertFileAction\alterForm(), PurgeAction\alterForm(), WatchAction\alterForm(), UnwatchAction\alterForm(), RdfMetaData\basics(), ImageHistoryList\beginImageHistoryList(), SpecialRevisionDelete\buildCheckBoxes(), ProtectionForm\buildForm(), Xml\buildForm(), Linker\buildRollbackLink(), ChangeTags\buildTagFilterSelector(), SpecialEditWatchlist\buildTools(), SpecialRecentChanges\categoryFilterForm(), Title\checkSpecialsAndNSPermissions(), Title\checkUserBlock(), FormatMetadata\collapseContactInfo(), LegacyTemplate\commentLink(), Article\confirmDelete(), Xml\dateMenu(), LegacyTemplate\deleteThisPage(), UploadBase\detectVirus(), CologneBlueTemplate\doAfterContent(), CologneBlueTemplate\doBeforeContent(), SpecialRecentChanges\doHeader(), MovePageForm\doSubmit(), SvgHandler\doTransform(), DjVuHandler\doTransform(), EnhancedChangesList\downArrow(), LegacyTemplate\editThisPage(), WebInstallerPage\endForm(), Installer\envCheckDB(), DumpMessages\execute(), CleanupSpam\execute(), SpecialUnblock\execute(), SpecialExport\execute(), SpecialListGroupRights\execute(), LinkSearchPage\execute(), MoveBatch\execute(), MIMEsearchPage\execute(), SpecialEmailUser\execute(), WebInstaller_DBConnect\execute(), WebInstaller_Name\execute(), SpecialNewpages\form(), FormatMetadata\formatCoords(), FeedUtils\formatDiffRow(), MIMEsearchPage\formatResult(), SpecialProtectedtitles\formatRow(), SpecialProtectedpages\formatRow(), SpecialNewpages\formatRow(), Linker\formatTemplates(), ImageListPager\formatValue(), SpecialSearch\formHeader(), User\getBlockedStatus(), HTMLForm\getButtons(), SpecialProtectedpages\getCascadeCheck(), WebInstaller_Options\getCCDoneBox(), WebInstaller\getCheckBox(), EditPage\getCheckboxes(), OracleInstaller\getConnectForm(), PostgresInstaller\getConnectForm(), Ibm_db2Installer\getConnectForm(), MysqlInstaller\getConnectForm(), DBQueryError\getContentMessage(), SpecialVersion\getCopyrightAndAuthorList(), SpecialVersion\getCreditsForExtension(), UnwatchAction\getDescription(), EditPage\getEditButtons(), EditPage\getEditToolbar(), SpecialProtectedpages\getExpiryCheck(), SpecialVersion\getExtensionCredits(), SpecialVersion\getExtensionTypes(), LogEventsList\getExtraInputs(), SpecialRecentchangeslinked\getExtraOptions(), ImageListPager\getFieldNames(), SpecialWhatLinksHere\getFilterPanel(), NewFilesPager\getForm(), ImageListPager\getForm(), FormatMetadata\getFormattedData(), RevDel_FileItem\getHTML(), CategoryViewer\getImageSection(), WebInstaller\getInfoBox(), Licenses\getInputHTML(), DatabaseInstaller\getInstallUserBox(), Status\getItemXML(), HTMLForm\getLegend(), SpecialProtectedtitles\getLevelMenu(), SpecialProtectedpages\getLevelMenu(), RevisionDeleter\getLogLinks(), SpecialVersion\getMediaWikiCredits(), SpecialProtectedtitles\getNamespaceMenu(), SpecialProtectedpages\getNamespaceMenu(), ProtectionForm\getOptionLabel(), WithoutInterwikiPage\getPageHeader(), UsersPager\getPageHeader(), WebInstaller\getPageListItem(), CategoryViewer\getPagesSection(), RevertFileAction\getPageTitle(), EditPage\getPreviewText(), DatabaseInstaller\getReadableName(), DatabaseSqlite\getServerInfo(), MysqlInstaller\getSettingsForm(), SpecialProtectedpages\getSizeLimit(), TablePager\getStartBody(), CategoryViewer\getSubcategorySection(), HTMLForm\getSubmitText(), ImageHistoryList\getThumbForLine(), LogEventsList\getTitleInput(), LogEventsList\getTitlePattern(), SpecialProtectedpages\getTypeMenu(), LogEventsList\getUserInput(), SpecialVersion\getVersion(), SpecialVersion\getVersionLinked(), DatabaseInstaller\getWebUserBox(), SpecialVersion\getWgHooks(), ImagePage\imageDupes(), FormatMetadata\langItem(), Xml\languageSelector(), ApiParse\languagesHtml(), UploadFromUrlJob\leaveMessage(), Linker\linkAttribs(), SpecialVersion\listAuthors(), LogPage\logName(), SpecialSearch\makeSearchLink(), Linker\makeThumbLink2(), CologneBlueTemplate\menuHead(), Xml\monthSelector(), LegacyTemplate\moveThisPage(), FormatMetadata\msg(), LegacyTemplate\nameAndLogin(), SpecialRecentChanges\namespaceFilterForm(), SpecialPrefixindex\namespacePrefixForm(), SearchEngine\namespacesAsText(), Html\namespaceSelector(), RollbackAction\onView(), ImagePage\openShowImage(), SpecialRecentChanges\optionsPanel(), LegacyTemplate\otherLanguages(), WebInstallerOutput\outputTitle(), LegacyTemplate\pageTitleLinks(), SpecialSearch\powerSearchBox(), LegacyTemplate\printableLink(), LegacyTemplate\protectThisPage(), StandardTemplate\quickBar(), CologneBlueTemplate\quickBar(), EnhancedChangesList\recentChangesBlockGroup(), UploadFromUrlJob\run(), LegacyTemplate\searchForm(), CologneBlueTemplate\searchForm(), User\sendConfirmationMail(), User\setPassword(), SpecialSearch\shortDialog(), EditPage\showConflict(), EditPage\showEditForm(), UserrightsPage\showEditUserGroupsForm(), SpecialFilepath\showForm(), MovePageForm\showForm(), SpecialImport\showForm(), FileDeleteForm\showForm(), SpecialRevisionDelete\showForm(), SpecialMergeHistory\showHistory(), SpecialSearch\showHit(), SpecialSearch\showInterwiki(), SpecialSearch\showInterwikiHit(), SpecialMergeHistory\showMergeForm(), LogEventsList\showOptions(), SpecialProtectedtitles\showOptions(), SpecialProtectedpages\showOptions(), SpecialUpload\showRecoverableUploadError(), SpecialPreferences\showResetForm(), SpecialSearch\showResults(), EditPage\showStandardInputs(), SpecialUploadStash\showUploads(), SpecialUpload\showUploadWarning(), EnhancedChangesList\sideArrow(), SpecialVersion\softwareInformation(), EditPage\spamPageWithContent(), Linker\specialLink(), LegacyTemplate\specialPagesList(), WebInstaller\startPageWrapper(), WebInstaller_Install\startStage(), SpecialEmailUser\submit(), WebInstaller_Name\submit(), WebInstaller_Options\submit(), UserrightsPage\switchForm(), CologneBlueTemplate\sysLinks(), LegacyTemplate\talkLink(), File\transformErrorOutput(), BitmapHandler\transformGd(), MediaWiki_I18N\translate(), SpecialRevisionDelete\tryShowFile(), ImagePage\uploadLinksBox(), ImagePage\view(), LegacyTemplate\watchPageLinksLink(), LegacyTemplate\watchThisPage(), wfStreamThumb(), and SpecialWhatLinksHere\whatlinkshereForm().
wfMsgExt | ( | $ | key, |
$ | options | ||
) |
Returns message in the requested format.
$key | String: key of the message |
$options | Array: processing rules. Can take the following options: parse: parses wikitext to HTML parseinline: parses wikitext to HTML and removes the surrounding p's added by parser or tidy escape: filters message through htmlspecialchars escapenoentities: same, but allows entity references like   through replaceafter: parameters are substituted after parsing or escaping parsemag: transform the message using magic phrases content: fetch message for content language instead of interface Also can accept a single associative argument, of the form 'language' => 'xx': language: Language object or language code to fetch message for (overriden by content). Behavior for conflicting options (e.g., parse+parseinline) is undefined. |
Definition at line 1520 of file GlobalFunctions.php.
References $options, Sanitizer\escapeHtmlAllowEntities(), MessageCache\singleton(), wfGetLangObj(), wfMsgGetKey(), wfMsgReplaceArgs(), and wfWarn().
Referenced by HTMLFormField\__construct(), LogPage\actionText(), LegacyTemplate\bottomLinks(), Xml\buildForm(), ChangeTags\buildTagFilterSelector(), ImportReporter\close(), Language\commaList(), EmailNotification\composeCommonMailtext(), Article\confirmDelete(), Article\delete(), Skin\doEditSectionLink(), MovePageForm\doSubmit(), SpecialTags\doTagRow(), UsercreateTemplate\execute(), SpecialUnblock\execute(), SpecialTags\execute(), SpecialExport\execute(), SpecialMergeHistory\execute(), SpecialEmailUser\execute(), LegacyTemplate\extensionTabLinks(), SpecialNewpages\feed(), Article\fetchContent(), ChangesList\flag(), Linker\formatAutocommentsCallback(), HTMLForm\formatErrors(), Linker\formatHiddenCategories(), SpecialListGroupRights\formatPermissions(), Linker\formatRevisionSize(), UsersPager\formatRow(), Linker\formatTemplates(), SpecialSearch\formHeader(), MessageBlobStore\generateMessageBlob(), EditPage\getCancelLink(), EditPage\getCheckboxes(), Article\getContent(), SpecialUpload\getDupeWarning(), SpecialStatistics\getEditStats(), SpecialUpload\getExistsWarning(), UploadForm\getExtensionsMessage(), SpecialEmailUser\getFormFields(), RevertFileAction\getFormFields(), CategoryViewer\getHTML(), RevDel_FileItem\getHTML(), LogFormatter\getIRCActionText(), PNGHandler\getLongDesc(), GIFHandler\getLongDesc(), SvgHandler\getLongDesc(), CliInstaller\getMessageText(), SpecialStatistics\getMostViewedPages(), AlphabeticPager\getNavigationBar(), ReverseChronologicalPager\getNavigationBar(), SpecialStatistics\getOtherStats(), LonelyPagesPage\getPageHeader(), UnusedtemplatesPage\getPageHeader(), UnusedimagesPage\getPageHeader(), SpecialStatistics\getPageStats(), UploadForm\getSourceSection(), EditPage\getSummaryPreview(), SpecialUpload\getUploadForm(), SpecialStatistics\getUserStats(), SpecialStatistics\getViewsStats(), ApiParse\languagesHtml(), Parser\limitationWarn(), SpecialWhatLinksHere\listItem(), LogPage\logHeader(), SpecialMergeHistory\merge(), EditPage\noSuchSectionPage(), ChangesList\numberofWatchingusers(), SpecialLockdb\onSubmit(), RevertFileAction\onSuccess(), RollbackAction\onView(), ImagePage\openShowImage(), SpecialRecentChanges\optionsPanel(), LegacyTemplate\otherLanguages(), LegacyTemplate\pageSubtitle(), RdfMetaData\person(), Language\pipeList(), SpecialSearch\powerSearchBox(), LogEventsList\preCacheMessages(), SpecialMergeHistory\preCacheMessages(), ChangesList\preCacheMessages(), FileDeleteForm\prepareMessage(), SpecialUpload\processUpload(), SpecialUpload\processVerificationError(), EnhancedChangesList\recentChangesBlockGroup(), OldChangesList\recentChangesLine(), MessageBlobStore\reencodeBlob(), ImportReporter\reportPage(), Language\semicolonList(), Article\setOldSubtitle(), User\setPassword(), ChangesList\showCharacterDifference(), EditPage\showConflict(), EditPage\showDiff(), EditPage\showEditForm(), MovePageForm\showForm(), SpecialImport\showForm(), SpecialRevisionDelete\showForm(), LogEventsList\showHeader(), SpecialMergeHistory\showHistory(), SpecialSearch\showHit(), LogEventsList\showLogExtract(), SpecialPrefixindex\showPrefixChunk(), EditPage\showStandardInputs(), EditPage\showSummaryInput(), SpecialUpload\showUploadWarning(), SpecialUpload\showViewDeletedLinks(), EditPage\spamPageWithContent(), Language\specialList(), SpecialEmailUser\submit(), Linker\tocList(), LegacyTemplate\topLinks(), Language\truncate(), Language\truncateHtml(), PageArchive\undelete(), ImagePage\uploadLinksBox(), HTMLFormField\validate(), HTMLFloatField\validate(), HTMLIntField\validate(), HTMLSelectField\validate(), HTMLMultiSelectField\validate(), HTMLSelectAndOtherField\validate(), HTMLRadioField\validate(), wfShowingResults(), and OutputPage\wrapWikiMsg().
wfMsgForContent | ( | $ | key | ) |
Get a message from anywhere, for the current global language set with $wgLanguageCode.
Use this if the message should NOT change dependent on the language set in the user's preferences. This is the case for most text written into logs, as well as link targets (such as the name of the copyright policy page). Link titles, on the other hand, should be shown in the UI language.
Note that MediaWiki allows users to change the user interface language in their preferences, but a single installation typically only contains content in one language.
Be wary of this distinction: If you use wfMsg() where you should use wfMsgForContent(), a user of the software may have to customize potentially hundreds of messages in order to, e.g., fix a link in every possible language.
$key | String: lookup key for the message, usually defined in languages/Language.php |
Definition at line 1363 of file GlobalFunctions.php.
References $wgForceUIMsgAsContentMsg, and wfMsgReal().
Referenced by Licenses\__construct(), User\addNewUserLogEntry(), Parser\braceSubstitution(), ProtectionForm\buildForm(), CleanupSpam\cleanupArticle(), WikiPage\commitRollback(), EmailNotification\composeCommonMailtext(), Article\confirmDelete(), Installer\createMainpage(), CoreParserFunctions\defaultsort(), Article\delete(), Block\doAutoblock(), FileDeleteForm\doDelete(), WikiPage\doUpdateRestrictions(), ApiEditPage\execute(), FileDeleteForm\execute(), ApiFeedContributions\execute(), ApiFeedWatchlist\execute(), WebInstaller_Name\execute(), HistoryAction\feed(), HistoryAction\feedEmpty(), HistoryAction\feedItem(), ApiFeedContributions\feedItemDesc(), SpecialNewpages\feedItemDesc(), Parser\fetchScaryTemplateMaybeFromCache(), WikiPage\getAutoDeleteReason(), WikiPage\getAutosummary(), EditPage\getContent(), EditPage\getCopywarn(), FeedUtils\getDiffLink(), SpecialRecentchangeslinked\getFeedObject(), SpecialRecentChanges\getFeedObject(), RevertFileAction\getFormFields(), SpecialUpload\getInitialPageText(), LogFormatter\getIRCActionText(), EditPage\getPreviewText(), LogPage\getRcComment(), EditPage\getSummaryPreview(), DoubleRedirectJob\getUser(), EditPage\internalAttemptSave(), Parser\interwikiTransclude(), User\isUsableName(), HTMLSelectAndOtherField\loadDataFromRequest(), LogEventsList\logActionLinks(), Parser\magicLinkCallback(), UserrightsPage\makeGroupNameList(), Skin\makeI18nUrl(), Parser\maybeMakeExternalImage(), SpecialMergeHistory\merge(), Title\moveTo(), Title\moveToInternal(), LegacyTemplate\nameAndLogin(), Title\newMainPage(), CologneBlueTemplate\quickBar(), LanguageConverter\recursiveConvertRule(), Parser\replaceInternalLinks2(), SearchEngine\replacePrefixes(), WikiPage\replaceSection(), ImportReporter\reportPage(), DoubleRedirectJob\run(), ProtectionForm\save(), EmailNotification\sendImpersonal(), FileDeleteForm\showForm(), SpecialRevisionDelete\showForm(), SpecialSearch\showHit(), EditPage\showStandardInputs(), CoreParserFunctions\special(), SpecialSearch\startsWithAll(), SpecialRevisionDelete\submit(), CologneBlueTemplate\sysLinks(), CoreParserFunctions\tagObj(), ExtraParserTest\testTrackingCategory(), PageArchive\undelete(), and MediaHandler\visibleMetadataFields().
wfMsgForContentNoTrans | ( | $ | key | ) |
Same as above except doesn't transform the message.
$key | String |
Definition at line 1382 of file GlobalFunctions.php.
References $wgForceUIMsgAsContentMsg, and wfMsgReal().
Referenced by Skin\addToSidebar(), Block\isWhitelistedFromAutoblocks(), SpecialRecentChanges\setTopText(), and wfIsBadImage().
wfMsgGetKey | ( | $ | key, |
$ | useDB = true , |
||
$ | langCode = false , |
||
$ | transform = true |
||
) |
Fetch a message string value, but don't replace any keys yet.
$key | String |
$useDB | Bool |
$langCode | String: Code of the language to get the message for, or behaves as a content language switch if it is a boolean. |
$transform | Boolean: whether to parse magic words, etc. |
Definition at line 1423 of file GlobalFunctions.php.
References MessageCache\singleton(), and wfRunHooks().
Referenced by MakeLanguageSpec\getMessagesAndTests(), wfMsgExt(), wfMsgHtml(), wfMsgReal(), and wfMsgWikiHtml().
wfMsgHtml | ( | $ | key | ) |
Return an HTML-escaped version of a message.
Parameter replacements, if any, are done *after* the HTML-escaping, so parameters may contain HTML (eg links or form controls). Be sure to pre-escape them if you really do want plaintext, or just wrap the whole thing in htmlspecialchars().
$key | String |
string | ... parameters |
Definition at line 1475 of file GlobalFunctions.php.
References wfMsgGetKey(), and wfMsgReplaceArgs().
Referenced by RevertFileAction\alterForm(), ImageHistoryList\beginImageHistoryList(), Linker\blockLink(), SpecialRevisionDelete\buildCheckBoxes(), ProtectionForm\buildForm(), Linker\buildRollbackLink(), SpecialEditWatchlist\buildTools(), CategoryViewer\columnList(), Article\confirmDelete(), Article\delete(), MovePageForm\doSubmit(), SpecialTags\doTagRow(), WebInstaller\downloadLinkHook(), Linker\emailLink(), LegacyTemplate\emailUserLink(), WebInstaller_Install\endStage(), SpecialJavaScriptTest\execute(), SpecialProtectedpages\execute(), SpecialProtectedtitles\execute(), SpecialListGroupRights\execute(), WebInstaller_Welcome\execute(), SpecialNewpages\filterLinks(), FeedUtils\formatDiff(), Block\formatExpiry(), UnusedtemplatesPage\formatResult(), UnwatchedpagesPage\formatResult(), FewestrevisionsPage\formatResult(), ShortPagesPage\formatResult(), MIMEsearchPage\formatResult(), LinkSearchPage\formatResult(), SpecialProtectedtitles\formatRow(), SpecialProtectedpages\formatRow(), SpecialNewpages\formatRow(), ChangesFeed\generateFeed(), RevDel_FileItem\getComment(), CreditsAction\getDescription(), WatchAction\getDescription(), Action\getDescription(), RevDel_RevisionItem\getDiffLink(), RevisionItem\getDiffLink(), RevDel_ArchiveItem\getDiffLink(), TablePager\getEmptyBody(), SpecialUpload\getExistsWarning(), SpecialRecentchangeslinked\getExtraOptions(), WebInstallerPage\getFieldsetStart(), LogEventsList\getFilterLinks(), SpecialWhatLinksHere\getFilterPanel(), SpecialJavaScriptTest\getFrameworkListHtml(), SpecialStatistics\getGroupStats(), WebInstaller\getHelpBox(), RevDel_LogItem\getHTML(), EditPage\getLastDelete(), TablePager\getLimitDropdown(), WikiXmlError\getMessage(), AlphabeticPager\getNavigationBar(), ReverseChronologicalPager\getNavigationBar(), TablePager\getNavigationBar(), SpecialWhatLinksHere\getPrevNext(), UploadForm\getSourceSection(), ImageHistoryList\getThumbForLine(), LegacyTemplate\getUploadLink(), SpecialStatistics\getUserStats(), RevDel_FileItem\getUserTools(), LegacyTemplate\historyLink(), ImageHistoryList\imageHistoryLine(), ChangesList\insertComment(), ChangesList\insertUserRelatedLinks(), WebInstaller\label(), ImagePage\openShowImage(), SpecialRecentChanges\optionsPanel(), LegacyTemplate\pageTitleLinks(), LegacyTemplate\printableLink(), SpecialUpload\processVerificationError(), EnhancedChangesList\recentChangesBlockGroup(), EnhancedChangesList\recentChangesLine(), ImportReporter\reportPage(), Linker\revComment(), Linker\revDeleteLink(), Linker\revDeleteLinkDisabled(), Linker\revUserLink(), Linker\revUserTools(), Article\setOldSubtitle(), SpecialRevisionDelete\showConvenienceLinks(), MovePageForm\showForm(), FileDeleteForm\showForm(), SpecialRevisionDelete\showForm(), SpecialMergeHistory\showHistory(), Article\showPatrolFooter(), SpecialPrefixindex\showPrefixChunk(), SpecialUpload\showRecoverableUploadError(), ImagePage\showTOC(), SpecialUpload\showUploadError(), SpecialUpload\showUploadWarning(), WebInstaller_Install\startStage(), ImageGallery\toHTML(), NostalgiaTemplate\topLinks(), ImagePage\uploadLinksBox(), LegacyTemplate\userContribsLink(), Linker\userTalkLink(), Linker\userToolLinks(), Article\viewRedirect(), LegacyTemplate\watchPageLinksLink(), wfStreamThumb(), and LegacyTemplate\whatLinksHere().
wfMsgNoTrans | ( | $ | key | ) |
Same as above except doesn't transform the message.
$key | String |
Definition at line 1334 of file GlobalFunctions.php.
References wfMsgReal().
Referenced by ImageHistoryList\beginImageHistoryList(), Article\doDelete(), WebInstaller_ExistingWiki\execute(), WebInstaller_Welcome\execute(), WebInstaller_DBConnect\execute(), WebInstaller_Upgrade\execute(), WebInstaller_Options\execute(), WebInstaller_Install\execute(), WebInstaller_Complete\execute(), WebInstaller_Restart\execute(), Article\fetchContent(), EditPage\getContent(), RandomPage\getNsList(), WebInstaller\getRadioSet(), DatabaseInstaller\getWebUserBox(), Status\getWikiText(), Status\getWikiTextForError(), ImagePage\makeMetadataTable(), MWException\msg(), ImagePage\openShowImage(), WebInstallerOutput\outputFooter(), ImagePage\printSharedImageText(), ChangesList\showCharacterDifference(), WebInstaller_Upgrade\showDoneMessage(), EditPage\showHeader(), WebInstaller_ExistingWiki\showKeyForm(), and Article\showMissingArticle().
Really get a message.
$key | String: key to get. |
$args | |
$useDB | Boolean |
$forContent | Mixed: Language code, or false for user lang, true for content lang. |
$transform | Boolean: Whether or not to transform the message. |
Definition at line 1405 of file GlobalFunctions.php.
References wfMsgGetKey(), wfMsgReplaceArgs(), wfProfileIn(), and wfProfileOut().
Referenced by WikiErrorMsg\__construct(), WebInstaller\getHelpBox(), WebInstaller\showError(), WebInstaller\showMessage(), wfMsg(), wfMsgForContent(), wfMsgForContentNoTrans(), and wfMsgNoTrans().
wfMsgReplaceArgs | ( | $ | message, |
$ | args | ||
) |
Replace message parameter keys on the given formatted output.
$message | String |
$args | Array |
Definition at line 1444 of file GlobalFunctions.php.
References $n.
Referenced by WikiPage\commitRollback(), Block\formatExpiry(), MWException\msg(), DBConnectionError\msg(), ApiBase\parseMsg(), ApiMain\reallyMakeHelpMsg(), wfMsgExt(), wfMsgHtml(), wfMsgReal(), and wfMsgWikiHtml().
wfMsgWikiHtml | ( | $ | key | ) |
Return an HTML version of message Parameter replacements, if any, are done *after* parsing the wiki-text message, so parameters may contain HTML (eg links or form controls).
Be sure to pre-escape them if you really do want plaintext, or just wrap the whole thing in htmlspecialchars().
$key | String |
string | ... parameters |
Definition at line 1492 of file GlobalFunctions.php.
References MessageCache\singleton(), wfMsgGetKey(), and wfMsgReplaceArgs().
wfNegotiateType | ( | $ | cprefs, |
$ | sprefs | ||
) |
Returns the 'best' match between a client's requested internet media types and the server's list of available types.
Each list should be an associative array of type to preference (preference is a float between 0.0 and 1.0). Wildcards in the types are acceptable.
$cprefs | Array: client's acceptable type list |
$sprefs | Array: server's offered types |
Definition at line 2161 of file GlobalFunctions.php.
References mimeTypeMatch().
Referenced by RdfMetaData\setup(), and GlobalTest\testNegotiateType().
wfObjectToArray | ( | $ | objOrArray, |
$ | recursive = true |
||
) |
Recursively converts the parameter (an object) to an array with the same data.
$objOrArray | Object|Array |
$recursive | Bool |
Definition at line 226 of file GlobalFunctions.php.
wfOut | ( | $ | s | ) |
Used to be used for outputting text in the installer/updater.
Definition at line 3658 of file GlobalFunctions.php.
References $wgCommandLineMode, echo, and wfDeprecated().
wfParseUrl | ( | $ | url | ) |
parse_url() work-alike, but non-broken.
Differences:
1) Does not raise warnings on bad URLs (just returns false) 2) Handles protocols that don't use :// (e.g., mailto: and news: , as well as protocol-relative URLs) correctly 3) Adds a "delimiter" element to the array, either '://', ':' or '//' (see (2))
$url | String: a URL to parse |
Definition at line 716 of file GlobalFunctions.php.
References $url, $wgUrlProtocols, wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by MWHttpRequest\__construct(), WikiReference\getDisplayName(), Parser\getVariableValue(), UserMailer\makeMsgId(), wfAssembleUrl\provideURLParts(), SpecialSearch\showInterwikiHit(), wfExpandUrl(), wfExtractThumbParams(), wfMakeUrlIndexes(), wfMatchesDomainList(), and wfThumbHandle404().
wfPercent | ( | $ | nr, |
$ | acc = 2 , |
||
$ | round = true |
||
) |
$nr | Mixed: the number to format |
$acc | Integer: the number of digits after the decimal point, default 2 |
$round | Boolean: whether or not to round the value, default true |
Definition at line 2624 of file GlobalFunctions.php.
Referenced by DeleteImageCache\execute(), TestRecorder\reportPercentage(), and GlobalTest\testWfPercentTest().
Should low-performance queries be disabled?
Definition at line 3558 of file GlobalFunctions.php.
References $wgMiserMode, SiteStats\edits(), SiteStats\pages(), and SiteStats\users().
wfRandom | ( | ) |
Get a random decimal value between 0 and 1, in a way not likely to give duplicate values for any realistic number of articles.
Definition at line 267 of file GlobalFunctions.php.
Referenced by RandomPage\getRandomTitle(), WikiPage\insertOn(), ApiQueryRandom\run(), and GlobalTest\testRandom().
wfReadOnly | ( | ) |
Check if the wiki read-only lock file is present.
This can be used to lock off editing functions, but doesn't guarantee that the database will not be modified.
Definition at line 1186 of file GlobalFunctions.php.
References $wgReadOnly, and $wgReadOnlyFile.
Referenced by ProtectionForm\__construct(), LoginForm\addNewAccountInternal(), ApiQuerySiteinfo\appendGeneralInfo(), Action\checkCanExecute(), ApiMain\checkExecutePermissions(), SpecialPage\checkReadOnly(), User\clearNotification(), WikiPage\commitRollback(), Block\delete(), Article\delete(), WikiPage\doCascadeProtectionUpdates(), MediaWiki\doJobs(), WikiPage\doUpdateRestrictions(), WikiPage\doViewUpdates(), EditPage\edit(), FileDeleteForm\execute(), BackupReader\execute(), EmailInvalidation\execute(), LocalFile\getSha1(), ResourceLoaderFileModule\getStyles(), EditPage\internalAttemptSave(), User\invalidateCache(), Title\invalidateCache(), Profiler\logData(), LoginForm\mainLoginForm(), LocalFile\maybeUpgradeRow(), Category\refreshCounts(), User\saveSettings(), User\setNewtalk(), EditPage\showHeader(), GlobalTest\testReadOnlyEmpty(), GlobalTest\testReadOnlySet(), SpecialUndelete\undelete(), PageArchive\undeleteRevisions(), LocalFile\upgradeRow(), and wfReadOnlyReason().
wfReadOnlyReason | ( | ) |
Definition at line 1207 of file GlobalFunctions.php.
References $wgReadOnly, and wfReadOnly().
Referenced by ProtectionForm\__construct(), ReadOnlyError\__construct(), ApiQuerySiteinfo\appendGeneralInfo(), ApiBase\dieReadOnly(), WikiPage\doUpdateRestrictions(), and EditPage\showHeader().
wfRecursiveRemoveDir | ( | $ | dir | ) |
Remove a directory and all its content.
Does not hide error.
Definition at line 2599 of file GlobalFunctions.php.
References $dir, and wfDebug().
Referenced by ExifRotationTest\tearDownFiles(), and teardownTestResources().
wfRelativePath | ( | $ | path, |
$ | from | ||
) |
Generate a relative path name to the given file.
May explode on non-matching case-insensitive paths, funky symlinks, etc.
$path | String: absolute destination path including target filename |
$from | String: Absolute source path, directory only |
Definition at line 3133 of file GlobalFunctions.php.
References $path, and wfBaseName().
Referenced by UploadDumper\outputItem().
wfRemoveDotSegments | ( | $ | urlPath | ) |
Remove all dot-segments in the provided URL path.
For example, '/a/./b/../c/' becomes '/a/c/'. For details on the algorithm, please see RFC3986 section 5.2.4.
$urlPath | String URL path, potentially containing dot-segments |
Definition at line 579 of file GlobalFunctions.php.
References $output.
Referenced by wfRemoveDotSegments\testWfRemoveDotSegments(), and wfExpandUrl().
wfReportTime | ( | ) |
Returns a HTML comment with the elapsed time since request.
This method has no side effects.
Definition at line 1647 of file GlobalFunctions.php.
References $wgRequestTime, $wgShowHostnames, and wfHostname().
Referenced by ApiMain\executeActionWithErrorHandling(), and SkinTemplate\outputPage().
wfResetOutputBuffers | ( | $ | resetGzipEncoding = true | ) |
Clear away any user-level output buffers, discarding contents.
Suitable for 'starting afresh', for instance when streaming relatively large amounts of data without buffering, or wanting to output image files without ob_gzhandler's compression.
The optional $resetGzipEncoding parameter controls suppression of the Content-Encoding header sent by ob_gzhandler; by default it is left. See comments for wfClearOutputBuffers() for why it would be used.
Note that some PHP configuration options may add output buffer layers which cannot be removed; these are left in place.
$resetGzipEncoding | Bool |
Definition at line 2035 of file GlobalFunctions.php.
References $wgDisableOutputCompression.
Referenced by SpecialExport\execute(), StreamFile\prepareForStream(), and wfClearOutputBuffers().
Restore error level to previous value.
Definition at line 2231 of file GlobalFunctions.php.
References wfSuppressWarnings().
Referenced by SVGReader\__construct(), TempFSFile\__destruct(), DatabaseOracle\__destruct(), MWMemcached\_connect_sock(), CheckSyntax\buildFileList(), Exif\charCodeString(), DatabaseInstaller\checkExtension(), OutputPage\checkLastModified(), UploadBase\checkXMLEncodingMissmatch(), FSFileBackend\chmod(), FileRepo\cleanupBatch(), FileCacheBase\clearCache(), SquidPurgeClient\close(), FSLockManager\closeLockHandles(), TextPassDumper\closeSpawn(), ZhClient\connect(), MediaHandler\convertMetadataVersion(), IPTC\convIPTCHelper(), SqliteInstaller\dataDirOKmaybeCreate(), DiffHistoryBlob\diff(), Installer\dirIsExecutable(), Installer\disableTimeLimit(), FSFileBackend\doCleanInternal(), FileBackendStore\doConcatenate(), SpecialExport\doExport(), MimeMagic\doGuessMimeType(), SquidPurgeClient\doReads(), FSLockManager\doSingleLock(), SquidPurgeClient\doWrites(), Installer\envCheckPCRE(), CheckImages\execute(), JSParseHelper\execute(), RebuildFileCache\execute(), ModernTemplate\execute(), MonoBookTemplate\execute(), CommandLineInstaller\execute(), CurlHttpRequest\execute(), PhpHttpRequest\execute(), TempFSFile\factory(), DatabaseMysql\fetchObject(), DatabasePostgres\fetchObject(), DatabaseIbm_db2\fetchObject(), DatabaseMysql\fetchRow(), DatabasePostgres\fetchRow(), DatabaseIbm_db2\fetchRow(), DatabaseMysql\freeResult(), DatabasePostgres\freeResult(), DatabaseIbm_db2\freeResult(), LSLockManager\getConnection(), WebInstallerOutput\getCSS(), Installer\getExistingLocalSettings(), FileBackendStore\getFileContents(), ImageHandler\getImageSize(), DjVuImage\getInfo(), SquidPurgeClient\getIP(), PNGHandler\getLongDesc(), GIFHandler\getLongDesc(), PNGMetadataExtractor\getMetadata(), GIFMetadataExtractor\getMetadata(), DjVuHandler\getMetaTree(), DatabaseLogEntry\getParameters(), IcuCollation\getPrimarySortKey(), ExifBitmapHandler\getRotationForExif(), SeleniumConfig\getSeleniumSettings(), FSFile\getSha1Base36(), SquidPurgeClient\getSocket(), IcuCollation\getSortKey(), StoreFileOp\getSourceSha1Base36(), SpecialVersion\getSvnInfo(), TextPassDumper\getTextSpawned(), ForeignAPIRepo\getThumbUrlFromCache(), FSFile\getTimestamp(), MediaWikiTestCase\hideDeprecated(), Language\iconv(), MWCryptRand\initialRandomState(), DatabaseOracle\insertOneRow(), ExifBitmapHandler\isMetadataValid(), PNGHandler\isMetadataValid(), GIFHandler\isMetadataValid(), Sqlite\isPresent(), DatabaseMysql\lastError(), MessageCache\loadFromLocal(), Installer\locateExecutable(), ImportStreamSource\newFromFile(), DatabaseMysql\numRows(), DatabasePostgres\numRows(), SpecialUnlockdb\onSubmit(), SpecialLockdb\onSubmit(), DatabaseMysql\open(), DatabaseMssql\open(), DatabaseOracle\open(), DatabaseIbm_db2\openCataloged(), DatabaseIbm_db2\openUncataloged(), XMPReader\parse(), DiffHistoryBlob\patch(), User\pingLimiter(), DatabaseInstaller\populateInterwikiTable(), Preprocessor_DOM\preprocessToObj(), FSLockManager\pruneKeyLockFiles(), FileRepo\publishBatch(), TempFSFile\purge(), MWCryptRand\realGenerate(), Sanitizer\removeHTMLtags(), SquidPurgeClientPool\run(), MessageCache\saveToLocal(), MessageCache\saveToScript(), JpegMetadataExtractor\segmentSplitter(), DatabaseOracle\selectDB(), UserMailer\send(), DatabaseBase\sourceFile(), PrefixSearch\specialSearch(), SeleniumServerManager\startServerOnUnix(), RecompressTracked\startSlaveProcs(), FileRepo\storeBatch(), StreamFile\stream(), JavaScriptMinifierTest\testJavaScriptMinifierOutput(), MediaWiki_I18N\translate(), SvgHandler\unpackMetadata(), SqlBagOStuff\unserialize(), DatabaseOracle\update(), Language\userAdjust(), wfDiff(), wfDl(), wfErrorLog(), wfIncrStats(), wfMemoryLimit(), wfMerge(), wfMkdirParents(), wfParseUrl(), wfSetupSession(), wfStreamThumb(), and wfUnpack().
wfRunHooks | ( | $ | event, |
$ | args = array() |
||
) |
Call hook functions defined in $wgHooks.
$event | String: event name |
$args | Array: parameters passed to hook functions |
Definition at line 3858 of file GlobalFunctions.php.
References Hooks\run().
Referenced by ExtensionsTestSuite\__construct(), LinksUpdate\__construct(), DatabaseUpdater\__construct(), DatabaseOracle\__construct(), ResourceLoader\__construct(), UploadForm\__construct(), OutputPage\addCategoryLinks(), OutputPage\addDefaultModules(), User\addGroup(), LoginForm\addNewAccount(), LoginForm\addNewAccountInternal(), LoginForm\addNewAccountMailPassword(), OutputPage\addParserOutput(), OutputPage\addParserOutputNoText(), Skin\afterContentHook(), ApiQuerySiteinfo\appendGeneralInfo(), LoginForm\attemptAutoCreate(), SpecialChangePassword\attemptReset(), EditPage\attemptSave(), LoginForm\authenticateUserData(), BenchmarkHooks\benchHooks(), Skin\bottomScripts(), SkinTemplate\buildContentNavigationUrls(), ProtectionForm\buildForm(), SkinTemplate\buildNavUrls(), SkinTemplate\buildPersonalUrls(), SpecialEditWatchlist\buildRemoveLine(), Skin\buildSidebar(), User\canSendEmail(), Autopromote\checkCondition(), OutputPage\checkLastModified(), Title\checkPermissionHooks(), Title\checkReadPermissions(), User\clearNotification(), Parser\clearState(), WikiPage\commitRollback(), User\comparePasswords(), Article\confirmDelete(), User\confirmEmail(), UploadBase\createFromRequest(), User\crypt(), Block\doAutoblock(), FileDeleteForm\doDelete(), WikiPage\doDeleteArticleReal(), WikiPage\doEdit(), Skin\doEditSectionLink(), WikiPage\doEditUpdates(), WikiImporter\doImport(), Language\doMagicHook(), SpecialRecentchangeslinked\doMainQuery(), SpecialRecentChanges\doMainQuery(), RecentChange\doMarkPatrolled(), RevDel_RevisionList\doPostCommitUpdates(), WikiPage\doPurge(), WikiPage\doQuickEdit(), RefreshLinks\doRefreshLinks(), Block\doRetroactiveAutoblock(), UserrightsPage\doSaveUserGroups(), MovePageForm\doSubmit(), BitmapHandler\doTransform(), WatchAction\doUnwatch(), SearchUpdate\doUpdate(), LinksUpdate\doUpdate(), WikiPage\doUpdateRestrictions(), LinkHolderArray\doVariants(), WatchAction\doWatch(), WikiExporter\dumpFrom(), EditPage\edit(), SpecialUserlogout\execute(), ApiUndelete\execute(), SpecialWatchlist\execute(), SpecialContributions\execute(), ApiLogout\execute(), SpecialStatistics\execute(), ApiEditPage\execute(), ApiLogin\execute(), SpecialEmailUser\execute(), SpecialUpload\execute(), SeleniumTester\execute(), ApiQuery\execute(), ApiMain\executeAction(), ApiQuery\executeGeneratorModule(), LegacyTemplate\extensionTabLinks(), ApiQueryInfo\extractPageInfo(), Collation\factory(), Article\fetchContent(), WikiImporter\finishImportPage(), Parser_LinkHooks\firstCallInit(), Parser\firstCallInit(), Parser\formatHeadings(), UsersPager\formatRow(), ContribsPager\formatRow(), User\getAllRights(), Autopromote\getAutopromoteGroups(), User\getBlockedStatus(), OutputPage\getCacheVaryCookies(), MWNamespace\getCanonicalNamespaces(), Title\getCanonicalURL(), Title\getCategorySortkey(), EditPage\getCheckboxes(), BacklinkCache\getConditions(), ResourceLoaderStartUpModule\getConfig(), Skin\getCopyright(), EditPage\getCopywarn(), SpecialRecentChanges\getCustomFilters(), User\getDefaultOptions(), UsersPager\getDefaultQuery(), DifferenceEngine\getDiffBody(), EditPage\getEditButtons(), EditPage\getEditToolbar(), User\getEffectiveGroups(), User\getEmail(), User\getEmailAuthenticationTimestamp(), SpecialVersion\getExtensionCredits(), SpecialVersion\getExtensionTypes(), SpecialRecentChanges\getExtraOptions(), ApiBase\getFinalDescription(), ApiBase\getFinalParamDescription(), ApiBase\getFinalParams(), FormAction\getForm(), FormSpecialPage\getForm(), Title\getFullURL(), LocalFile\getHistory(), User\getImplicitGroups(), Title\getInternalURL(), RecentChange\getIRCLine(), XMPInfo\getItems(), OutputPage\getJSVars(), RequestContext\getLanguage(), PreferencesForm\getLegend(), SpecialPageFactory\getList(), Title\getLocalURL(), Language\getMessagesFileName(), MediaHandler\getMetadataVersion(), MessageCache\getMsgFromNamespace(), Language\getNamespaces(), SearchEngine\getNearMatch(), SearchEngine\getNearMatchInternal(), User\getNewMessageLinks(), UsersPager\getPageHeader(), Title\getPageLanguage(), User\getPageRenderingHash(), ParserTest\getParser(), NewParserTest\getParser(), User\getPasswordValidity(), WebRequest\getPathInfo(), SpecialEmailUser\getPermissionsError(), Skin\getPoweredBy(), Preferences\getPreferences(), BacklinkCache\getPrefix(), EditPage\getPreviewText(), SpecialSearch\getProfileForm(), WantedPagesPage\getQueryInfo(), UsersPager\getQueryInfo(), HistoryPager\getQueryInfo(), NewPagesPager\getQueryInfo(), ContribsPager\getQueryInfo(), RandomPage\getRandomTitle(), Title\getRestrictionTypes(), XMPReader\getResults(), User\getRights(), ApiRsd\getRsdApiList(), ResourceLoaderStartUpModule\getScript(), SpecialSearch\getSearchProfiles(), BaseTemplate\getSidebar(), Skin\getSiteNotice(), RequestContext\getSkin(), UploadForm\getSourceSection(), Language\getSpecialPageAliases(), DeletedContributionsPage\getSubTitle(), ApiQueryUsers\getTokenFunctions(), ApiQueryRevisions\getTokenFunctions(), ApiQueryRecentChanges\getTokenFunctions(), ApiQueryInfo\getTokenFunctions(), BaseTemplate\getToolbox(), SpecialContributions\getUserLinks(), MagicWord\getVariableIDs(), Parser\getVariableValue(), SpecialSearch\goResult(), WikiImporter\handleLogItem(), WikiImporter\handlePage(), WikiImporter\handleRevision(), WikiImporter\handleUpload(), OutputPage\headElement(), HistoryPager\historyLine(), ImageHistoryList\imageHistoryLine(), EditPage\importFormData(), MediaWiki\initializeArticle(), ChangesList\insertArticleLink(), Revision\insertOn(), EditPage\internalAttemptSave(), Parser\internalParse(), User\invalidateEmail(), User\isBlockedFrom(), User\isBlockedGlobally(), Title\isCssOrJsPage(), User\isEmailConfirmed(), Article\isFileCacheable(), Title\isMovable(), User\isUsableName(), Title\isValidMoveOperation(), Title\isWikitextPage(), Linker\link(), ChangeTags\listDefinedTags(), ParserTest\listTables(), Interwiki\load(), User\load(), User\loadDefaults(), ImagePage\loadFile(), User\loadFromDatabase(), User\loadFromSession(), User\loadOptions(), DifferenceEngine\loadRevisionIds(), LogEventsList\logActionLinks(), User\logout(), LoginForm\mailPasswordInternal(), LoginForm\mainLoginForm(), Linker\makeExternalImage(), Linker\makeExternalLink(), Parser\makeImage(), Linker\makeImageLink2(), SpecialMergeHistory\merge(), Title\moveTo(), Title\moveToInternal(), ChangesList\newFromContext(), UserArray\newFromResult(), TitleArray\newFromResult(), Article\newFromTitle(), BitmapHandler\normaliseParams(), EditPage\noSuchSectionPage(), SpecialPasswordReset\onSubmit(), RawAction\onView(), HistoryAction\onView(), XmlDumpWriter\openPage(), ImagePage\openShowImage(), ParserOptions\optionsHash(), OutputPage\output(), SkinTemplate\outputPage(), WikiPage\pageData(), Parser\parse(), MediaWiki\performAction(), MediaWiki\performRequest(), UploadBase\performUpload(), User\pingLimiter(), SpecialSearch\powerSearchBox(), WikiPage\prepareTextForEdit(), SpecialBlock\preText(), SpecialBlock\processForm(), SpecialUpload\processUpload(), LocalFile\purgeOldThumbnails(), LocalFile\purgeThumbnails(), LocalisationCache\recache(), OldChangesList\recentChangesLine(), LocalFile\recordUpload2(), ResourceLoader\registerTestModules(), User\removeGroup(), Parser\renderImageGallery(), DifferenceEngine\renderNewRevision(), VectorTemplate\renderPortal(), MessageCache\replace(), LinkHolderArray\replaceInternal(), SearchEngine\replacePrefixes(), WikiPage\replaceSection(), ImportReporter\reportPage(), RecentChange\save(), ProtectionForm\save(), User\saveOptions(), User\saveSettings(), SearchEngine\searchableNamespaces(), PrefixSearch\searchBackend(), UserMailer\send(), User\setCookies(), User\setEmail(), User\setEmailAuthenticationTimestamp(), Article\setOldSubtitle(), SpecialNewpages\setup(), EditAction\show(), EditPage\showConflict(), SpecialSearch\showCreateLink(), Article\showCssOrJsPage(), EditPage\showDiff(), DifferenceEngine\showDiffPage(), EditPage\showEditForm(), SpecialUndelete\showHistory(), SpecialSearch\showHit(), SpecialBlockList\showList(), SpecialBookSources\showList(), ProtectionForm\showLogExtract(), LogEventsList\showLogExtract(), Article\showMissingArticle(), EditPage\showPreview(), Article\showRedirectedFromHeader(), SpecialSearch\showResults(), SpecialUndelete\showRevision(), ImagePage\showTOC(), EditPage\showTosSummary(), Article\showViewFooter(), SpecialVersion\softwareInformation(), Parser\statelessFetchTemplate(), SpecialEmailUser\submit(), Skin\subPageSubtitle(), LoginForm\successfulCreation(), LoginForm\successfulLogin(), SkinTemplate\tabAction(), HooksTest\testOldStyleHooks(), ImageGallery\toHTML(), MonoBookTemplate\toolbox(), Preferences\trySetUserEmail(), SpecialUndelete\undelete(), PageArchive\undeleteRevisions(), SpecialEditWatchlist\unwatchTitles(), Linker\userToolLinks(), UploadBase\verifyFile(), UploadBase\verifyUpload(), CategoryPage\view(), ImagePage\view(), Article\view(), wfDebug(), wfDebugLog(), wfExtractThumbParams(), wfIsBadImage(), wfIsTrustedProxy(), wfMsgGetKey(), wfShellMaintenanceCmd(), and XmlDumpWriter\writeRevision().
wfScript | ( | $ | script = 'index' | ) |
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScriptExtension etc.
$script | String: script filename, sans extension |
Definition at line 3573 of file GlobalFunctions.php.
References $wgScriptExtension, and $wgScriptPath.
Referenced by ResourceLoader\__construct(), SpecialPage\addFeedLinks(), SpecialContributions\execute(), OutputPage\getHeadLinks(), SearchEngine\getMWSuggestTemplate(), SearchEngine\getOpenSearchTemplate(), ApiRsd\getRsdApiList(), ApiFormatBase\initPrinter(), and ApiTestCase\setUp().
wfSetBit | ( | &$ | dest, |
$ | bit, | ||
$ | state = true |
||
) |
As for wfSetVar except setting a bit.
$dest | Int |
$bit | Int |
$state | Bool |
Definition at line 1965 of file GlobalFunctions.php.
Referenced by DatabaseBase\bufferResults(), DatabaseBase\debug(), and DatabaseBase\ignoreErrors().
wfSetupSession | ( | $ | sessionId = false | ) |
Initialise php session.
$sessionId | Bool |
Definition at line 3339 of file GlobalFunctions.php.
References $IP, $wgCookieDomain, $wgCookieHttpOnly, $wgCookiePath, $wgCookieSecure, $wgSessionHandler, $wgSessionsInMemcached, wfDebugLog(), wfFixSessionID(), wfHttpOnlySafe(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by UploadFromUrlTest\doApiRequest(), ApiLogin\execute(), LoginForm\execute(), UploadFromUrlJob\leaveMessage(), UploadFromUrlJob\run(), UploadFromUrlTest\setUp(), ApiTestCaseUpload\setUp(), and SubmitAction\show().
Sets dest to source and returns the original value of dest If source is NULL, it just returns the value, it doesn't set the variable If force is true, it will set the value even if source is NULL.
$dest | Mixed |
$source | Mixed |
$force | Bool |
Definition at line 1948 of file GlobalFunctions.php.
Referenced by OutputPage\enableClientCache(), ParserOptions\enableLimitReport(), DatabaseBase\errorCount(), SpecialPage\file(), LinkCache\forUpdate(), Block\fromMaster(), SpecialPage\func(), SpecialPage\includable(), SpecialPage\including(), Block\isAutoblocking(), Block\isHardblock(), SpecialPage\listed(), SpecialPage\name(), Parser\Options(), Parser\OutputType(), LoadBalancer\parentInfo(), OutputPage\parserOptions(), ParserOutput\preventClickjacking(), Block\prevents(), SpecialPage\restriction(), ParserOptions\setAllowExternalImages(), ParserOptions\setAllowExternalImagesFrom(), ParserOptions\setAllowSpecialInclusion(), CacheTime\setCacheTime(), ParserOutput\setCategoryLinks(), ParserOptions\setCleanSignatures(), CacheTime\setContainsOldMagic(), ParserOptions\setDateFormat(), ParserOptions\setEditSection(), ParserOutput\setEditSectionTokens(), ParserOptions\setEnableImageWhitelist(), ParserOptions\setExternalLinkTarget(), OutputPage\setFileVersion(), ParserOutput\setIndexPolicy(), ParserOptions\setInterfaceMessage(), ParserOptions\setInterwikiMagic(), ParserOptions\setIsPreview(), ParserOptions\setIsPrintable(), ParserOptions\setIsSectionPreview(), ParserOutput\setLanguageLinks(), SpecialPage\setListed(), ParserOptions\setMath(), ParserOptions\setMaxIncludeSize(), ParserOptions\setMaxPPNodeCount(), ParserOptions\setMaxTemplateDepth(), WikiImporter\setNoticeCallback(), ParserOptions\setNumberHeadings(), ParserOptions\setPreSaveTransform(), ParserOptions\setRemoveComments(), OutputPage\setRevisionId(), OutputPage\setRevisionTimestamp(), ParserOutput\setSections(), ParserOptions\setStubThreshold(), ParserOptions\setTargetLanguage(), ParserOptions\setTemplateCallback(), ParserOutput\setText(), ParserOptions\setThumbSize(), ParserOptions\setTidy(), ParserOutput\setTimestamp(), ParserOptions\setTimestamp(), ParserOutput\setTitleText(), ParserOutput\setTOCHTML(), ParserOptions\setUseDynamicDates(), ParserOptions\setUserLang(), DatabaseBase\tablePrefix(), Parser\Title(), DatabaseBase\trxLevel(), and LoadBalancer\waitTimeout().
wfShellExec | ( | $ | cmd, |
&$ | retval = null , |
||
$ | environ = array() |
||
) |
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported.
$cmd | String Command line, properly escaped for shell. |
&$retval | optional, will receive the program's exit code. (non-zero is usually failure) |
$environ | Array optional environment variables which should be added to the executed command environment. |
Definition at line 2785 of file GlobalFunctions.php.
References $IP, $output, $wgMaxShellFileSize, $wgMaxShellMemory, $wgMaxShellTime, wfDebug(), wfDebugLog(), wfIniGetBool(), wfInitShellLocale(), and wfIsWindows().
Referenced by CheckSyntax\buildFileList(), UploadBase\detectVirus(), DjVuHandler\doTransform(), Installer\envCheckShellLocale(), DifferenceEngine\generateDiffBody(), BitmapHandler\getMagickVersion(), Installer\locateExecutable(), SvgHandler\rasterize(), Maintenance\readlineEmulation(), DjVuImage\retrieveMetaData(), BitmapHandler\transformCustom(), BitmapHandler\transformImageMagick(), RandomImageGenerator\writeImageWithApi(), and RandomImageGenerator\writeImageWithCommandLine().
wfShellMaintenanceCmd | ( | $ | script, |
array $ | parameters = array() , |
||
array $ | options = array() |
||
) |
Generate a shell-escaped command line string to run a maintenance script.
Note that $parameters should be a flat array and an option with an argument should consist of two consecutive items in the array (do not use "--option value").
$script | string MediaWiki maintenance script path |
$parameters | Array Arguments and options to the script |
$options | Array Associative array of options: 'php': The path to the php executable 'wrapper': Path to a PHP wrapper to handle the maintenance script |
Definition at line 2895 of file GlobalFunctions.php.
References $options, $wgPhpCli, and wfRunHooks().
Referenced by GlobalTest\testWfShellMaintenanceCmd().
wfShorthandToInteger | ( | $ | string = '' | ) |
Converts shorthand byte notation to integer form.
$string | String |
Definition at line 3753 of file GlobalFunctions.php.
Referenced by Installer\envCheckMemory(), UploadForm\getSourceSection(), WebRequest\isIniSizeOverflow(), wfShorthandToIntegerTest\testWfShorthandToInteger(), GlobalTest\testWfShorthandToInteger(), UploadFromFile\verifyUpload(), and wfMemoryLimit().
wfShowingResults | ( | $ | offset, |
$ | limit | ||
) |
$offset | Int |
$limit | Int |
Definition at line 1808 of file GlobalFunctions.php.
References $limit, $wgLang, and wfMsgExt().
wfSpecialList | ( | $ | page, |
$ | details, | ||
$ | oppositedm = true |
||
) |
Make a list item, used by various special pages.
$page | String Page link |
$details | String Text between brackets |
$oppositedm | Boolean Add the direction mark opposite to your language, to display text properly |
Definition at line 1858 of file GlobalFunctions.php.
wfSplitWikiID | ( | $ | wiki | ) |
Split a wiki ID into DB name and table prefix.
$wiki | String |
Definition at line 3455 of file GlobalFunctions.php.
Referenced by ForeignDBViaLBRepo\__construct(), LBFactory_Multi\getDBNameAndPrefix(), nextJobDB\getPendingDbs(), and LoadBalancer\openForeignConnection().
wfStreamFile | ( | $ | fname, |
$ | headers = array() |
||
) |
Stream a file to the browser.
Back-compat alias for StreamFile::stream()
Definition at line 3547 of file GlobalFunctions.php.
References $fname, StreamFile\stream(), and wfDeprecated().
wfStripIllegalFilenameChars | ( | $ | name | ) |
Replace all invalid characters with -.
$name | Mixed: filename to process |
Definition at line 3707 of file GlobalFunctions.php.
References $wgIllegalFileChars, Title\legalChars(), and wfBaseName().
Referenced by UploadBase\getTitle(), and Title\validateFileMoveOperation().
wfSuppressWarnings | ( | $ | end = false | ) |
Reference-counted warning suppression.
$end | Bool |
Definition at line 2202 of file GlobalFunctions.php.
Referenced by SVGReader\__construct(), TempFSFile\__destruct(), DatabaseOracle\__destruct(), MWMemcached\_connect_sock(), SqliteMaintenance\backup(), CheckSyntax\buildFileList(), Exif\charCodeString(), DatabaseInstaller\checkExtension(), OutputPage\checkLastModified(), UploadBase\checkXMLEncodingMissmatch(), FSFileBackend\chmod(), FileRepo\cleanupBatch(), FileCacheBase\clearCache(), SquidPurgeClient\close(), FSLockManager\closeLockHandles(), TextPassDumper\closeSpawn(), ZhClient\connect(), MediaHandler\convertMetadataVersion(), IPTC\convIPTCHelper(), SqliteInstaller\dataDirOKmaybeCreate(), DiffHistoryBlob\diff(), Installer\dirIsExecutable(), Installer\disableTimeLimit(), FSFileBackend\doCleanInternal(), FileBackendStore\doConcatenate(), SpecialExport\doExport(), MimeMagic\doGuessMimeType(), SquidPurgeClient\doReads(), FSLockManager\doSingleLock(), SquidPurgeClient\doWrites(), Installer\envCheckPCRE(), CheckImages\execute(), JSParseHelper\execute(), RebuildFileCache\execute(), ModernTemplate\execute(), MonoBookTemplate\execute(), CommandLineInstaller\execute(), CurlHttpRequest\execute(), PhpHttpRequest\execute(), TempFSFile\factory(), DatabaseMysql\fetchObject(), DatabasePostgres\fetchObject(), DatabaseIbm_db2\fetchObject(), DatabaseMysql\fetchRow(), DatabasePostgres\fetchRow(), DatabaseIbm_db2\fetchRow(), DatabaseMysql\freeResult(), DatabasePostgres\freeResult(), DatabaseIbm_db2\freeResult(), LSLockManager\getConnection(), WebInstallerOutput\getCSS(), Installer\getExistingLocalSettings(), FileBackendStore\getFileContents(), ImageHandler\getImageSize(), DjVuImage\getInfo(), SquidPurgeClient\getIP(), PNGHandler\getLongDesc(), GIFHandler\getLongDesc(), PNGMetadataExtractor\getMetadata(), GIFMetadataExtractor\getMetadata(), DjVuHandler\getMetaTree(), DatabaseLogEntry\getParameters(), IcuCollation\getPrimarySortKey(), ExifBitmapHandler\getRotationForExif(), SeleniumConfig\getSeleniumSettings(), FSFile\getSha1Base36(), SquidPurgeClient\getSocket(), IcuCollation\getSortKey(), StoreFileOp\getSourceSha1Base36(), SpecialVersion\getSvnInfo(), TextPassDumper\getTextSpawned(), ForeignAPIRepo\getThumbUrlFromCache(), FSFile\getTimestamp(), MediaWikiTestCase\hideDeprecated(), Language\iconv(), MWCryptRand\initialRandomState(), DatabaseOracle\insertOneRow(), ExifBitmapHandler\isMetadataValid(), PNGHandler\isMetadataValid(), GIFHandler\isMetadataValid(), Sqlite\isPresent(), DatabaseMysql\lastError(), MessageCache\loadFromLocal(), Installer\locateExecutable(), ImportStreamSource\newFromFile(), DatabaseMysql\numRows(), DatabasePostgres\numRows(), SpecialUnlockdb\onSubmit(), SpecialLockdb\onSubmit(), DatabaseMysql\open(), DatabaseMssql\open(), DatabaseOracle\open(), DatabaseIbm_db2\openCataloged(), DatabaseIbm_db2\openUncataloged(), XMPReader\parse(), DiffHistoryBlob\patch(), User\pingLimiter(), DatabaseInstaller\populateInterwikiTable(), Preprocessor_DOM\preprocessToObj(), FSLockManager\pruneKeyLockFiles(), FileRepo\publishBatch(), TempFSFile\purge(), MWCryptRand\realGenerate(), Sanitizer\removeHTMLtags(), SquidPurgeClientPool\run(), MessageCache\saveToLocal(), MessageCache\saveToScript(), JpegMetadataExtractor\segmentSplitter(), DatabaseOracle\selectDB(), UserMailer\send(), DatabaseBase\sourceFile(), PrefixSearch\specialSearch(), SeleniumServerManager\startServerOnUnix(), RecompressTracked\startSlaveProcs(), FileRepo\storeBatch(), StreamFile\stream(), JavaScriptMinifierTest\testJavaScriptMinifierOutput(), MediaWiki_I18N\translate(), SvgHandler\unpackMetadata(), SqlBagOStuff\unserialize(), DatabaseOracle\update(), Language\userAdjust(), wfDiff(), wfDl(), wfErrorLog(), wfIncrStats(), wfMemoryLimit(), wfMerge(), wfMkdirParents(), wfParseUrl(), wfRestoreWarnings(), wfSetupSession(), wfStreamThumb(), and wfUnpack().
wfTempDir | ( | ) |
Tries to get the system directory for temporary files.
The TMPDIR, TMP, and TEMP environment variables are then checked in sequence, and if none are set try sys_get_temp_dir() for PHP >= 5.2.1. All else fails, return /tmp for Unix or C: for Windows and hope for the best. It is common to call it with tempnam().
NOTE: When possible, use instead the tmpfile() function to create temporary files to avoid race conditions on file creation, etc.
Definition at line 2489 of file GlobalFunctions.php.
References wfIsWindows().
Referenced by UploadTest\createFileOfSize(), WikiRevision\downloadSource(), WikiImporter\dumpTemp(), TempFSFile\factory(), ApiTestCaseUpload\fakeUploadChunk(), ApiTestCaseUpload\fakeUploadFile(), generateConfigFile(), NewParserTest\getUploadDir(), UploadFromUrl\makeTemporaryFile(), FileBackendTest\provider_testConcatenate(), ParserTest\quickDiff(), GlobalTest\setUp(), StoreBatchTest\setUp(), ExifRotationTest\setUp(), FileBackendTest\setUp(), UploadFromUrlTestSuite\setUp(), ParserTest\setUp(), UploadFromUrlTestSuite\setupUploadDir(), ParserTest\setupUploadDir(), CdbTest\testCdb(), GlobalTest\testDebugFunctionTest(), ApiUploadTest\testUpload(), ApiUploadTest\testUploadChunks(), ApiUploadTest\testUploadSameContent(), ApiUploadTest\testUploadSameFileName(), ApiUploadTest\testUploadStash(), ApiUploadTest\testUploadZeroLength(), wfDiff(), and wfMerge().
wfTime | ( | ) |
Get the current unix timetstamp with microseconds.
Useful for profiling
Definition at line 1934 of file GlobalFunctions.php.
Referenced by Benchmarker\bench(), BenchmarkHooks\benchHooks(), BenchmarkPurge\benchSquid(), BenchmarkDeleteTruncate\execute(), DumpIterator\execute(), DumpRenderer\execute(), BackupReader\importFromHandle(), TableCleanup\init(), ImageBuilder\init(), BackupDumper\initProgress(), TableCleanup\progress(), ImageBuilder\progress(), TextPassDumper\showReport(), BackupReader\showReport(), BackupDumper\showReport(), and GlobalTest\testTime().
wfTimestamp | ( | $ | outputtype = TS_UNIX , |
$ | ts = 0 |
||
) |
Get a timestamp string in one of various formats.
$outputtype | Mixed: A timestamp in one of the supported formats, the function will autodetect which format is supplied and act accordingly. |
$ts | Mixed: the timestamp to convert or 0 for the current timestamp |
Definition at line 2302 of file GlobalFunctions.php.
References $output, and wfDebug().
Referenced by Block\__construct(), UserBlockedError\__construct(), BlockTest\addDBData(), ApiQueryLogEvents\addLogParams(), ApiQuerySiteinfo\appendGeneralInfo(), SpecialRecentChanges\buildMainQueryConds(), FileCacheBase\cacheTimestamp(), AjaxResponse\checkLastModified(), OutputPage\checkLastModified(), User\checkTemporaryPassword(), Title\checkUserBlock(), WikiPage\commitRollback(), User\confirmationToken(), FileBackendMultiWrite\consistencyCheck(), ApiQueryContributions\continueStr(), LanguageWa\date(), Language\date(), DifferenceEngine\debug(), LocalFile\decodeRow(), SqlBagOStuff\deleteObjectsExpiringBefore(), SpecialUndelete\diffHeader(), FSFileBackend\doGetFileStat(), SwiftFileBackend\doGetFileStat(), MysqlUpdater\doSchemaRestructuring(), FileBackendTest\doTestGetFileStat(), PurgeParserCache\execute(), RemoveUnusedAccounts\execute(), ApiUndelete\execute(), ApiProtect\execute(), ApiQueryAllUsers\execute(), FixTimestamps\execute(), ApiQueryDeletedrevs\execute(), SpecialExport\execute(), ApiEditPage\execute(), ApiQueryFilearchive\execute(), ApiQueryImageInfo\execute(), ApiQueryLogEvents\execute(), ApiQueryBlocks\execute(), ApiQueryContributions\execute(), ApiBlock\execute(), UpdateSearchIndex\execute(), ApiFeedWatchlist\execute(), GenerateSitemap\execute(), LocalFileRestoreBatch\execute(), CacheTime\expired(), ApiQueryInfo\extractPageInfo(), ApiQueryWatchlist\extractRowInfo(), ApiQueryLogEvents\extractRowInfo(), ApiQueryContributions\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), ApiQueryRevisions\extractRowInfo(), HistoryAction\feedEmpty(), FeedUtils\formatDiff(), Language\formatExpiry(), SpecialUndelete\formatFileRow(), SpecialMergeHistory\formatRevisionRow(), SpecialUndelete\formatRevisionRow(), UsersPager\formatRow(), RSSFeed\formatTime(), AtomFeed\formatTime(), GenerateSitemap\generateLimit(), Block\getAutoblockExpiry(), NewUsersLogFormatter\getComment(), ApiQueryUserInfo\getCurrentUserInfo(), ProtectionForm\getExpiry(), User\getFirstEditTimestamp(), FormatMetadata\getFormattedData(), MessageBlobStore\getFromDB(), ApiQueryImageInfo\getInfo(), PNGMetadataExtractor\getMetadata(), ResourceLoaderUserCSSPrefsModule\getModifiedTime(), ResourceLoaderUserOptionsModule\getModifiedTime(), ResourceLoaderStartUpModule\getModifiedTime(), ResourceLoaderStartUpModule\getModuleRegistrations(), ResourceLoaderModule\getMsgBlobMtime(), PageArchive\getPreviousRevision(), RawAction\getRawText(), ResourceLoaderStartUpModule\getScript(), ImageHistoryList\getThumbForLine(), FSFile\getTimestamp(), ForeignAPIFile\getTimestamp(), RevisionItemBase\getTimestamp(), DatabaseLogEntry\getTimestamp(), RCDatabaseLogEntry\getTimestamp(), ArchivedFile\getTimestamp(), WikiPage\getTimestamp(), ManualLogEntry\getTimestamp(), Revision\getTimestamp(), Revision\getTimestampFromId(), ResourceLoaderWikiModule\getTitleMtimes(), Parser\getVariableValue(), ImageHistoryList\imageHistoryLine(), Block\initFromRow(), Language\internalUserTimeAndDate(), User\isEmailConfirmationPending(), SqlBagOStuff\isExpired(), User\isPasswordReminderThrottled(), User\loadDefaults(), ChangesFeed\loadFromCache(), RecentChange\loadFromCurRow(), RecentChange\loadFromRow(), User\loadFromRow(), WikiPage\loadPageData(), SpecialUndelete\loadRequest(), MessageCache\logMessages(), LogEventsList\logTimestamp(), GenerateSitemap\main(), OutputPage\makeResourceLoaderLink(), SpecialBlock\maybeAlterFormDefaults(), SpecialMergeHistory\merge(), User\newTouchedTimestamp(), OutputPage\output(), SpecialBlock\parseExpiryInput(), User\pingLimiter(), ResourceLoader\preloadModuleInfo(), StreamFile\prepareForStream(), ApiQueryContributions\prepareQuery(), TableCleanup\progress(), ImageBuilder\progress(), Parser\pstPass2(), LocalFile\publishTo(), QueryPage\recache(), LocalFile\recordUpload2(), ResourceLoader\respond(), ApiQueryProtectedTitles\run(), ApiQuerySearch\run(), ApiQueryWatchlistRaw\run(), ApiQueryCategoryMembers\run(), ApiQueryCategories\run(), ApiQueryWatchlist\run(), ApiQueryQueryPage\run(), ApiQueryRecentChanges\run(), RunJobs\runJobsLog(), ChangesFeed\saveToCache(), ApiMain\sendCacheHeaders(), ResourceLoader\sendResponseHeaders(), WikiPage\setCachedLastEditTime(), OutputPage\setLastModified(), WikiPage\setTimestamp(), WikiRevision\setTimestamp(), TextPassDumper\showReport(), BackupDumper\showReport(), UpdateLogging\sync(), wfTimestamp\testHttpDate(), wfTimestamp\testNormalTimestamps(), wfTimestamp\testOldTimestamps(), wfTimestamp\testTimestampParameter(), Language\time(), Language\timeanddate(), IPTC\timeHelper(), DatabaseMssql\timestamp(), DatabasePostgres\timestamp(), DatabaseOracle\timestamp(), DatabaseIbm_db2\timestamp(), DatabaseBase\timestamp(), ResourceLoader\tryRespondFromFileCache(), ResourceLoader\tryRespondLastModified(), WikiPage\updateIfNewerOn(), Block\updateTimestamp(), XMPValidate\validateDate(), ApiBase\validateTimestamp(), EditPage\wasDeletedSinceLastEdit(), wfDebugLog(), wfStreamThumb(), wfTimestampNow(), wfTimestampOrNull(), and XmlDumpWriter\writeTimestamp().
wfTimestampNow | ( | ) |
Convenience function; returns MediaWiki timestamp for the present time.
Definition at line 2438 of file GlobalFunctions.php.
References wfTimestamp().
Referenced by Block\__construct(), Revision\__construct(), User\confirmEmail(), Preferences\datetimePreferences(), Block\doAutoblock(), WikiPage\doEdit(), User\doLogout(), WikiPage\doUpdateRestrictions(), ApiProtect\execute(), SpecialWatchlist\execute(), ApiEditPage\execute(), SpecialExport\execute(), UpdateSearchIndex\execute(), GenerateSitemap\execute(), PPFuzzTest\execute(), SqlBagOStuff\expireAll(), Title\getCascadeProtectionSources(), Preferences\getDateOptions(), ResourceLoaderModule\getMsgBlobMtime(), Parser\getRevisionTimestamp(), ParserOptions\getTimestamp(), ManualLogEntry\getTimestamp(), EditPage\importFormData(), ManualLogEntry\insert(), Block\isExpired(), Title\loadRestrictions(), Title\loadRestrictionsFromRows(), MessageCache\logMessages(), SpecialLockdb\onSubmit(), SpecialRecentChanges\optionsPanel(), RSSFeed\outHeader(), AtomFeed\outHeader(), WikiImporter\processRevision(), ParserCache\save(), ProtectionForm\save(), LogPage\saveContent(), HTMLFileCache\saveToFileCache(), User\setNewpassword(), AjaxResponse\storeInMemcached(), and WikiPage\updateRevisionOn().
wfTimestampOrNull | ( | $ | outputtype = TS_UNIX , |
$ | ts = null |
||
) |
Return a formatted timestamp, or null if input is null.
For dealing with nullable timestamp columns in the database.
$outputtype | Integer |
$ts | String |
Definition at line 2425 of file GlobalFunctions.php.
References wfTimestamp().
Referenced by Autopromote\checkCondition(), ApiQueryUsers\execute(), and User\loadFromRow().
wfUILang | ( | ) |
Old function when $wgBetterDirectionality existed Removed in core, kept in extensions for backwards compat.
Definition at line 1268 of file GlobalFunctions.php.
References $wgLang, and wfDeprecated().
Wrapper around php's unpack.
$format | String: The format string (See php's docs) |
$data,: | A binary string of binary data |
$length | integer or false: The minimun length of $data. This is to prevent reading beyond the end of $data. false to disable the check. |
Also be careful when using this function to read unsigned 32 bit integer because php might make it negative.
MWException | if $data not long enough, or if unpack fails |
Definition at line 3876 of file GlobalFunctions.php.
References $result, wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by JpegMetadataExtractor\doPSIR(), BmpHandler\getImageSize(), XCFHandler\getXCFMetaData(), JpegMetadataExtractor\jpegExtractMarker(), and JpegMetadataExtractor\segmentSplitter().
wfUrlencode | ( | $ | s | ) |
We want some things to be included as literal characters in our title URLs for prettiness, which urlencode encodes by default.
According to RFC 1738, all of the following should be safe:
;:&=$-_.+!*'(),
But + is not safe because it's used to indicate a space; &= are only safe in paths and not in queries (and we don't distinguish here); ' seems kind of scary; and urlencode() doesn't touch -_. to begin with. Plus, although / is reserved, we don't care. So the list we unescape is:
;:$!*(),/
However, IIS7 redirects fail when the url contains a colon (Bug 22709), so no fancy : for IIS7.
%2F in the page titles seems to fatally break for some reason.
$s | String: |
Definition at line 298 of file GlobalFunctions.php.
Referenced by FileRepo\getDescriptionRenderUrl(), FileRepo\getDescriptionUrl(), Title\getLocalURL(), Title\getPrefixedURL(), Title\getSubpageUrlForm(), Interwiki\getURL(), Parser\getVariableValue(), LoginForm\mainLoginForm(), Title\makeTitle(), CoreParserFunctions\namespacee(), CoreParserFunctions\nse(), Title\secureAndSplit(), CoreParserFunctions\subjectspacee(), CoreParserFunctions\talkspacee(), GlobalTest\testUrlencode(), and wfUrlencodeTest\verifyEncodingFor().
wfUrlProtocols | ( | $ | includeProtocolRelative = true | ) |
Returns a regular expression of url protocols.
$includeProtocolRelative | bool If false, remove '//' from the returned protocol list. DO NOT USE this directly, use wfUrlProtocolsWithoutProtRel() instead |
Definition at line 657 of file GlobalFunctions.php.
References $wgUrlProtocols.
Referenced by Parser\__construct(), Skin\addToSidebarPlain(), Parser\armorLinks(), ResourceLoaderStartUpModule\getConfig(), Skin\makeInternalOrExternalUrl(), Parser\replaceInternalLinks2(), Parser_LinkHooks\replaceInternalLinksCallback(), Sanitizer\safeEncodeAttribute(), Parser\stripSectionName(), Sanitizer\validateAttributes(), and wfUrlProtocolsWithoutProtRel().
Like wfUrlProtocols(), but excludes '//' from the protocol list.
Use this if you need a regex that matches all URL protocols but does not match protocol- relative URLs
Definition at line 702 of file GlobalFunctions.php.
References wfUrlProtocols().
Referenced by Parser\doMagicLinks(), and ApiFormatBase\formatHTML().
wfUseMW | ( | $ | req_ver | ) |
This function works like "use VERSION" in Perl except it checks the version of MediaWiki, the program will die with a backtrace if the current version of MediaWiki is less than the version provided.
This is useful for extensions which due to their nature are not kept in sync with releases
$req_ver | Mixed: the version to check, can be a string, an integer, or a float |
Definition at line 3092 of file GlobalFunctions.php.
References $wgVersion.
wfUsePHP | ( | $ | req_ver | ) |
This function works like "use VERSION" in Perl, the program will die with a backtrace if the current version of PHP is less than the version provided.
This is useful for extensions which due to their nature are not kept in sync with releases, and might depend on other versions of PHP than the main code
Note: PHP might die due to parsing errors in some cases before it ever manages to call this function, such is life
$req_ver | Mixed: the version to check, can be a string, an integer, or a float |
Definition at line 3071 of file GlobalFunctions.php.
wfVarDump | ( | $ | var | ) |
A wrapper around the PHP function var_export().
Either print it or add it to the regular output ($wgOut).
$var | A PHP variable to dump. |
Definition at line 1983 of file GlobalFunctions.php.
wfViewPrevNext | ( | $ | offset, |
$ | limit, | ||
$ | link, | ||
$ | query = '' , |
||
$ | atend = false |
||
) |
Generate (prev x| next x) (20|50|100...) type links for paging.
$offset | String |
$limit | Integer |
$link | String |
$query | String: optional URL query parameter string |
$atend | Bool: optional param for specified if this is the last page |
Definition at line 1829 of file GlobalFunctions.php.
References $limit, $title, $wgLang, Title\newFromText(), wfCgiToArray(), and wfDeprecated().
wfWaitForSlaves | ( | $ | maxLag = false , |
$ | wiki = false |
||
) |
Modern version of wfWaitForSlaves().
Instead of looking at replication lag and waiting for it to go down, this waits for the slaves to catch up to the master position. Use this when updating very large numbers of rows, as in maintenance scripts, to avoid causing too much lag. Of course, this is a no-op if there are no slaves.
$maxLag | Integer (deprecated) |
$wiki | mixed Wiki identifier accepted by wfGetLB |
Definition at line 3643 of file GlobalFunctions.php.
References $lb, and wfGetLB().
Referenced by CompressOld\compressWithConcat(), RefreshLinks\deleteLinksFromNonexistent(), PopulateRevisionLength\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateParentId\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateCategory\doPopulateCategory(), RefreshLinks\doRefreshLinks(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), MysqlUpdater\doTemplatelinksUpdate(), WaitForSlave\execute(), DeleteDefaultMessages\execute(), MigrateUserGroup\execute(), BatchedQueryRunner\execute(), UpdateSpecialPages\execute(), ConvertUserOptions\execute(), UpdateRestrictions\execute(), CleanupRemovedModules\execute(), DeleteSelfExternals\execute(), InitEditCount\execute(), RunJobs\execute(), DeleteBatch\execute(), MoveBatch\execute(), RefreshImageMetadata\execute(), UpdateMediaWiki\execute(), moveToExternal(), resolveStubs(), RefreshLinksJob2\run(), BackupReader\showReport(), UpdateLogging\sync(), TrackBlobs\trackOrphanText(), TrackBlobs\trackRevisions(), and FixBug20757\waitForSlaves().
wfWarn | ( | $ | msg, |
$ | callerOffset = 1 , |
||
$ | level = E_USER_NOTICE |
||
) |
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
$msg | String: message to send |
$callerOffset | Integer: number of items to go back in the backtrace to find the correct caller (1 = function calling wfWarn, ...) |
$level | Integer: PHP error level; only used when $wgDevelopmentWarnings is true |
Definition at line 1031 of file GlobalFunctions.php.
References $file, $wgDevelopmentWarnings, MWDebug\warning(), wfDebug(), and wfDebugBacktrace().
Referenced by Exif\__construct(), MWTidy\execExternalTidy(), MWTidy\execInternalTidy(), ParserCache\getKey(), SpecialPageFactory\getLocalNameFor(), Autopromote\recCheckCondition(), wfDeprecated(), and wfMsgExt().
wfWikiID | ( | ) |
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
Definition at line 3439 of file GlobalFunctions.php.
References $wgDBname, and $wgDBprefix.
Referenced by DBABagOStuff\__construct(), FileBackend\__construct(), ApiQuerySiteinfo\appendGeneralInfo(), UserDupes\checkDupes(), DeleteRevision\execute(), RefreshImageCount\execute(), CheckUsernames\execute(), DeleteImageCache\execute(), AttachLatest\execute(), CreateAndPromote\execute(), InitEditCount\execute(), UpdateMediaWiki\execute(), GenerateSitemap\execute(), UserrightsPage\fetchUser(), Interwiki\getAllPrefixesCached(), LoadBalancer\getConnection(), Interwiki\getInterwikiCacheEntry(), User\getNewMessageLinks(), Skin\getNewtalks(), Profiler\getProfileID(), MWCryptRand\initialRandomState(), MessageCache\loadFromLocal(), RecompressTracked\logToFile(), UserMailer\makeMsgId(), TextPassDumper\openSpawn(), User\pingLimiter(), TableCleanup\progress(), MessageCache\saveToLocal(), MessageCache\saveToScript(), TextPassDumper\showReport(), BackupDumper\showReport(), RecompressTracked\startSlaveProcs(), wfDebugLog(), wfLogDBError(), and wfMemcKey().