MediaWiki
1.28.0
|
Global functions used everywhere. More...
Go to the source code of this file.
Functions | |
mimeTypeMatch ($type, $avail) | |
Checks if a given MIME type matches any of the keys in the given array. More... | |
wfAcceptToPrefs ($accept, $def= '*/*') | |
Converts an Accept-* header into an array mapping string values to quality factors. More... | |
wfAppendQuery ($url, $query) | |
Append a query string to an existing URL, which may or may not already have query string parameters already. More... | |
wfAppendToArrayIfNotDefault ($key, $value, $default, &$changed) | |
Appends to second array if $value differs from that in $default. More... | |
wfArrayDiff2 ($a, $b) | |
Like array_diff( $a, $b ) except that it works with two-dimensional arrays. More... | |
wfArrayDiff2_cmp ($a, $b) | |
wfArrayInsertAfter (array $array, array $insert, $after) | |
Insert array into another array after the specified KEY More... | |
wfArrayPlus2d (array $baseArray, array $newValues) | |
Merges two (possibly) 2 dimensional arrays into the target array ($baseArray). More... | |
wfArrayToCgi ($array1, $array2=null, $prefix= '') | |
This function takes one or two arrays as input, and returns a CGI-style string, e.g. More... | |
wfAssembleUrl ($urlParts) | |
This function will reassemble a URL parsed with wfParseURL. More... | |
wfBacktrace ($raw=null) | |
Get a debug backtrace as a string. More... | |
wfBaseConvert ($input, $sourceBase, $destBase, $pad=1, $lowercase=true, $engine= 'auto') | |
Convert an arbitrarily-long digit string from one numeric base to another, optionally zero-padding to a minimum column width. More... | |
wfBaseName ($path, $suffix= '') | |
Return the final portion of a pathname. More... | |
wfBCP47 ($code) | |
Get the normalised IETF language tag See unit test for examples. More... | |
wfBoolToStr ($value) | |
Convenience function converts boolean values into "true" or "false" (string) values. More... | |
wfCanIPUseHTTPS ($ip) | |
Determine whether the client at a given source IP is likely to be able to access the wiki via HTTPS. More... | |
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. More... | |
wfClearOutputBuffers () | |
More legible than passing a 'false' parameter to wfResetOutputBuffers(): More... | |
wfClientAcceptsGzip ($force=false) | |
wfConfiguredReadOnlyReason () | |
Get the value of $wgReadOnly or the contents of $wgReadOnlyFile. More... | |
wfCountDown ($seconds) | |
Count down from $seconds to zero on the terminal, with a one-second pause between showing each number. More... | |
wfDebug ($text, $dest= 'all', array $context=[]) | |
Sends a line to the debug log if enabled or, optionally, to a comment in output. More... | |
wfDebugBacktrace ($limit=0) | |
Safety wrapper for debug_backtrace(). More... | |
wfDebugLog ($logGroup, $text, $dest= 'all', array $context=[]) | |
Send a line to a supplementary debug log file, if configured, or main debug log if not. More... | |
wfDebugMem ($exact=false) | |
Send a line giving PHP memory usage. More... | |
wfDeprecated ($function, $version=false, $component=false, $callerOffset=2) | |
Throws a warning that $function is deprecated. More... | |
wfDiff ($before, $after, $params= '-u') | |
Returns unified plain-text diff of two texts. More... | |
wfErrorLog ($text, $file, array $context=[]) | |
Log to a file without getting "file size exceeded" signals. More... | |
wfEscapeShellArg () | |
Version of escapeshellarg() that works better on Windows. More... | |
wfEscapeWikiText ($text) | |
Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc. More... | |
wfExpandIRI ($url) | |
Take a URL, make sure it's expanded to fully qualified, and replace any encoded non-ASCII Unicode characters with their UTF-8 original forms for more compact display and legibility for local audiences. More... | |
wfExpandIRI_callback ($matches) | |
Private callback for wfExpandIRI. More... | |
wfExpandUrl ($url, $defaultProto=PROTO_CURRENT) | |
Expand a potentially local URL to a fully-qualified URL. More... | |
wfFindFile ($title, $options=[]) | |
Find a file. More... | |
wfFixSessionID () | |
wfForeignMemcKey ($db, $prefix) | |
Make a cache key for a foreign DB. More... | |
wfFormatStackFrame ($frame) | |
Return a string representation of frame. More... | |
wfGetAllCallers ($limit=3) | |
Return a string consisting of callers in the stack. More... | |
wfGetCache ($cacheType) | |
Get a specific cache object. More... | |
wfGetCaller ($level=2) | |
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfGetCaller() call (ie. More... | |
wfGetDB ($db, $groups=[], $wiki=false) | |
Get a Database object. More... | |
wfGetLangObj ($langcode=false) | |
Return a Language object from $langcode. More... | |
wfGetLB ($wiki=false) | |
Get a load balancer object. More... | |
wfGetLBFactory () | |
Get the load balancer factory object. More... | |
wfGetMainCache () | |
Get the main cache object. More... | |
wfGetMessageCacheStorage () | |
Get the cache object used by the message cache. More... | |
wfGetNull () | |
Get a platform-independent path to the null file, e.g. More... | |
wfGetParserCacheStorage () | |
Get the cache object used by the parser cache. More... | |
wfGetPrecompiledData ($name) | |
Get an object from the precompiled serialized directory. More... | |
wfGetScriptUrl () | |
Get the script URL. More... | |
wfGlobalCacheKey () | |
Make a cache key with database-agnostic prefix. More... | |
wfHostname () | |
Fetch server name for use in error reporting etc. More... | |
wfHttpError ($code, $label, $desc) | |
Provide a simple HTTP error. More... | |
wfIncrStats ($key, $count=1) | |
Increment a statistics counter. More... | |
wfIniGetBool ($setting) | |
Safety wrapper around ini_get() for boolean settings. More... | |
wfInitShellLocale () | |
Workaround for http://bugs.php.net/bug.php?id=45132 escapeshellarg() destroys non-ASCII characters if LANG is not a UTF-8 locale. More... | |
wfIsBadImage ($name, $contextTitle=false, $blacklist=null) | |
Determine if an image exists on the 'bad image list'. More... | |
wfIsDebugRawPage () | |
Returns true if debug logging should be suppressed if $wgDebugRawPage = false. More... | |
wfIsHHVM () | |
Check if we are running under HHVM. More... | |
wfIsInfinity ($str) | |
Determine input string is represents as infinity. More... | |
wfIsWindows () | |
Check if the operating system is Windows. More... | |
wfLoadExtension ($ext, $path=null) | |
Load an extension. More... | |
wfLoadExtensions (array $exts) | |
Load multiple extensions at once. More... | |
wfLoadSkin ($skin, $path=null) | |
Load a skin. More... | |
wfLoadSkins (array $skins) | |
Load multiple skins at once. More... | |
wfLocalFile ($title) | |
Get an object referring to a locally registered file. More... | |
wfLogDBError ($text, array $context=[]) | |
Log for database errors. More... | |
wfLogProfilingData () | |
wfLogWarning ($msg, $callerOffset=1, $level=E_USER_WARNING) | |
Send a warning as a PHP error and the debug log. More... | |
wfMakeUrlIndexes ($url) | |
Make URL indexes, appropriate for the el_index field of externallinks. More... | |
wfMatchesDomainList ($url, $domains) | |
Check whether a given URL has a domain that occurs in a given set of domains. More... | |
wfMemcKey () | |
Make a cache key for the local wiki. More... | |
wfMemoryLimit () | |
Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit. More... | |
wfMerge ($old, $mine, $yours, &$result) | |
wfMerge attempts to merge differences between three texts. More... | |
wfMergeErrorArrays () | |
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g. More... | |
wfMessage ($key) | |
This is the function for getting translated interface messages. More... | |
wfMessageFallback () | |
This function accepts multiple message keys and returns a message instance for the first message which is non-empty. More... | |
wfMkdirParents ($dir, $mode=null, $caller=null) | |
Make directory, and make all parent directories if they don't exist. More... | |
wfMsgReplaceArgs ($message, $args) | |
Replace message parameter keys on the given formatted output. More... | |
wfNegotiateType ($cprefs, $sprefs) | |
Returns the 'best' match between a client's requested internet media types and the server's list of available types. More... | |
wfObjectToArray ($objOrArray, $recursive=true) | |
Recursively converts the parameter (an object) to an array with the same data. More... | |
wfParseUrl ($url) | |
parse_url() work-alike, but non-broken. More... | |
wfPercent ($nr, $acc=2, $round=true) | |
wfQueriesMustScale () | |
Should low-performance queries be disabled? More... | |
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. More... | |
wfRandomString ($length=32) | |
Get a random string containing a number of pseudo-random hex characters. More... | |
wfReadOnly () | |
Check whether the wiki is in read-only mode. More... | |
wfReadOnlyReason () | |
Check if the site is in read-only mode and return the message if so. More... | |
wfRecursiveRemoveDir ($dir) | |
Remove a directory and all its content. More... | |
wfRelativePath ($path, $from) | |
Generate a relative path name to the given file. More... | |
wfRemoveDotSegments ($urlPath) | |
Remove all dot-segments in the provided URL path. More... | |
wfReportTime () | |
Returns a script tag that stores the amount of time it took MediaWiki to handle the request in milliseconds as 'wgBackendResponseTime'. More... | |
wfResetOutputBuffers ($resetGzipEncoding=true) | |
Clear away any user-level output buffers, discarding contents. More... | |
wfResetSessionID () | |
Reset the session id. More... | |
wfRestoreWarnings () | |
wfRunHooks ($event, array $args=[], $deprecatedVersion=null) | |
Call hook functions defined in $wgHooks. More... | |
wfScript ($script= 'index') | |
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScriptPath etc. More... | |
wfSetBit (&$dest, $bit, $state=true) | |
As for wfSetVar except setting a bit. More... | |
wfSetupSession ($sessionId=false) | |
Initialise php session. More... | |
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. More... | |
wfShellExec ($cmd, &$retval=null, $environ=[], $limits=[], $options=[]) | |
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported. More... | |
wfShellExecDisabled () | |
Check if wfShellExec() is effectively disabled via php.ini config. More... | |
wfShellExecWithStderr ($cmd, &$retval=null, $environ=[], $limits=[]) | |
Execute a shell command, returning both stdout and stderr. More... | |
wfShellWikiCmd ($script, array $parameters=[], array $options=[]) | |
Generate a shell-escaped command line string to run a MediaWiki cli script. More... | |
wfShorthandToInteger ($string= '', $default=-1) | |
Converts shorthand byte notation to integer form. More... | |
wfShowingResults ($offset, $limit) | |
wfSplitWikiID ($wiki) | |
Split a wiki ID into DB name and table prefix. More... | |
wfStripIllegalFilenameChars ($name) | |
Replace all invalid characters with '-'. More... | |
wfSuppressWarnings ($end=false) | |
Reference-counted warning suppression. More... | |
wfTempDir () | |
Tries to get the system directory for temporary files. More... | |
wfThumbIsStandard (File $file, array $params) | |
Returns true if these thumbnail parameters match one that MediaWiki requests from file description pages and/or parser output. More... | |
wfTimestamp ($outputtype=TS_UNIX, $ts=0) | |
Get a timestamp string in one of various formats. More... | |
wfTimestampNow () | |
Convenience function; returns MediaWiki timestamp for the present time. More... | |
wfTimestampOrNull ($outputtype=TS_UNIX, $ts=null) | |
Return a formatted timestamp, or null if input is null. More... | |
wfTransactionalTimeLimit () | |
Set PHP's time limit to the larger of php.ini or $wgTransactionalTimeLimit. More... | |
wfUnpack ($format, $data, $length=false) | |
Wrapper around php's unpack. More... | |
wfUrlencode ($s) | |
We want some things to be included as literal characters in our title URLs for prettiness, which urlencode encodes by default. More... | |
wfUrlProtocols ($includeProtocolRelative=true) | |
Returns a regular expression of url protocols. More... | |
wfUrlProtocolsWithoutProtRel () | |
Like wfUrlProtocols(), but excludes '//' from the protocol list. More... | |
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. More... | |
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. More... | |
wfVarDump ($var) | |
A wrapper around the PHP function var_export(). More... | |
wfWaitForSlaves ($ifWritesSince=null, $wiki=false, $cluster=false, $timeout=null) | |
Waits for the replica DBs to catch up to the master position. More... | |
wfWarn ($msg, $callerOffset=1, $level=E_USER_NOTICE) | |
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings. More... | |
wfWikiID () | |
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys. More... | |
Global functions used everywhere.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html
Definition in file GlobalFunctions.php.
|
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.
string | $type | |
array | $avail |
Definition at line 1913 of file GlobalFunctions.php.
Referenced by GlobalTest\testMimeTypeMatch().
wfAcceptToPrefs | ( | $accept, | |
$def = '*/*' |
|||
) |
Converts an Accept-* header into an array mapping string values to quality factors.
string | $accept | |
string | $def | Default |
Definition at line 1877 of file GlobalFunctions.php.
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.
string | $url | |
string|string[] | $query String or associative array |
Definition at line 498 of file GlobalFunctions.php.
Referenced by SpecialPage\addFeedLinks(), OutputPage\addScriptFile(), SpecialRedirect\dispatchLog(), SpecialRedirect\dispatchPage(), SpecialRedirect\dispatchRevision(), SpecialApiHelp\execute(), SpecialContributions\execute(), RedirectSpecialPage\execute(), ImportSiteScripts\execute(), SpecialRecentChanges\execute(), LoginSignupSpecialPage\execute(), ImportSiteScripts\fetchScriptList(), ApiHelp\fixHelpLinks(), FileRepo\getDescriptionRenderUrl(), OutputPage\getHeadLinksArray(), ApiHelp\getHelpInternal(), FindHooks\getHooksFromOnlineDocCategory(), MediaWiki\Linker\LinkRenderer\getLinkURL(), Title\getLocalURL(), ImageHandler\getScriptedTransform(), File\getTransformScript(), Linker\getUploadUrl(), ResourceLoaderImage\getUrl(), ForeignAPIRepo\httpGetCached(), Linker\makeThumbLink2(), FileRepo\makeUrl(), ImportStreamSource\newFromInterwiki(), MediaWiki\Site\MediaWikiPageNameNormalizer\normalizePageName(), SquidPurgeClient\queuePurge(), and WfAppendQueryTest\testAppendQuery().
wfAppendToArrayIfNotDefault | ( | $key, | |
$value, | |||
$default, | |||
& | $changed | ||
) |
Appends to second array if $value differs from that in $default.
string | int | $key | |
mixed | $value | |
mixed | $default | |
array | $changed | Array to alter |
MWException |
Definition at line 212 of file GlobalFunctions.php.
wfArrayDiff2 | ( | $a, | |
$b | |||
) |
Like array_diff( $a, $b ) except that it works with two-dimensional arrays.
array | $a | |
array | $b |
Definition at line 176 of file GlobalFunctions.php.
Referenced by WikiPage\doRollback(), EditPage\getEditPermissionErrors(), GlobalTest\testWfArrayDiff2(), and UploadBase\verifyTitlePermissions().
wfArrayDiff2_cmp | ( | $a, | |
$b | |||
) |
array | string | $a | |
array | string | $b |
Definition at line 185 of file GlobalFunctions.php.
Insert array into another array after the specified KEY
array | $array | The array. |
array | $insert | The array to insert. |
mixed | $after | The key to insert after |
Definition at line 267 of file GlobalFunctions.php.
Referenced by DeletedContributionsPage\getSubTitle().
Merges two (possibly) 2 dimensional arrays into the target array ($baseArray).
Values that exist in both values will be combined with += (all values of the array of $newValues will be added to the values of the array of $baseArray, while values, that exists in both, the value of $baseArray will be used).
array | $baseArray | The array where you want to add the values of $newValues to |
array | $newValues | An array with new values |
Definition at line 3695 of file GlobalFunctions.php.
Referenced by ExtensionRegistry\exportExtractedData(), and WfArrayPlus2dTest\testWfArrayPlus2d().
wfArrayToCgi | ( | $array1, | |
$array2 = null , |
|||
$prefix = '' |
|||
) |
This function takes one or 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.
array | $array1 | ( String|Array ) |
array | null | $array2 | ( String|Array ) |
string | $prefix |
Definition at line 406 of file GlobalFunctions.php.
Referenced by WebRequest\appendQueryArray(), SkinTemplate\buildPersonalUrls(), SpecialPage\checkLoginSecurityLevel(), CurlHttpRequest\execute(), PhpHttpRequest\execute(), SpecialNewpages\execute(), Title\fixUrlQueryArgs(), AllMessagesTablePager\formatValue(), WebInstallerOptions\getCCPartnerUrl(), MediaTransformOutput\getDescLinkAttribs(), FileRepo\getDescriptionStylesheetUrl(), getEscapedProfileUrl(), FormAction\getForm(), FormSpecialPage\getForm(), SpecialRunJobs\getQuerySignature(), WebInstaller\getUrl(), AuthManagerSpecialPage\handleReauthBeforeExecute(), UserNotLoggedIn\report(), SkinTemplate\setupTemplateForOutput(), PurgeAction\show(), OutputPage\showPermissionsErrorPage(), GlobalTest\testArrayToCGI(), GlobalTest\testArrayToCGI2(), and GlobalTest\testCgiRoundTrip().
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]
array | $urlParts | URL parts, as output from wfParseUrl |
Definition at line 626 of file GlobalFunctions.php.
Referenced by WfAssembleUrlTest\testWfAssembleUrl().
wfBacktrace | ( | $raw = null | ) |
Get a debug backtrace as a string.
bool | null | $raw | If true, the return value is plain text. If false, HTML. Defaults to $wgCommandLineMode if unset. |
Definition at line 1536 of file GlobalFunctions.php.
Referenced by MWDebug\deprecated().
wfBaseConvert | ( | $input, | |
$sourceBase, | |||
$destBase, | |||
$pad = 1 , |
|||
$lowercase = true , |
|||
$engine = 'auto' |
|||
) |
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.
string | $input | Input number |
int | $sourceBase | Base of the input number |
int | $destBase | Desired base of the output |
int | $pad | Minimum number of digits in the output (pad with zeroes) |
bool | $lowercase | Whether to output in lowercase or uppercase |
string | $engine | Either "gmp", "bcmath", or "php" |
Definition at line 2888 of file GlobalFunctions.php.
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 '\s' in our Unix paths either.
string | $path | |
string | $suffix | String to remove if present |
Definition at line 2811 of file GlobalFunctions.php.
Referenced by Exif\__construct(), ImageBuilder\checkMissingImage(), TestFileOpPerformance\doPerfTest(), and WfBaseNameTest\testBaseName().
wfBCP47 | ( | $code | ) |
Get the normalised IETF language tag See unit test for examples.
string | $code | The language code. |
Definition at line 3383 of file GlobalFunctions.php.
Referenced by OutputPage\addAcceptLanguage(), SkinTemplate\buildContentNavigationUrls(), ImagePage\doRenderLangOpt(), WebInstallerOutput\getHeadAttribs(), OutputPage\getHeadLinksArray(), Language\getHtmlCode(), FeedItem\getLanguage(), SkinTemplate\getLanguages(), CoreParserFunctions\language(), Preferences\profilePreferences(), and WfBCP47Test\testBCP47().
wfBoolToStr | ( | $value | ) |
Convenience function converts boolean values into "true" or "false" (string) values.
bool | $value |
Definition at line 3192 of file GlobalFunctions.php.
Referenced by LocalSettingsGenerator\__construct(), ApiRsd\formatRsdApiList(), LocalSettingsGenerator\getDefaultText(), MysqlInstaller\getLocalSettings(), and GlobalTest\testClientAcceptsGzipTest().
wfCanIPUseHTTPS | ( | $ip | ) |
Determine whether the client at a given source IP is likely to be able to access the wiki via HTTPS.
string | $ip | The IPv4/6 address in the normal human-readable form |
Definition at line 3577 of file GlobalFunctions.php.
Referenced by LoginSignupSpecialPage\execute(), Preferences\profilePreferences(), and User\requiresHTTPS().
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 compatibility with legacy functions that accept raw query strings instead of nice arrays. Of course, keys and values are urldecode()d.
string | $query | Query string |
Definition at line 451 of file GlobalFunctions.php.
Referenced by Linker\link(), Linker\makeBrokenImageLinkObj(), SpecialChangeEmail\onSuccess(), OutputPage\returnToMain(), LoginHelper\showReturnToPage(), SpecialCreateAccount\successfulAction(), GlobalTest\testCgiRoundTrip(), and GlobalTest\testCgiToArray().
wfClearOutputBuffers | ( | ) |
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 1865 of file GlobalFunctions.php.
Referenced by ApiMain\checkConditionalRequestHeaders(), and OutputPage\checkLastModified().
wfClientAcceptsGzip | ( | $force = false | ) |
document
FIXME: We may want to blacklist some broken browsers
bool | $force |
Definition at line 1633 of file GlobalFunctions.php.
Referenced by HTMLFileCache\loadFromFileCache(), HTMLFileCache\saveToFileCache(), GlobalTest\testClientAcceptsGzipTest(), and wfGzipHandler().
wfConfiguredReadOnlyReason | ( | ) |
Get the value of $wgReadOnly or the contents of $wgReadOnlyFile.
Definition at line 1307 of file GlobalFunctions.php.
Referenced by MWLBFactory\applyDefaultConfig(), FileBackendGroup\initFromGlobals(), and JobQueueGroup\singleton().
wfCountDown | ( | $seconds | ) |
Count down from $seconds to zero on the terminal, with a one-second pause between showing each number.
For use in command-line scripts.
int | $seconds |
Definition at line 3263 of file GlobalFunctions.php.
Referenced by ResetUserTokens\execute(), UpdateMediaWiki\execute(), and UserOptions\warn().
wfDebug | ( | $text, | |
$dest = 'all' , |
|||
array | $context = [] |
||
) |
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 $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.
string | $text | |
string | bool | $dest | Destination of the message:
|
array | $context | Additional logging context data |
Definition at line 997 of file GlobalFunctions.php.
Referenced by QuickTemplate\__construct(), PageArchive\__construct(), UploadFromChunks\__construct(), UploadFromStash\__construct(), SearchUpdate\__construct(), DifferenceEngine\__construct(), ApiMain\__construct(), Parser\__construct(), Revision\__construct(), UploadStashFile\__construct(), StubObject\_unstub(), LogPage\actionText(), ImageGalleryBase\add(), ParserTestRunner\addArticle(), MediaHandler\addMeta(), LinkBatch\addObj(), LocalFileMoveBatch\addOlds(), ParserOutput\addTrackingCategory(), Skin\afterContentHook(), Parser\braceSubstitution(), SkinTemplate\buildContentActionUrls(), EmailNotification\canSendUserTalkEmail(), AjaxResponse\checkLastModified(), OutputPage\checkLastModified(), UploadBase\checkSvgScriptCallback(), UploadBase\checkXMLEncodingMissmatch(), JobQueueDB\claimOldest(), LocalRepo\cleanupDeletedBatch(), UploadBase\cleanupTempFile(), SpecialEditWatchlist\cleanupWatchlist(), UploadStash\clear(), CloneDatabase\cloneTableStructure(), Revision\compressRevisionText(), UploadFromChunks\concatenateChunks(), Article\confirmDelete(), DjVuImage\convertDumpToXML(), UploadBase\createFromRequest(), BaseDump\debug(), WikiImporter\debug(), RecompressTracked\debug(), SVGReader\debug(), SectionProfiler\debug(), Block\defaultRetroactiveAutoblock(), Article\delete(), Block\deleteIfExpired(), User\deleteNewtalk(), ChangeTags\deleteTagEverywhere(), UploadBase\detectScript(), UploadBase\detectVirus(), DiffEngine\diffInternal(), Parser\disableCache(), BitmapMetadataHandler\doApp13(), Block\doAutoblock(), JobQueueDB\doBatchPushInternal(), WikiPage\doDeleteArticleReal(), WikiPage\doEditUpdates(), MockImageHandler\doFakeTransform(), WikiFilePage\doPurge(), DatabaseMssql\doQuery(), DatabaseOracle\doQuery(), Block\doRetroactiveAutoblock(), UserrightsPage\doSaveUserGroups(), TransformationalImageHandler\doTransform(), DjVuHandler\doTransform(), WikiRevision\downloadSource(), EditPage\edit(), ZipDirectoryReader\error(), ApiUpload\execute(), SpecialUserLogout\execute(), ChangesFeed\execute(), SpecialUpload\execute(), LocalFileRestoreBatch\execute(), PoolWorkArticleView\fallback(), Article\fetchContentObject(), IcuCollation\fetchFirstLetterData(), DatabaseMssql\fieldExists(), DatabaseMssql\fieldInfo(), DiffEngine\find_middle_snake(), BlockLevelPass\findColonNoLinks(), WikiImporter\finishImportPage(), FormatMetadata\flattenArrayReal(), DeletedContribsPager\formatRow(), ContribsPager\formatRow(), FileRepo\freeTemp(), LCStoreCDB\get(), ParserCache\get(), MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixesCached(), User\getBlockedStatus(), CoreParserFunctions\getCachedRevisionObject(), PoolWorkArticleView\getCachedWork(), ContextSource\getContext(), Profiler\getContext(), Action\getContext(), SpecialPage\getContext(), Article\getContext(), SpecialVersion\getCreditsForExtension(), ForeignDBFile\getDescriptionText(), File\getDescriptionText(), UploadStash\getFile(), DoubleRedirectJob\getFinalDestination(), WikiFilePage\getForeignCategories(), GenderCache\getGenderOf(), MediaHandlerFactory\getHandler(), DjVuImage\getInfo(), SpecialUpload\getInitialPageText(), MediaWiki\Interwiki\ClassicInterwikiLookup\getInterwikiCacheEntry(), ParserCache\getKey(), ResourceLoaderContext\getLanguage(), TransformationalImageHandler\getMagickVersion(), RequestContext\getMainAndWarn(), GIFHandler\getMetadata(), PNGHandler\getMetadata(), PNGMetadataExtractor\getMetadata(), GIFMetadataExtractor\getMetadata(), TiffHandler\getMetadata(), JpegHandler\getMetadata(), DjVuHandler\getMetadata(), SvgHandler\getMetadata(), DjVuHandler\getMetaTree(), DjVuImage\getMultiPageInfo(), WebRequestUpload\getName(), Title\getNsText(), DjVuImage\getPageInfo(), WikiPage\getParserOutput(), SpecialEmailUser\getPermissionsError(), EditPage\getPreloadedContent(), UserCache\getProp(), Title\getRestrictionTypes(), ExternalStoreDB\getSlave(), SpecialEmailUser\getTarget(), ForeignAPIRepo\getThumbError(), ForeignAPIRepo\getThumbUrl(), UploadStashFile\getThumbUrl(), ForeignAPIRepo\getThumbUrlFromCache(), Title\getTitleValue(), Parser\getUserSig(), Parser\getVariableValue(), File\getViewURL(), XCFHandler\getXCFMetaData(), OutputPage\haveCacheVaryCookies(), ThumbnailRenderJob\hitThumbUrl(), ForeignAPIRepo\httpGet(), EditPage\importFormData(), WikiRevision\importLogItem(), WikiRevision\importOldRevision(), WikiRevision\importUpload(), Block\insert(), ExternalStore\insertWithFallback(), EditPage\internalAttemptSave(), User\isBlockedFrom(), FileCacheBase\isCacheGood(), DjVuHandler\isEnabled(), SvgHandler\isEnabled(), FileDependency\isExpired(), LocalisationCache\isExpired(), Block\isExpired(), WebPHandler\isMetadataValid(), ExifBitmapHandler\isMetadataValid(), PNGHandler\isMetadataValid(), GIFHandler\isMetadataValid(), MovePage\isValidMoveTarget(), Title\isValidMoveTarget(), Block\isWhitelistedFromAutoblocks(), MessageCache\load(), SiteStats\loadAndLazyInit(), ChangesFeed\loadFromCache(), User\loadFromCache(), HTMLFileCache\loadFromFileCache(), AjaxResponse\loadFromMemcached(), User\loadOptions(), Linker\makeExternalImage(), Linker\makeExternalLink(), Linker\makeImageLink(), Linker\makeMediaLinkFile(), ImportStreamSource\newFromURL(), RawAction\onView(), UploadDumper\outputItem(), ApiBase\parseMsg(), SearchMySQL\parseQuery(), SearchSqlite\parseQuery(), SearchPostgres\parseQuery(), BacklinkCache\partition(), DiffHistoryBlob\patch(), AjaxDispatcher\performAction(), ApiUpload\performStash(), User\pingLimiter(), MediaWiki\preOutputCommit(), SkinTemplate\prepareQuickTemplate(), SpecialUpload\processUpload(), LocalFile\purgeThumbList(), BacklinkCache\queryLinks(), SvgHandler\rasterize(), TextPassDumper\readDump(), LocalisationCache\recache(), LocalFile\recordUpload2(), UploadStash\removeFileNoAuth(), Parser\renderImageGallery(), WikiPage\replaceSectionAtRev(), Parser\replaceVariables(), Http\request(), MediaWiki\restInPeace(), DjVuImage\retrieveMetaData(), JpegHandler\rotate(), BitmapHandler\rotate(), ThumbnailRenderJob\run(), DoubleRedirectJob\run(), ParserTestRunner\runTest(), RequestContext\sanitizeLangCode(), ParserCache\save(), FileCacheBase\saveText(), HTMLFileCache\saveToFileCache(), SearchPostgres\searchQuery(), JpegMetadataExtractor\segmentSplitter(), UserMailer\send(), OutputPage\sendCacheControl(), UserMailer\sendInternal(), UserMailer\sendWithPear(), ApiMain\setCacheMode(), LanguageClassesTestCase\setUp(), ParserTestTopLevelSuite\setUp(), UploadFromUrlTestSuite\setupUploadDir(), ViewAction\show(), LocalRepo\skipWriteOperationIfSha1(), User\spreadBlock(), UploadStash\stashFile(), FileRepo\storeBatch(), DatabaseMssql\tableExists(), ParserTestTopLevelSuite\tearDown(), ParserTestRunner\teardownDatabase(), GlobalTest\testDebugFunctionTest(), ApiUploadTest\testUploadChunks(), WikiImporter\throwXmlError(), SVGReader\throwXmlError(), MediaWiki\Tidy\RaggettBase\tidy(), File\transform(), BitmapHandler\transformCustom(), BitmapHandler\transformGd(), BitmapHandler\transformImageMagick(), BitmapHandler\transformImageMagickExt(), LocalisationCacheBulkLoad\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(), SvgHandler\validateParam(), ImageHandler\validateThumbParams(), UploadBase\verifyExtension(), UploadBase\verifyFile(), UploadBase\verifyMimeType(), Article\view(), WikiImporter\warn(), and wfGzipHandler().
wfDebugBacktrace | ( | $limit = 0 | ) |
Safety wrapper for debug_backtrace().
Will return an empty array if debug_backtrace is disabled, otherwise the output from debug_backtrace() (trimmed).
int | $limit | This parameter can be used to limit the number of stack frames returned |
Definition at line 1508 of file GlobalFunctions.php.
Referenced by MWDebug\getCallerDescription().
wfDebugLog | ( | $logGroup, | |
$text, | |||
$dest = 'all' , |
|||
array | $context = [] |
||
) |
Send a line to a supplementary debug log file, if configured, or main debug log if not.
To configure a supplementary log file, set $wgDebugLogGroups[$logGroup] to a string filename or an associative array mapping 'destination' to the desired filename. The associative array may also contain a 'sample' key with an integer value, specifying a sampling factor. Sampled log events will be emitted with a 1 in N random chance.
string | $logGroup | |
string | $text | |
string | bool | $dest | Destination of the message:
|
array | $context | Additional logging context data |
Definition at line 1090 of file GlobalFunctions.php.
Referenced by GitInfo\__construct(), LocalisationCache\__construct(), MediaWikiPHPUnitTestListener\addError(), MediaWikiPHPUnitTestListener\addFailure(), MediaWikiPHPUnitTestListener\addIncompleteTest(), MediaWikiPHPUnitTestListener\addSkippedTest(), AutoLoader\autoload(), ExternalStoreDB\batchFetchBlobs(), RCCacheEntryFactory\buildCLink(), RCCacheEntryFactory\buildDiffLink(), ApiMain\checkBotReadOnly(), UploadFromChunks\concatenateChunks(), IPTC\convIPTCHelper(), ParserTestTopLevelSuite\debug(), Exif\debug(), Exif\debugFile(), SectionProfiler\debugGroup(), WebPHandler\decodeLosslessChunkHeader(), WebPHandler\decodeLossyChunkHeader(), JobQueueRedis\doAck(), JobQueueRedis\doBatchPush(), FileBackendMultiWrite\doOperationsInternal(), JobQueueRedis\doPop(), TransformationalImageHandler\doTransform(), DjVuHandler\doTransform(), SvgHandler\doTransform(), MediaWikiPHPUnitTestListener\endTest(), MediaWikiPHPUnitTestListener\endTestSuite(), CheckUsernames\execute(), LocalFileMoveBatch\execute(), WebPHandler\extractMetadata(), WebPHandler\extractMetadataFromChunks(), Message\extractParam(), PoolWorkArticleView\fallback(), ExternalStoreDB\fetchBlob(), Revision\fetchText(), DifferenceEngine\generateTextDiffBody(), ParserCache\get(), IPTC\getCharset(), LocalisationCache\getCompiledPluralRules(), ResourceLoaderWikiModule\getContent(), ContentHandler\getContentText(), ContentHandler\getForModelID(), ResourceLoaderImage\getImageData(), ParserCache\getKey(), RequestContext\getLanguage(), LocalFileMoveBatch\getMoveTriplets(), MessageCache\getMsgFromNamespace(), ResourceLoaderFileModule\getTemplates(), RequestContext\getTitle(), CdnCacheUpdate\HTCPPurge(), User\inDnsBlacklist(), ExternalStore\insertWithFallback(), EditPage\internalAttemptSave(), User\isCreatableName(), MessageCache\load(), MessageCache\loadFromDB(), SquidPurgeClient\log(), PoolCounterWork\logError(), MediaHandler\logErrorForExternalProcess(), JobQueueFederated\logException(), ApiBase\logFeatureUsage(), ApiMain\logRequest(), MediaWiki\main(), ApiMain\matchRequestedHeaders(), LocalFile\move(), MediaWiki\Site\MediaWikiPageNameNormalizer\normalizePageName(), IPTC\parse(), Parser\parse(), MessageCache\parse(), User\pingLimiter(), GitInfo\precomputeValues(), MediaWiki\preOutputCommit(), CdnCacheUpdate\purge(), ResourceLoaderFileModule\readStyleFile(), UploadFromUrl\reallyFetchFile(), MediaHandler\removeBadFile(), LocalFileMoveBatch\removeNonexistentFiles(), FileBackendMultiWrite\resyncFiles(), SquidPurgeClientPool\run(), ResourceLoaderModule\saveFileDependencies(), UploadFromUrl\saveTempFileChunk(), MWDebug\sendMessage(), WebResponse\setCookie(), MediaWikiPHPUnitTestListener\startTest(), MediaWikiPHPUnitTestListener\startTestSuite(), and IPTC\timeHelper().
wfDebugMem | ( | $exact = false | ) |
Send a line giving PHP memory usage.
bool | $exact | Print exact byte values instead of kibibytes (default: false) |
Definition at line 1055 of file GlobalFunctions.php.
Referenced by GlobalTest\testDebugFunctionTest().
Throws a warning that $function is deprecated.
string | $function | |
string | bool | $version | Version of MediaWiki that the function was deprecated in (Added in 1.19). |
string | bool | $component | Added in 1.19. |
int | $callerOffset | How far up the call stack is the original caller. 2 = function that called the function that called wfDeprecated (Added in 1.20) |
Definition at line 1126 of file GlobalFunctions.php.
Referenced by RevisiondeleteAction\__construct(), MailAddress\__construct(), StripState\__construct(), WikiImporter\__construct(), Block\__construct(), ApiResult\__construct(), OutputPage\__construct(), ImageGallery\__construct(), LoginForm\__construct(), DeprecatedGlobal\_newObject(), OutputPage\addExtensionStyle(), ApiQueryLogEvents\addLogParams(), OutputPage\addParserOutputNoText(), WatchedItem\addWatch(), MediaWiki\Session\SessionManager\autoCreateUser(), Job\batchInsert(), WebRequest\checkSessionCookie(), User\clearCookie(), LoginForm\clearCreateaccountToken(), LoginForm\clearLoginThrottle(), LoginForm\clearLoginToken(), User\comparePasswords(), User\createNew(), User\crypt(), WikiPage\doEdit(), Article\doEdit(), WatchedItem\duplicateEntries(), User\edits(), Parser\extractTagsAndParams(), Article\fetchContent(), Title\fixUrlQueryArgs(), DummyLinker\formatSize(), Linker\formatSize(), DummyLinker\formatTemplates(), Linker\formatTemplates(), WatchedItem\fromUserTitle(), WikiPage\getAutosummary(), Article\getContent(), LoginForm\getCreateaccountToken(), User\getEditTokenTimestamp(), HTMLForm\getErrors(), OutputPage\getExtStyle(), LoginSignupSpecialPage\getFakeTemplate(), OutputPage\getHeadLinks(), DummyLinker\getInternalLinkAttributes(), Linker\getInternalLinkAttributes(), DummyLinker\getInternalLinkAttributesObj(), Linker\getInternalLinkAttributesObj(), DummyLinker\getInterwikiLinkAttributes(), Linker\getInterwikiLinkAttributes(), ApiPageSet\getInvalidTitles(), JsonContent\getJsonData(), MWLBFactory\getLBFactoryClass(), Linker\getLinkAttributesInternal(), DummyLinker\getLinkColour(), Linker\getLinkColour(), SpecialPageFactory\getList(), MWExceptionHandler\getLogId(), LoginForm\getLoginToken(), ApiBase\getModuleProfileName(), SearchEngine\getOpenSearchTemplate(), SpecialPageFactory\getPage(), User\getPasswordFactory(), ApiBase\getProfileDBTime(), ApiBase\getProfileTime(), Parser\getRandomString(), Revision\getRawComment(), Revision\getRawUser(), Revision\getRawUserText(), Database\getSearchEngine(), WikiRevision\getText(), WikiPage\getText(), Revision\getText(), Article\getText(), Title\getTitleInvalidRegex(), ArchivedFile\getUserText(), MediaWikiTestCase\hideDeprecated(), LoginForm\incLoginThrottle(), LoginForm\incrementLoginThrottle(), VFormHTMLForm\isVForm(), HTMLForm\isVForm(), WatchedItem\isWatched(), Linker\link(), ChangeTags\listExtensionActivatedTags(), ChangeTags\listExtensionDefinedTags(), Title\moveNoAuth(), Article\onArticleCreate(), Article\onArticleDelete(), Article\onArticleEdit(), SkinTemplate\outputPage(), WikiPage\prepareTextForEdit(), ApiBase\profileDBIn(), ApiBase\profileDBOut(), OutputPage\rateLimited(), ResourceLoaderFileModule\readStyleFiles(), WatchedItem\removeWatch(), MagicWord\replaceMultiple(), Parser\replaceUnusualEscapes(), Hooks\run(), ApiBase\safeProfileOut(), Article\selectFields(), User\setCookie(), LoginForm\setCreateaccountToken(), User\setExtendedLoginCookie(), LoginForm\setLoginToken(), Skin\showIPinHeader(), UploadBase\stashFileGetKey(), UploadBase\stashSession(), DifferenceEngine\textDiff(), Parser\uniqPrefix(), SiteStats\views(), wfExtractThumbParams(), OutputPage\wrapWikiMsg(), and MediaWiki\Session\PHPSessionHandler\write().
wfDiff | ( | $before, | |
$after, | |||
$params = '-u' |
|||
) |
Returns unified plain-text diff of two texts.
"Useful" for machine processing of diffs.
string | $before | The text before the changes. |
string | $after | The text after the changes. |
string | $params | Command-line options for the diff command. |
Definition at line 2678 of file GlobalFunctions.php.
Referenced by ParserDiffTest\__call(), CompareParserCache\execute(), and CompareParsers\processRevision().
wfErrorLog | ( | $text, | |
$file, | |||
array | $context = [] |
||
) |
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.
string | $text | |
string | $file | Filename |
array | $context | Additional logging context data |
MWException |
Definition at line 1170 of file GlobalFunctions.php.
wfEscapeShellArg | ( | ) |
Version of escapeshellarg() that works better on Windows.
Originally, this fixed the incorrect use of single quotes on Windows (https://bugs.php.net/bug.php?id=26285) and the locale problems on Linux in PHP 5.2.6+ (bug backported to earlier distro releases of PHP).
string | ... strings to escape and glue together, or a single array of strings parameter |
Definition at line 2208 of file GlobalFunctions.php.
Referenced by DumpPipeOutput\__construct(), MimeMagic\applyDefaultParameters(), CheckSyntax\checkFileWithCli(), DumpPipeOutput\closeAndRename(), UploadBase\detectVirus(), PopulateImageSha1\doDBUpdates(), DjVuHandler\doTransform(), HHVMMakeRepo\execute(), CheckSyntax\getGitModifiedFiles(), GitInfo\getHeadCommitDate(), TransformationalImageHandler\getMagickVersion(), Installer\locateExecutable(), ParserTestPrinter\quickDiff(), SvgHandler\rasterize(), ResourceLoaderImage\rasterize(), Maintenance\readlineEmulation(), CheckStorage\restoreText(), DjVuImage\retrieveMetaData(), JpegHandler\rotate(), BitmapHandler\rotate(), Dump7ZipOutput\setup7zCommand(), RecompressTracked\startReplicaProcs(), SevenZipStream\stream_open(), ExifBitmapHandler\swapICCProfile(), WfEscapeShellArgTest\testMultipleArgs(), WfEscapeShellArgTest\testMultipleArgsAsArray(), WfEscapeShellArgTest\testSingleInput(), DifferenceEngine\textDiff(), BitmapHandler\transformCustom(), 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.
string | $text | Text to be escaped |
Definition at line 1667 of file GlobalFunctions.php.
Referenced by MediaHandler\addMeta(), CoreParserFunctions\basepagename(), CoreParserFunctions\basepagenamee(), Parser\braceSubstitution(), SpecialContributions\contributionsSub(), CoreParserFunctions\defaultsort(), Article\delete(), CoreParserFunctions\displaytitle(), FileDeleteForm\doDelete(), Article\doDelete(), WikiPage\doDeleteArticleReal(), SpecialUnblock\execute(), FileDuplicateSearchPage\execute(), SpecialMergeHistory\execute(), PasswordReset\execute(), CoreParserFunctions\fullpagename(), CoreParserFunctions\fullpagenamee(), CategoryViewer\getImageSection(), CategoryViewer\getPagesSection(), Parser\getUserSig(), Parser\getVariableValue(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\makeFailResponse(), SpecialBlock\maybeAlterFormDefaults(), PPFrame_Hash\newChild(), PPFrame_DOM\newChild(), SpecialRandomInCategory\onSubmit(), SpecialBlock\onSuccess(), ImagePage\openShowImage(), ImageListPager\outputUserDoesNotExist(), CoreParserFunctions\pagename(), CoreParserFunctions\pagenamee(), SpecialBlock\postText(), FileDeleteForm\prepareMessage(), CoreParserFunctions\rootpagename(), CoreParserFunctions\rootpagenamee(), ProtectionForm\show(), SpecialSearch\showCreateLink(), UserrightsPage\showEditUserGroupsForm(), SpecialUndelete\showHistory(), EditPage\showIntro(), Article\showMissingArticle(), SpecialSearch\showResults(), LoginSignupSpecialPage\showSuccessPage(), EditPage\spamPageWithContent(), CoreParserFunctions\subjectpagename(), CoreParserFunctions\subjectpagenamee(), CoreParserFunctions\subpagename(), CoreParserFunctions\subpagenamee(), CoreParserFunctions\talkpagename(), CoreParserFunctions\talkpagenamee(), and SpecialBlock\validateTarget().
wfExpandIRI | ( | $url | ) |
Take a URL, make sure it's expanded to fully qualified, and replace any encoded non-ASCII Unicode characters with their UTF-8 original forms for more compact display and legibility for local audiences.
string | $url |
Definition at line 886 of file GlobalFunctions.php.
Referenced by Skin\printSource(), and GlobalTest\testExpandIRI().
wfExpandIRI_callback | ( | $matches | ) |
Private callback for wfExpandIRI.
array | $matches |
Definition at line 899 of file GlobalFunctions.php.
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
string | $url | Either fully-qualified or a local path + query |
string | $defaultProto | One of the PROTO_* constants. Determines the protocol to use if $url or $wgServer is protocol-relative |
Definition at line 550 of file GlobalFunctions.php.
Referenced by MWHttpRequest\__construct(), ApiQuerySiteinfo\appendGeneralInfo(), ApiQuerySiteinfo\appendInterwikiMap(), ApiQuerySiteinfo\appendRightsInfo(), EmailNotification\composeCommonMailtext(), SpecialApiHelp\execute(), ApiQueryLangLinks\execute(), ApiQueryExternalLinks\execute(), ApiQueryIWLinks\execute(), CdnCacheUpdate\expand(), ApiQueryInfo\extractPageInfo(), CoreParserFunctions\filepath(), ApiParse\formatIWLinks(), ApiParse\formatLangLinks(), File\getCanonicalUrl(), Title\getCanonicalURL(), SpecialVersion\getEntryPointInfo(), RevertAction\getFormFields(), WebRequest\getFullRequestURL(), File\getFullUrl(), Title\getFullURL(), OutputPage\getHeadLinksArray(), ApiQueryImageInfo\getInfo(), LocalRepo\getInfo(), Title\getInternalURL(), ApiRsd\getRsdApiList(), FeedItem\getUniqueId(), ForeignAPIRepo\httpGet(), MediaWiki\main(), RevertAction\onSuccess(), RSSFeed\outHeader(), RSSFeed\outItem(), OutputPage\output(), SpecialUploadStash\outputRemoteScaledThumb(), MediaWiki\performAction(), FileDeleteForm\prepareMessage(), CSSMin\remapOne(), ApiQueryExtLinksUsage\run(), ApiOpenSearch\search(), SearchSuggestion\setSuggestedTitle(), EditPage\showIntro(), ApiMain\substituteResultWithError(), SpecialSearchText\testSubPageRedirect(), WfExpandUrlTest\testWfExpandUrl(), File\transform(), MediaWiki\tryNormaliseRedirect(), and wfStreamThumb().
wfFindFile | ( | $title, | |
$options = [] |
|||
) |
Find a file.
Shortcut for RepoGroup::singleton()->findFile()
string | $title | String or Title object |
array | $options | Associative array of options (see RepoGroup::findFile) |
Definition at line 3114 of file GlobalFunctions.php.
Referenced by UploadFromUrlTest\deleteFile(), ApiTestCaseUpload\deleteFileByTitle(), SpecialRedirect\dispatchFile(), MovePageForm\doSubmit(), ApiImageRotate\execute(), ApiMove\execute(), DeleteBatch\execute(), FileDuplicateSearchPage\execute(), WantedFilesPage\existenceCheck(), Parser\fetchFileNoRegister(), CoreParserFunctions\filepath(), SearchNearMatcher\getNearMatchInternal(), SearchResult\initFromTitle(), Title\isAlwaysKnown(), WikiFilePage\loadFile(), ImagePage\loadFile(), Linker\makeBrokenImageLinkObj(), Linker\makeMediaLinkObj(), Linker\makeThumbLink2(), UploadDumper\outputItem(), SpecialSearch\showHit(), EditPage\showIntro(), TraditionalImageGallery\toHTML(), and Title\validateFileMoveOperation().
wfFixSessionID | ( | ) |
Definition at line 2898 of file GlobalFunctions.php.
wfForeignMemcKey | ( | $db, | |
$prefix | |||
) |
Make a cache key for a foreign DB.
Must match what wfMemcKey() would produce in context of the foreign wiki.
string | $db | |
string | $prefix | |
string | $args,... |
Definition at line 2991 of file GlobalFunctions.php.
Referenced by JobQueueDB\getCacheKey(), JobQueue\getRootJobCacheKey(), and GlobalTest\testWfForeignMemcKey().
wfFormatStackFrame | ( | $frame | ) |
Return a string representation of frame.
array | $frame |
Definition at line 1604 of file GlobalFunctions.php.
wfGetAllCallers | ( | $limit = 3 | ) |
Return a string consisting of callers in the stack.
Useful sometimes for profiling specific points.
int | $limit | The maximum depth of the stack frame to return, or false for the entire stack. |
Definition at line 1589 of file GlobalFunctions.php.
Referenced by MediaWiki\Session\SessionBackend\addData(), MediaWiki\Session\SessionBackend\dirty(), RequestContext\getTitle(), MessageCache\parse(), ApiBase\parseMsg(), OutputPage\parserOptions(), and MediaWiki\Session\SessionBackend\renew().
wfGetCache | ( | $cacheType | ) |
Get a specific cache object.
int | string | $cacheType | A CACHE_* constants, or other key in $wgObjectCaches |
Definition at line 3411 of file GlobalFunctions.php.
Referenced by JobQueue\__construct(), MessageCache\__construct(), SpecialVersion\getCreditsForExtension(), CacheHelper\initCaching(), ForkController\initChild(), and CacheHelper\saveCache().
wfGetCaller | ( | $level = 2 | ) |
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfGetCaller() call (ie.
FUNCTION) wfGetCaller( 2 ) [default] is the caller of the function running wfGetCaller() wfGetCaller( 3 ) is the parent of that.
int | $level |
Definition at line 1573 of file GlobalFunctions.php.
Referenced by StubObject\_unstub(), DeferredUpdates\addCallableUpdate(), MediaWikiTestCase\assertSelect(), WfGetCallerTest\callerOne(), ParserTestRunner\checkSetupDone(), ParserTestTopLevelSuite\debug(), WfGetCallerTest\intermediateFunction(), MWDebug\log(), and WfGetCallerTest\testZero().
wfGetDB | ( | $db, | |
$groups = [] , |
|||
$wiki = false |
|||
) |
Get a Database object.
int | $db | Index of the connection to get. May be DB_MASTER for the master (for write queries), DB_REPLICA for potentially lagged read queries, or an integer >= 0 for a particular server. |
string|string[] | $groups 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. | |
string | bool | $wiki | The wiki ID, or false for the current wiki |
Note: multiple calls to wfGetDB(DB_REPLICA) 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 3073 of file GlobalFunctions.php.
Referenced by SpecialRandomrootpage\__construct(), MergeHistoryPager\__construct(), DeletedContribsPager\__construct(), SearchDatabase\__construct(), ContribsPager\__construct(), ImageListPager\__construct(), LogPager\__construct(), MergeHistory\__construct(), Block\__construct(), IndexPager\__construct(), SiteStatsInit\__construct(), Pingback\acquireLock(), OutputPage\addCategoryLinks(), BotPasswordTest\addDBData(), MediaWiki\Session\BotPasswordSessionProviderTest\addDBDataOnce(), User\addGroup(), LinkCache\addLinkObj(), LogPage\addRelations(), User\addToDatabase(), MediaWikiTestCase\assertSelect(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProvider\beginSecondaryAccountCreation(), ImageListPager\buildQueryConds(), SiteStatsUpdate\cacheUpdate(), UserOptions\CHANGER(), CheckStorage\check(), User\checkAndSetTouched(), Pingback\checkIfSent(), TrackBlobs\checkIntegrity(), User\checkNewtalk(), RevisionDeleter\checkRevisionExistence(), RecompressTracked\checkTrackingTable(), User\clearAllNotifications(), User\clearSharedCache(), SpecialEditWatchlist\clearWatchlist(), CgzCopyTransaction\commit(), WikiPage\commitRollback(), Title\countRevisionsBetween(), SearchEngineFactory\create(), User\createNew(), Block\defaultRetroactiveAutoblock(), PrefixSearch\defaultSearchBackend(), ChangeTags\defineTag(), SearchMySQL\delete(), Block\delete(), Article\delete(), DifferenceEngine\deletedLink(), User\deleteNewtalk(), ChangeTags\deleteTagEverywhere(), Title\deleteTitleProtection(), SpecialUndelete\diffHeader(), SpecialRedirect\dispatchLog(), SiteStatsInit\doAllAndCommit(), RecompressTracked\doAllOrphans(), RecompressTracked\doAllPages(), UsersPager\doBatchLookups(), CategoryViewer\doCategoryQuery(), WikiPage\doCreate(), FileDeleteForm\doDelete(), WikiPage\doDeleteArticleReal(), SpecialExport\doExport(), SpecialRecentChangesLinked\doMainQuery(), WikiPage\doModify(), RecompressTracked\doOrphanList(), RecompressTracked\doPage(), UserCache\doQuery(), GenderCache\doQuery(), LinkBatch\doQuery(), MovePageForm\doSubmit(), WikiPage\doUpdateRestrictions(), LinkHolderArray\doVariants(), Title\estimateRevisionCount(), ApiSetNotificationTimestamp\execute(), SpecialActiveUsers\execute(), ParserTestsMaintenance\execute(), QueryPage\fetchFromCache(), Revision\fetchRevision(), HistoryAction\fetchRevisions(), Parser\fetchScaryTemplateMaybeFromCache(), Revision\fetchText(), TrackBlobs\findOrphanBlobs(), User\findUsersByGroup(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\finishAccountCreation(), RecompressTracked\finishIncompleteMoves(), DoubleRedirectJob\fixRedirects(), EditPageTest\forceRevisionDate(), ApiEditPageTest\forceRevisionDate(), Language\formatExpiry(), DoubleRedirectsPage\formatResult(), LCStoreDB\get(), MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixesDB(), PageProps\getAllProperties(), Title\getAuthorsBetween(), ContentHandler\getAutoDeleteReason(), EditPage\getBaseRevision(), SpecialBlockList\getBlockListPager(), Block\getBlocksForIPList(), Title\getBrokenLinksFrom(), QueryPage\getCachedTimestamp(), Title\getCascadeProtectionSources(), WikiPage\getCategories(), WikiPage\getContributors(), RevDelRevisionList\getCurrent(), AllMessagesTablePager\getCustomisedStatuses(), Block\getDatabaseArray(), ResourceLoaderWikiModule\getDB(), BacklinkCache\getDB(), UserRightsProxy\getDB(), SqlBagOStuff\getDB(), LinksDeletionUpdate\getDB(), SpecialRecentChanges\getDB(), SpecialWatchlist\getDB(), ChangesListSpecialPage\getDB(), ApiBase\getDB(), LinksUpdate\getDB(), Maintenance\getDB(), LocalRepo\getDBFactory(), User\getEditCount(), ResourceLoaderModule\getFileDependencies(), DoubleRedirectJob\getFinalDestination(), User\getFirstEditTimestamp(), Title\getFirstRevision(), User\getFormerGroups(), WikiPage\getHiddenCategories(), EditPage\getLastDelete(), PageArchive\getLastRevisionText(), SpecialExport\getLinks(), Title\getLinksFrom(), Title\getLinksTo(), DifferenceEngine\getMarkPatrolledLinkInfo(), LocalRepo\getMasterDB(), Category\getMembers(), SpecialRandomInCategory\getMinAndMaxForCat(), MessageCache\getMsgFromNamespace(), ApiQuery\getNamedDB(), User\getNewMessageLinks(), Title\getNextRevisionID(), WikiPage\getOldestRevision(), Pingback\getOrCreatePingbackId(), SpecialExport\getPagesFromCategory(), SpecialExport\getPagesFromNamespace(), Title\getParentCategories(), PageArchive\getPreviousRevision(), Title\getPreviousRevisionID(), PageProps\getProperties(), NewFilesPager\getQueryInfo(), BrokenRedirectsPage\getQueryInfo(), MediaStatisticsPage\getQueryInfo(), WithoutInterwikiPage\getQueryInfo(), UsersPager\getQueryInfo(), LinkSearchPage\getQueryInfo(), SpecialRandomInCategory\getQueryInfo(), ImageListPager\getQueryInfoReal(), Block\getRangeCond(), QueryPage\getRecacheDB(), Revision\getRecentChange(), Title\getRedirectsHere(), WikiPage\getRedirectTarget(), PageArchive\getRevision(), OutputPage\getRlClient(), Linker\getRollbackEditCount(), LocalRepo\getSlaveDB(), Title\getSubpages(), HistoryBlobStub\getText(), HistoryBlobCurStub\getText(), TrackBlobs\getTextClause(), PageArchive\getTextFromRow(), Revision\getTimestampFromId(), Title\getTitleProtection(), Title\getTouched(), PasswordReset\getUsersByEmail(), User\idForName(), User\idFromName(), WikiRevision\importLogItem(), WikiRevision\importOldRevision(), CheckStorage\importRevision(), User\incEditCount(), User\incEditCountImmediate(), User\initEditCount(), Block\initFromRow(), Category\initialize(), BackupDumper\initProgress(), TrackBlobs\initTrackingTable(), Block\insert(), ManualLogEntry\insert(), WikiPage\insertProtectNullRevision(), WikiPage\insertRedirect(), WikiPage\insertRedirectEntry(), Title\invalidateCache(), HTMLCacheUpdateJob\invalidateTitles(), Title\isBigDeletion(), WikiPage\isCountable(), PageArchive\isDeleted(), Title\isDeleted(), Title\isDeletedQuick(), Title\isNewPage(), Title\isSingleRevRedirect(), Block\isWhitelistedFromAutoblocks(), ApiStashEdit\lastEditTime(), PageArchive\listAllPages(), ChangeTags\listExplicitlyDefinedTags(), PageArchive\listFiles(), PageArchive\listPagesByPrefix(), PageArchive\listRevisions(), ChangeTags\listSoftwareActivatedTags(), ChangeTags\listSoftwareDefinedTags(), SiteStats\load(), ArchivedFile\load(), MediaWiki\Interwiki\ClassicInterwikiLookup\load(), SiteStats\loadAndLazyInit(), User\loadFromCache(), User\loadFromDatabase(), MessageCache\loadFromDB(), User\loadGroups(), WikiPage\loadLastEdit(), User\loadOptions(), WikiPage\loadPageData(), Title\loadRestrictions(), Title\loadRestrictionsFromRows(), DifferenceEngine\loadRevisionData(), WikiPage\lockAndGetLatest(), ProfilerOutputDb\log(), ChangeTags\logTagManagementAction(), LocalIdLookup\lookupCentralIds(), LocalIdLookup\lookupUserNames(), LinkFilter\makeLikeArray(), RevisionStorageTest\makeRevision(), Pingback\markSent(), EditPage\mergeChangesIntoContent(), SearchMySQL\minSearchLength(), ChangeTags\modifyDisplayQuery(), MovePage\move(), RecompressTracked\moveTextRow(), moveToExternal(), MovePage\moveToInternal(), LinkSearchPage\mungeQuery(), Title\nameOf(), RecentChange\newFromConds(), Revision\newFromConds(), User\newFromConfirmationCode(), WikiPage\newFromID(), Block\newFromID(), Title\newFromID(), UserArray\newFromIDs(), Title\newFromIDs(), UserArray\newFromNames(), Revision\newFromPageId(), Revision\newFromTitle(), Block\newLoad(), User\newSystemUser(), RecentChange\notifyEdit(), RecentChange\notifyNew(), SiteStats\numberingroup(), SpecialPageLanguage\onSubmit(), InfoAction\pageCounts(), SiteStats\pagesInNs(), ApiStashEdit\parseAndStash(), ClassicInterwikiLookupTest\populateDB(), InterwikiTest\populateDB(), ResourceLoader\preloadModuleInfo(), WikiPage\prepareContentForEdit(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\providerChangeAuthenticationData(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\providerChangeAuthenticationData(), ManualLogEntry\publish(), Block\purgeExpired(), Title\purgeExpiredRestrictions(), RecentChangesUpdateJob\purgeExpiredRows(), SpecialPagesWithProp\queryExistingProps(), ImagePage\queryImageLinks(), DoubleRedirectsPage\reallyGetQueryInfo(), RecentChange\reallyMarkPatrolled(), RebuildRecentchanges\rebuildRecentChangesTablePass5(), QueryPage\recache(), MessageBlobStore\recacheMessageBlob(), SiteStatsInit\refresh(), Category\refreshCounts(), ChangeTagsList\reloadFromMaster(), RevDelList\reloadFromMaster(), User\removeGroup(), LinkHolderArray\replaceInternal(), WikiPage\replaceSectionContent(), ImportReporter\reportPage(), RevisionListBase\reset(), resolveStub(), resolveStubs(), CheckStorage\restoreText(), DeleteLinksJob\run(), CategoryFinder\run(), MediaWikiTestCase\run(), RecentChange\save(), LogPage\saveContent(), ResourceLoaderModule\saveFileDependencies(), User\saveOptions(), User\saveSettings(), UserNamePrefixSearch\search(), RandomPage\selectRandomPageFromDB(), SpecialRandomInCategory\selectRandomPageFromDB(), RevDelArchivedRevisionItem\setBits(), RevDelArchiveItem\setBits(), RevDelLogItem\setBits(), RevDelArchivedFileItem\setBits(), RevDelRevisionItem\setBits(), RevDelFileItem\setBits(), TestUser\setPasswordForUser(), TestPageProps\setProperties(), WikiPageTestContentHandlerUseDB\setUp(), RevisionTestContentHandlerUseDB\setUp(), DatabaseTest\setUp(), LinksUpdateTest\setUp(), ParserTestTopLevelSuite\setUp(), ParserTestRunner\setupDatabase(), RevisionDeleteUser\setUsernameBitfields(), RevDelList\setVisibility(), SpecialAllPages\showChunk(), MovePageForm\showForm(), SpecialWhatLinksHere\showIndirectLinks(), LogEventsList\showLogExtract(), Article\showPatrolFooter(), SpecialPrefixindex\showPrefixChunk(), SpecialVersion\softwareInformation(), LCStoreDB\startWrite(), Parser\statelessFetchRevision(), RevDelLogList\suggestTarget(), RecompressTracked\syncDBs(), ChangeTags\tagUsageStatistics(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAccountCreation(), MediaWiki\Auth\AuthManagerTest\testAccountCreation(), MediaWiki\Auth\AuthManagerTest\testAccountCreationLogging(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), ApiLoginTest\testBotPassword(), RevisionStorageTest\testConstructFromRow(), EditPageTest\testCreatePageTrx(), WikiPageTest\testDoDeleteArticle(), WikiPageTest\testDoDeleteUpdates(), WikiPageTest\testDoEdit(), WikiPageTest\testDoEditContent(), ReverseChronologicalPagerTest\testGetDateCond(), BotPasswordTest\testGetPassword(), ResourceLoaderWikiModuleTest\testGetPreloadedTitleInfo(), RevisionStorageTest\testNewFromArchiveRow(), MediaWiki\Session\UserInfoTest\testNewFromId(), RevisionStorageTest\testNewFromRow(), RevisionStorageTest\testNewNullRevision(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationDataEmail(), MultiWriteBagOStuffTest\testSetDelayed(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), DatabaseTest\testStoredFunctions(), MultiWriteBagOStuffTest\testSyncMerge(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testTestUserCanAuthenticate(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testTestUserCanAuthenticate(), EditPageTest\testUpdatePageTrx(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\testUserCanAuthenticate(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\testUserCanAuthenticate(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\testUserExists(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\testUserExists(), RevisionStorageTest\testUserWasLastToEdit(), TrackBlobs\trackOrphanText(), TrackBlobs\trackRevisions(), SiteStatsUpdate\tryDBUpdateInternal(), ResourceLoader\tryRespondFromFileCache(), ChangeTags\undefineTag(), PageArchive\undeleteRevisions(), SearchOracle\update(), SearchSqlite\update(), SearchMySQL\update(), Block\update(), RecentChangesUpdateJob\updateActiveUsers(), WikiPage\updateCategoryCounts(), User\updateNewtalk(), ChangeTags\updateTags(), ChangeTags\updateTagSummaryRow(), ChangeTags\updateTagsWithChecks(), Block\updateTimestamp(), SearchOracle\updateTitle(), SearchSqlite\updateTitle(), SearchMySQL\updateTitle(), ActivityUpdateJob\updateWatchlistNotification(), UserOptions\USAGER(), Revision\userWasLastToEdit(), and ApiTag\validateLogId().
wfGetLangObj | ( | $langcode = false | ) |
Return a Language object from $langcode.
Language | string | bool | $langcode | Either:
|
Definition at line 1337 of file GlobalFunctions.php.
Referenced by Skin\doEditSectionLink(), SpecialAllMessages\execute(), MessageCache\get(), DateFormatter\getInstance(), CodeContentHandler\getPageLanguage(), ContentHandler\getPageLanguage(), Title\getPageLanguage(), CodeContentHandler\getPageViewLanguage(), Title\getPageViewLanguage(), DifferenceEngine\setTextLanguage(), ContentHandlerTest\testGetPageLanguage(), and Linker\tocList().
wfGetLB | ( | $wiki = false | ) |
Get a load balancer object.
string | bool | $wiki | Wiki ID, or false for the current wiki |
Definition at line 3086 of file GlobalFunctions.php.
Referenced by SqlDataUpdate\__construct(), ApiQuerySiteinfo\appendDbReplLagInfo(), MediaWiki\Auth\AuthManager\autoCreateUser(), ApiMain\checkBotReadOnly(), ApiMain\checkMaxLag(), ApiMain\checkReadOnly(), MysqlUpdater\doTemplatelinksUpdate(), SpecialContributions\execute(), GetLagTimes\execute(), GetSlaveServer\execute(), DatabaseLag\execute(), InitEditCount\execute(), DeletedContributionsPage\execute(), UpdateSpecialPages\execute(), MwSql\execute(), DBAccessBase\getConnection(), BotPassword\getDB(), ForeignDBViaLBRepo\getDBFactory(), DBAccessBase\getLoadBalancer(), ForeignDBViaLBRepo\getMasterDB(), ForeignDBViaLBRepo\getSlaveDB(), Revision\getTitle(), Skin\lastModified(), User\load(), Revision\loadMutableFields(), WikiPage\loadPageData(), DBSiteStoreTest\newDBSiteStore(), Revision\newFromConds(), SpecialWatchlist\outputChangesList(), WikiPage\replaceSectionContent(), and ParserTestRunner\setupDatabase().
wfGetLBFactory | ( | ) |
Get the load balancer factory object.
Definition at line 3102 of file GlobalFunctions.php.
Referenced by BackupDumper\backupDb(), FileDeleteForm\doDelete(), SpecialExport\doExport(), MysqlUpdater\doTemplatelinksUpdate(), MwSql\execute(), ParserTestsMaintenance\execute(), TrackBlobs\findOrphanBlobs(), OrphanStats\getDB(), BotPassword\getDB(), RecompressTracked\getExtDB(), ExternalStoreDB\getLoadBalancer(), DBFileJournal\getMasterDB(), HTMLCacheUpdateJob\invalidateTitles(), AjaxDispatcher\performAction(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), RebuildRecentchanges\rebuildRecentChangesTablePass2(), RebuildRecentchanges\rebuildRecentChangesTablePass3(), RebuildRecentchanges\rebuildRecentChangesTablePass4(), RebuildRecentchanges\rebuildRecentChangesTablePass5(), TextPassDumper\rotateDb(), RevDelList\setVisibility(), DeferredUpdatesTest\testDoUpdatesCLI(), and WatchedItemStore\updateNotificationTimestamp().
wfGetMainCache | ( | ) |
Get the main cache object.
Definition at line 3420 of file GlobalFunctions.php.
Referenced by UploadFromUrlTestSuite\setUp(), CachingSiteStoreTest\testClear(), CachingSiteStoreTest\testGetSites(), CachingSiteStoreTest\testReset(), and CachingSiteStoreTest\testSaveSites().
wfGetMessageCacheStorage | ( | ) |
Get the cache object used by the message cache.
Definition at line 3430 of file GlobalFunctions.php.
Referenced by UploadFromUrlTestSuite\setUp(), and MessageCache\singleton().
wfGetNull | ( | ) |
Get a platform-independent path to the null file, e.g.
/dev/null
Definition at line 3201 of file GlobalFunctions.php.
Referenced by MediaWiki\Tidy\RaggettExternal\cleanWrapped(), and Dump7ZipOutput\setup7zCommand().
wfGetParserCacheStorage | ( | ) |
Get the cache object used by the parser cache.
Definition at line 3440 of file GlobalFunctions.php.
Referenced by PurgeParserCache\execute(), and UploadFromUrlTestSuite\setUp().
wfGetPrecompiledData | ( | $name | ) |
Get an object from the precompiled serialized directory.
string | $name |
Definition at line 2955 of file GlobalFunctions.php.
Referenced by IcuCollation\fetchFirstLetterData(), and Language\transformUsingPairFile().
wfGetScriptUrl | ( | ) |
wfGlobalCacheKey | ( | ) |
Make a cache key with database-agnostic prefix.
Doesn't have a wiki-specific namespace. Uses a generic 'global' prefix instead. Must have a prefix as otherwise keys that use a database name in the first segment will clash with wfMemcKey/wfForeignMemcKey.
string | $args,... |
Definition at line 3011 of file GlobalFunctions.php.
Referenced by MediaWiki\Auth\Throttler\clear(), MediaWiki\Auth\Throttler\increase(), and GlobalTest\testWfGlobalCacheKey().
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 1447 of file GlobalFunctions.php.
Referenced by MediaWiki\Logger\Monolog\WikiProcessor\__invoke(), MWLBFactory\applyDefaultConfig(), DifferenceEngine\debug(), TransformationalImageHandler\doTransform(), DjVuHandler\doTransform(), SvgHandler\doTransform(), MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(), MediaWiki\Logger\LegacyLogger\formatAsWfLogDBError(), ProfilerOutputDb\log(), MediaHandler\logErrorForExternalProcess(), RecompressTracked\logToFile(), Parser\parse(), Maintenance\setAgentAndTriggers(), ApiMain\setupExecuteAction(), ApiMain\substituteResultWithError(), and wfThumbError().
wfHttpError | ( | $code, | |
$label, | |||
$desc | |||
) |
Provide a simple HTTP error.
int | string | $code | |
string | $label | |
string | $desc |
Definition at line 1775 of file GlobalFunctions.php.
Referenced by RawAction\getRawText(), MWExceptionRenderer\output(), AjaxDispatcher\performAction(), and MWException\report().
wfIncrStats | ( | $key, | |
$count = 1 |
|||
) |
Increment a statistics counter.
string | $key | |
int | $count |
Definition at line 1263 of file GlobalFunctions.php.
Referenced by ParserCache\get(), DifferenceEngine\getDiffBody(), ParserCache\getKey(), and WikiPage\getParserOutput().
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
string | $setting |
Definition at line 2189 of file GlobalFunctions.php.
Referenced by MWHttpRequest\canMakeRequests(), Installer\envCheckCache(), MWHttpRequest\factory(), MWHttpRequestTester\factory(), UploadBase\isEnabled(), WebInstaller\startSession(), and MediaWiki\Session\PHPSessionHandlerTest\testInstall().
wfInitShellLocale | ( | ) |
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 2553 of file GlobalFunctions.php.
wfIsBadImage | ( | $name, | |
$contextTitle = false , |
|||
$blacklist = null |
|||
) |
Determine if an image exists on the 'bad image list'.
The format of MediaWiki:Bad_image_list is as follows:
string | $name | The image name to check |
Title | bool | $contextTitle | The page on which the image occurs, if known |
string | $blacklist | Wikitext of a file blacklist |
Definition at line 3509 of file GlobalFunctions.php.
Referenced by GlobalWithDBTest\testWfIsBadImage(), and TraditionalImageGallery\toHTML().
wfIsDebugRawPage | ( | ) |
Returns true if debug logging should be suppressed if $wgDebugRawPage = false.
Definition at line 1031 of file GlobalFunctions.php.
wfIsHHVM | ( | ) |
Check if we are running under HHVM.
Definition at line 2059 of file GlobalFunctions.php.
Referenced by TidySupport\__construct(), Installer\doEnvironmentChecks(), MWDebug\getDebugInfo(), UploadBase\isEnabled(), MWTidy\singleton(), and SpecialVersion\softwareInformation().
wfIsInfinity | ( | $str | ) |
Determine input string is represents as infinity.
string | $str | The string to determine |
Definition at line 3590 of file GlobalFunctions.php.
Referenced by ApiProtect\execute(), ProtectLogFormatter\formatExpiry(), ProtectionForm\getExpiry(), BlockLogFormatter\getParametersForApi(), SpecialBlock\parseExpiryInput(), SpecialBlock\processForm(), and Language\translateBlockExpiry().
wfIsWindows | ( | ) |
Check if the operating system is Windows.
Definition at line 2046 of file GlobalFunctions.php.
Referenced by UIDGenerator\__construct(), Installer\envCheckGit(), Installer\envCheckGraphics(), TransformationalImageHandler\escapeMagickPath(), RebuildLocalisationCache\execute(), ParserTestsMaintenance\execute(), ParserTestPrinter\quickDiff(), Maintenance\readlineEmulation(), UserMailer\sendInternal(), SevenZipStream\stream_open(), WfShellExecTest\testBug67870(), WfEscapeShellArgTest\testMultipleArgs(), WfEscapeShellArgTest\testMultipleArgsAsArray(), MailAddressTest\testNewFromUser(), WfEscapeShellArgTest\testSingleInput(), MailAddressTest\testToString(), StructureTest\testUnitTestFileNamesEndWithTest(), GlobalTest\testWfShellWikiCmd(), MailAddress\toString(), and CLIParser\Wikitext().
wfLoadExtension | ( | $ext, | |
$path = null |
|||
) |
Load an extension.
This queues an extension to be loaded through the ExtensionRegistry system.
string | $ext | Name of the extension to load |
string | null | $path | Absolute path of where to find the extension.json file |
Definition at line 110 of file GlobalFunctions.php.
wfLoadExtensions | ( | array | $exts | ) |
Load multiple extensions at once.
Same as wfLoadExtension, but more efficient if you are loading multiple extensions.
If you want to specify custom paths, you should interact with ExtensionRegistry directly.
string[] | $exts Array of extension names to load |
Definition at line 131 of file GlobalFunctions.php.
wfLoadSkin | ( | $skin, | |
$path = null |
|||
) |
Load a skin.
string | $skin | Name of the extension to load |
string | null | $path | Absolute path of where to find the skin.json file |
Definition at line 147 of file GlobalFunctions.php.
wfLoadSkins | ( | array | $skins | ) |
Load multiple skins at once.
string[] | $skins Array of extension names to load |
Definition at line 162 of file GlobalFunctions.php.
wfLocalFile | ( | $title | ) |
Get an object referring to a locally registered file.
Returns a valid placeholder object if the file does not exist.
Title | string | $title |
Definition at line 3125 of file GlobalFunctions.php.
Referenced by ImageBuilder\addMissingImage(), PopulateImageSha1\doDBUpdates(), RevDelFileList\doPostCommitUpdates(), MovePageForm\doSubmit(), EraseArchivedFile\execute(), ApiQueryImageInfo\execute(), LocalFileMoveBatch\execute(), ImageListPager\formatValue(), FileContentHandler\getDataForSearchIndex(), UploadBase\getLocalFile(), SpecialUpload\getWatchCheck(), WikiRevision\importUpload(), MovePage\isValidFileMove(), MovePage\isValidMoveTarget(), Title\isValidMoveTarget(), WikiFilePage\loadFile(), ImagePage\loadFile(), MovePage\move(), LocalFile\move(), ThumbnailRenderJob\run(), UploadFromUrlTest\setUp(), ParserTestRunner\setupUploads(), LocalFileTest\testWfLocalFile(), PageArchive\undelete(), Title\validateFileMoveOperation(), wfStreamThumb(), and XmlDumpWriter\writeUploads().
wfLogDBError | ( | $text, | |
array | $context = [] |
||
) |
Log for database errors.
string | $text | Database error message. |
array | $context | Additional logging context data |
Definition at line 1108 of file GlobalFunctions.php.
wfLogProfilingData | ( | ) |
Definition at line 1180 of file GlobalFunctions.php.
Referenced by MediaWikiPHPUnitBootstrap\__destruct(), and MediaWiki\restInPeace().
wfLogWarning | ( | $msg, | |
$callerOffset = 1 , |
|||
$level = E_USER_WARNING |
|||
) |
Send a warning as a PHP error and the debug log.
This is intended for logging warnings in production. For logging development warnings, use WfWarn instead.
string | $msg | Message to send |
int | $callerOffset | Number of items to go back in the backtrace to find the correct caller (1 = function calling wfLogWarning, ...) |
int | $level | PHP error level; defaults to E_USER_WARNING |
Definition at line 1153 of file GlobalFunctions.php.
Referenced by Revision\compressRevisionText(), Revision\decompressRevisionText(), WikiPage\doDeleteArticleReal(), SpecialPageFactory\getPage(), SiteImporter\handleException(), OutputPage\parserOptions(), and OutputPage\transformFilePath().
wfMakeUrlIndexes | ( | $url | ) |
Make URL indexes, appropriate for the el_index field of externallinks.
string | $url |
Definition at line 909 of file GlobalFunctions.php.
Referenced by LinksUpdate\getExternalInsertions(), LinkFilterTest\testMakeLikeArrayWithValidPatterns(), and GlobalTest\testMakeUrlIndexes().
wfMatchesDomainList | ( | $url, | |
$domains | |||
) |
Check whether a given URL has a domain that occurs in a given set of domains.
string | $url | URL |
array | $domains | Array of domains (strings) |
Definition at line 963 of file GlobalFunctions.php.
Referenced by Skin\addToSidebarPlain(), Parser\getExternalLinkRel(), and GlobalTest\testWfMatchesDomainList().
wfMemcKey | ( | ) |
Make a cache key for the local wiki.
string | $args,... |
Definition at line 2974 of file GlobalFunctions.php.
Referenced by PoolWorkArticleView\__construct(), LanguageConverter\__construct(), MediaWiki\Session\SessionBackend\__construct(), MediaWiki\Auth\AuthManager\autoCreateUser(), Preprocessor\cacheGetTree(), FileCacheBase\cacheMissKey(), Preprocessor\cacheSetTree(), MessageCache\clear(), MediaWiki\Session\TestBagOStuff\deleteSession(), WikiPage\doDeleteArticleReal(), ChangesFeed\execute(), FormatMetadata\fetchExtendedMetadata(), MediaWiki\Session\SessionManager\generateSessionId(), Skin\getCachedNotice(), CachingSiteStore\getCacheKey(), InfoAction\getCacheKey(), SpecialVersion\getCreditsForExtension(), DifferenceEngine\getDiffBodyCacheKey(), MediaWiki\Session\SessionManager\getEmptySessionInternal(), ApiHelp\getHelp(), MediaWiki\Interwiki\ClassicInterwikiLookup\getInterwikiCacheEntry(), MessageCache\getLocalCache(), MessageCache\getMsgFromNamespace(), BacklinkCache\getNumLinks(), ParserCache\getOptionsKey(), ParserCache\getParserOutputKey(), MediaWiki\Session\TestBagOStuff\getSession(), MediaWiki\Session\SessionManager\getSessionById(), MediaWiki\Session\TestBagOStuff\getSessionFromBackend(), UploadBase\getSessionStatus(), User\getTouched(), SiteStatsUpdate\getTypeCacheKey(), MessageCache\getValidationHash(), FileCacheBase\incrMissesRecent(), Block\isWhitelistedFromAutoblocks(), ChangeTags\listExplicitlyDefinedTags(), ChangeTags\listSoftwareActivatedTags(), ChangeTags\listSoftwareDefinedTags(), MessageCache\load(), MessageCache\loadFromDBWithLock(), ExtensionRegistry\loadFromQueue(), MediaWiki\Session\SessionManager\loadSessionInfoFromStore(), SiteStats\numberingroup(), BacklinkCache\partition(), User\pingLimiter(), RebuildRecentchanges\purgeFeeds(), Article\purgePatrolFooterCache(), ChangeTags\purgeTagCacheAll(), ChangeTags\purgeTagUsageCache(), MessageCache\replace(), MediaWiki\Session\SessionBackend\resetId(), MediaWiki\Session\SessionBackend\save(), MessageCache\saveToCaches(), MessageCache\saveToLocalCache(), MediaWiki\Session\TestBagOStuff\setRawSession(), UploadBase\setSessionStatus(), BagOStuffTest\setUp(), MessageCache\setValidationHash(), Article\showMissingArticle(), Article\showPatrolFooter(), ChangeTags\tagUsageStatistics(), BagOStuffTest\testAdd(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), BagOStuffTest\testChangeTTL(), BagOStuffTest\testGet(), BagOStuffTest\testGetMulti(), BagOStuffTest\testGetScopedLock(), BagOStuffTest\testGetWithSetCallback(), BagOStuffTest\testIncr(), BagOStuffTest\testIncrWithInit(), BagOStuffTest\testMerge(), MediaWiki\Session\SessionBackendTest\testUnpersist(), GlobalTest\testWfMemcKey(), User\touch(), SiteStatsUpdate\tryDBUpdateInternal(), and MediaWiki\Session\SessionBackend\unpersist().
wfMemoryLimit | ( | ) |
Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit.
Definition at line 3303 of file GlobalFunctions.php.
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.
string | $old | |
string | $mine | |
string | $yours | |
string | $result |
Definition at line 2600 of file GlobalFunctions.php.
Referenced by TextContentHandler\merge3(), and GlobalTest\testMerge().
wfMergeErrorArrays | ( | ) |
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g.
wfMergeErrorArrays( [ [ 'x' ] ], [ [ 'x', '2' ] ], [ [ 'x' ] ], [ [ 'y' ] ] ); returns: [ [ 'x', '2' ], [ 'x' ], [ 'y' ] ]
array | $array1,... |
Definition at line 240 of file GlobalFunctions.php.
Referenced by MovePage\checkPermissions(), MergeHistory\checkPermissions(), SpecialImport\execute(), Title\isValidMoveOperation(), SpecialChangeContentModel\onSubmit(), and DifferenceEngine\showDiffPage().
wfMessage | ( | $key | ) |
This is the function for getting translated interface messages.
This function replaces all old wfMsg* functions.
string|string[]|MessageSpecifier | $key Message key, or array of keys, or a MessageSpecifier | |
mixed | $params,... | Normal message parameters |
Definition at line 1386 of file GlobalFunctions.php.
wfMessageFallback | ( | ) |
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.
string|string[] | $keys,... Message keys |
Definition at line 1407 of file GlobalFunctions.php.
Referenced by SkinTemplate\buildContentNavigationUrls(), FileRepo\getDisplayName(), ImagePage\openShowImage(), and SkinTemplate\tabAction().
wfMkdirParents | ( | $dir, | |
$mode = null , |
|||
$caller = null |
|||
) |
Make directory, and make all parent directories if they don't exist.
string | $dir | Full path to directory to create |
int | $mode | Chmod value to use, default is $wgDirectoryMode |
string | $caller | Optional caller param for debugging. |
MWException |
Definition at line 2093 of file GlobalFunctions.php.
Referenced by FileCacheBase\checkCacheDirs(), TextPassDumperDatabaseTest\checkpointHelper(), SqliteInstaller\dataDirOKmaybeCreate(), TransformationalImageHandler\doTransform(), DjVuHandler\doTransform(), SvgHandler\doTransform(), GenerateSitemap\execute(), MediaWikiTestCase\getNewTempDirectory(), ImageCleanup\pokeFile(), GitInfo\precomputeValues(), UploadFromUrlTestSuite\setupUploadDir(), LCStoreCDB\startWrite(), and GlobalTest\testWfMkdirParents().
wfMsgReplaceArgs | ( | $message, | |
$args | |||
) |
Replace message parameter keys on the given formatted output.
string | $message | |
array | $args |
Definition at line 1420 of file GlobalFunctions.php.
Referenced by WikiPage\commitRollback(), MWException\msg(), MWExceptionRenderer\msg(), and ApiBase\parseMsg().
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.
array | $cprefs | Client's acceptable type list |
array | $sprefs | Server's offered types |
Definition at line 1941 of file GlobalFunctions.php.
Referenced by GlobalTest\testNegotiateType().
wfObjectToArray | ( | $objOrArray, | |
$recursive = true |
|||
) |
Recursively converts the parameter (an object) to an array with the same data.
object | array | $objOrArray | |
bool | $recursive |
Definition at line 290 of file GlobalFunctions.php.
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)).
string | $url | A URL to parse |
Definition at line 816 of file GlobalFunctions.php.
Referenced by MWHttpRequest\__construct(), ApiAMCreateAccount\execute(), ApiLinkAccount\execute(), ApiClientLogin\execute(), LinkSearchPage\execute(), WikiReference\getDisplayName(), MediaWiki\getUrlDomainDistance(), WikiMap\getWikiWikiReferenceFromSites(), ThumbnailRenderJob\hitThumbUrl(), UploadFromUrl\isAllowedHost(), LinkFilter\makeLikeArray(), UserMailer\makeMsgId(), WfAssembleUrlTest\provideURLParts(), SquidPurgeClient\queuePurge(), RedisPubSubFeedEngine\send(), SpecialSearch\showInterwikiHit(), WfParseUrlTest\testWfParseUrl(), and MediaWiki\triggerJobs().
wfPercent | ( | $nr, | |
$acc = 2 , |
|||
$round = true |
|||
) |
int | $nr | The number to format |
int | $acc | The number of digits after the decimal point, default 2 |
bool | $round | Whether or not to round the value, default true |
Definition at line 2161 of file GlobalFunctions.php.
Referenced by profile_point\display(), ParserTestPrinter\reportPercentage(), and GlobalTest\testWfPercentTest().
wfQueriesMustScale | ( | ) |
Should low-performance queries be disabled?
Definition at line 3135 of file GlobalFunctions.php.
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 316 of file GlobalFunctions.php.
Referenced by CompareParserCache\execute(), RandomPage\getRandomTitle(), SpecialRandomInCategory\getRandomTitle(), WikiPage\insertOn(), ApiQueryRandom\run(), and GlobalTest\testRandom().
wfRandomString | ( | $length = 32 | ) |
Get a random string containing a number of pseudo-random hex characters.
int | $length | The length of the string to generate |
Definition at line 334 of file GlobalFunctions.php.
Referenced by MockFileBackend\doGetLocalCopyMulti(), JobQueueDB\doPop(), SvgHandler\doTransform(), MakeTestEdits\execute(), TestUserRegistry\getImmutableTestUser(), MockLocalRepo\getLocalCopy(), MockLocalRepo\getLocalReference(), TestUserRegistry\getMutableTestUser(), Parser\getRandomString(), WebRequest\getRequestId(), MWExceptionHandler\handleFatalError(), StripState\merge(), UIDGenerator\newUUIDv4(), UploadSourceAdapter\registerSource(), FileBackendTest\setUp(), WANObjectCacheTest\testBusyValue(), WANObjectCacheTest\testCheckKeyInitHoldoff(), GlobalVarConfigTest\testConstructor(), WANObjectCacheTest\testDelete(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\testForAuthentication(), ReplicatedBagOStuffTest\testGet(), ReplicatedBagOStuffTest\testGetAbsent(), WANObjectCacheTest\testGetMulti(), WANObjectCacheTest\testGetMultiCheckKeys(), WANObjectCacheTest\testGetMultiWithSetCallback(), WANObjectCacheTest\testGetNotExists(), WANObjectCacheTest\testGetWithSetCallback(), WANObjectCacheTest\testGetWithSetCallback_versions(), WANObjectCacheTest\testGetWithSeveralCheckKeys(), GlobalVarConfigTest\testHas(), WANObjectCacheTest\testLockTSE(), WANObjectCacheTest\testLockTSESlow(), WANObjectCacheTest\testProcessCache(), GlobalTest\testRandomString(), JobQueueTest\testRootDeduplication(), FileBackendTest\testSanitizeOpHeaders(), ReplicatedBagOStuffTest\testSet(), WANObjectCacheTest\testSetAndGet(), MultiWriteBagOStuffTest\testSetDelayed(), MultiWriteBagOStuffTest\testSetImmediate(), WANObjectCacheTest\testSetOver(), WANObjectCacheTest\testSetWithLag(), WANObjectCacheTest\testStaleSet(), MultiWriteBagOStuffTest\testSyncMerge(), WANObjectCacheTest\testTouchKeys(), and WANObjectCacheTest\testWritePending().
wfReadOnly | ( | ) |
Check whether the wiki is in read-only mode.
Definition at line 1273 of file GlobalFunctions.php.
Referenced by ProtectionForm\__construct(), User\addAutopromoteOnceGroups(), ApiQuerySiteinfo\appendGeneralInfo(), MediaWiki\Auth\AuthManager\autoCreateUser(), ProfilerOutputDb\canUse(), MediaWiki\Auth\AuthManager\checkAccountCreatePermissions(), Action\checkCanExecute(), SpecialPage\checkReadOnly(), ApiMain\checkReadOnly(), User\clearAllNotifications(), User\clearNotification(), WikiPage\commitRollback(), Block\delete(), Article\delete(), WikiPage\doUpdateRestrictions(), WikiPage\doViewUpdates(), EditPage\edit(), SpecialRunJobs\execute(), FileDeleteForm\execute(), BackupReader\execute(), LocalFile\getSha1(), EditPage\internalAttemptSave(), Title\invalidateCache(), LocalFile\maybeUpgradeRow(), Block\purgeExpired(), Title\purgeExpiredRestrictions(), Category\refreshCounts(), JobRunner\run(), MediaWiki\Session\SessionBackend\save(), SpecialSearch\saveNamespaces(), User\saveSettings(), User\setNewtalk(), EditPage\showHeader(), GlobalTest\testReadOnlyEmpty(), GlobalTest\testReadOnlySet(), MediaWiki\triggerJobs(), WikiPage\triggerOpportunisticLinksUpdate(), PageArchive\undeleteRevisions(), and LocalFile\upgradeRow().
wfReadOnlyReason | ( | ) |
Check if the site is in read-only mode and return the message if so.
This checks wfConfiguredReadOnlyReason() and the main load balancer for replica DB lag. This may result in DB connection being made.
Definition at line 1285 of file GlobalFunctions.php.
Referenced by ReadOnlyError\__construct(), ProtectionForm\__construct(), ApiQuerySiteinfo\appendGeneralInfo(), MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\checkAccountCreatePermissions(), ApiBase\dieReadOnly(), WikiPage\doUpdateRestrictions(), EditPage\showHeader(), and ReadOnlyErrorTest\testConstruction().
wfRecursiveRemoveDir | ( | $dir | ) |
Remove a directory and all its content.
Does not hide error.
string | $dir |
Definition at line 2136 of file GlobalFunctions.php.
Referenced by TextPassDumperDatabaseTest\checkpointHelper(), MediaWikiTestCase\setUp(), and MediaWikiTestCase\tearDown().
wfRelativePath | ( | $path, | |
$from | |||
) |
Generate a relative path name to the given file.
May explode on non-matching case-insensitive paths, funky symlinks, etc.
string | $path | Absolute destination path including target filename |
string | $from | Absolute source path, directory only |
Definition at line 2835 of file GlobalFunctions.php.
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.
string | $urlPath | URL path, potentially containing dot-segments |
Definition at line 678 of file GlobalFunctions.php.
Referenced by CSSMin\remapOne(), and WfRemoveDotSegmentsTest\testWfRemoveDotSegments().
wfReportTime | ( | ) |
Returns a script tag that stores the amount of time it took MediaWiki to handle the request in milliseconds as 'wgBackendResponseTime'.
If $wgShowHostnames is true, the script will also set 'wgHostname' to the hostname of the server handling the request.
Definition at line 1487 of file GlobalFunctions.php.
Referenced by SkinTemplate\prepareQuickTemplate().
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.
bool | $resetGzipEncoding |
Definition at line 1811 of file GlobalFunctions.php.
Referenced by SpecialExport\execute(), SpecialUploadStash\outputContents(), and ResourceLoader\tryRespondNotModified().
wfResetSessionID | ( | ) |
Reset the session id.
Definition at line 2908 of file GlobalFunctions.php.
wfRestoreWarnings | ( | ) |
Definition at line 1991 of file GlobalFunctions.php.
wfRunHooks | ( | $event, | |
array | $args = [] , |
||
$deprecatedVersion = null |
|||
) |
Call hook functions defined in $wgHooks.
string | $event | Event name |
array | $args | Parameters passed to hook functions |
string | null | $deprecatedVersion | Optionally mark hook as deprecated with version number |
Definition at line 3455 of file GlobalFunctions.php.
Referenced by HooksTest\testOldStyleHooks().
wfScript | ( | $script = 'index' | ) |
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScriptPath etc.
except for 'index' and 'load' which use $wgScript/$wgLoadScript
string | $script | Script filename, sans extension |
Definition at line 3151 of file GlobalFunctions.php.
Referenced by SpecialPage\addFeedLinks(), SpecialRedirect\dispatchLog(), SpecialRedirect\dispatchPage(), SpecialRedirect\dispatchRevision(), SpecialRecentChanges\doHeader(), SpecialApiHelp\execute(), SpecialContributions\execute(), RedirectSpecialPage\execute(), SpecialRecentChanges\execute(), LinkSearchPage\execute(), FileDuplicateSearchPage\execute(), ApiHelp\fixHelpLinks(), HTMLForm\getAction(), SpecialLog\getActionButtons(), ResourceLoaderStartUpModule\getConfigSettings(), SpecialVersion\getEntryPointInfo(), OutputPage\getHeadLinksArray(), ApiHelp\getHelpInternal(), TablePager\getLimitForm(), ApiOpenSearch\getOpenSearchTemplate(), UsersPager\getPageHeader(), ApiRsd\getRsdApiList(), HistoryPager\getStartBody(), CategoryPager\getStartForm(), HistoryAction\onView(), SpecialWatchlist\setTopText(), ApiTestCase\setUp(), SpecialMergeHistory\showMergeForm(), SpecialProtectedpages\showOptions(), SpecialProtectedtitles\showOptions(), SpecialSearch\showResults(), SpecialUndelete\showSearchForm(), ApiMain\substituteResultWithError(), UserrightsPage\switchForm(), SpecialEmailUser\userForm(), and SpecialWhatLinksHere\whatlinkshereForm().
wfSetBit | ( | & | $dest, |
$bit, | |||
$state = true |
|||
) |
As for wfSetVar except setting a bit.
int | $dest | |
int | $bit | |
bool | $state |
Definition at line 1740 of file GlobalFunctions.php.
wfSetupSession | ( | $sessionId = false | ) |
Initialise php session.
bool | string | $sessionId |
Definition at line 2933 of file GlobalFunctions.php.
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.
mixed | $dest | |
mixed | $source | |
bool | $force |
Definition at line 1723 of file GlobalFunctions.php.
Referenced by ParserOptions\disableContentConversion(), ParserOptions\disableTitleConversion(), OutputPage\enableClientCache(), ParserOptions\enableLimitReport(), LinkCache\forUpdate(), Block\fromMaster(), DatabaseMssql\ignoreErrors(), SpecialPage\including(), Block\isAutoblocking(), Block\isHardblock(), SpecialPage\listed(), Parser\Options(), Parser\OutputType(), OutputPage\parserOptions(), DatabaseMssql\prepareStatements(), ParserOutput\preventClickjacking(), Block\prevents(), DatabaseMssql\scrollableCursor(), ParserOptions\setAllowExternalImages(), ParserOptions\setAllowExternalImagesFrom(), ParserOptions\setAllowSpecialInclusion(), CacheTime\setCacheTime(), ParserOutput\setCategoryLinks(), ParserOptions\setCleanSignatures(), ParserOptions\setCurrentRevisionCallback(), ParserOptions\setDateFormat(), ParserOptions\setEditSection(), ParserOutput\setEditSectionTokens(), ParserOptions\setEnableImageWhitelist(), ParserOptions\setExpensiveParserFunctionLimit(), ParserOptions\setExternalLinkTarget(), OutputPage\setFileVersion(), ParserOutput\setIndexPolicy(), ParserOptions\setInterfaceMessage(), ParserOptions\setInterwikiMagic(), ParserOptions\setIsPreview(), ParserOptions\setIsPrintable(), ParserOptions\setIsSectionPreview(), ParserOutput\setLanguageLinks(), SpecialPage\setListed(), ParserOptions\setMaxGeneratedPPNodeCount(), ParserOptions\setMaxIncludeSize(), ParserOptions\setMaxPPNodeCount(), ParserOptions\setMaxTemplateDepth(), WikiImporter\setNoticeCallback(), ParserOptions\setNumberHeadings(), ParserOptions\setPreSaveTransform(), ParserOptions\setRemoveComments(), OutputPage\setRevisionId(), OutputPage\setRevisionTimestamp(), ParserOutput\setSections(), ParserOptions\setSpeculativeRevIdCallback(), ParserOptions\setStubThreshold(), ParserOptions\setTargetLanguage(), ParserOptions\setTemplateCallback(), ParserOutput\setText(), ParserOptions\setThumbSize(), ParserOptions\setTidy(), ParserOutput\setTimestamp(), ParserOptions\setTimestamp(), ParserOutput\setTitleText(), ParserOutput\setTOCEnabled(), ParserOutput\setTOCHTML(), ParserOptions\setUserLang(), and Parser\Title().
wfShellExec | ( | $cmd, | |
& | $retval = null , |
||
$environ = [] , |
|||
$limits = [] , |
|||
$options = [] |
|||
) |
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported.
string|string[] | $cmd If string, a properly shell-escaped command line, or an array of unescaped arguments, in which case each value will be escaped Example: [ 'convert', '-font', 'font name' ] would produce "'convert' '-font' 'font name'" | |
null | mixed | &$retval | Optional, will receive the program's exit code. (non-zero is usually failure). If there is an error from read, select, or proc_open(), this will be set to -1. |
array | $environ | Optional environment variables which should be added to the executed command environment. |
array | $limits | Optional array with limits(filesize, memory, time, walltime) this overwrites the global wgMaxShell* limits. |
array | $options | Array of options:
|
Definition at line 2310 of file GlobalFunctions.php.
Referenced by UIDGenerator\__construct(), MimeMagic\applyDefaultParameters(), DjVuHandler\doTransform(), Installer\envCheckShellLocale(), SiteConfiguration\getConfig(), CheckSyntax\getGitModifiedFiles(), GitInfo\getHeadCommitDate(), TransformationalImageHandler\getMagickVersion(), Installer\locateExecutable(), ParserTestPrinter\quickDiff(), Maintenance\readlineEmulation(), DjVuImage\retrieveMetaData(), WfShellExecTest\testBug67870(), JpegPixelFormatTest\testPixelFormatRendering(), DifferenceEngine\textDiff(), RandomImageGenerator\writeImageWithApi(), and RandomImageGenerator\writeImageWithCommandLine().
wfShellExecDisabled | ( | ) |
Check if wfShellExec() is effectively disabled via php.ini config.
Definition at line 2275 of file GlobalFunctions.php.
wfShellExecWithStderr | ( | $cmd, | |
& | $retval = null , |
||
$environ = [] , |
|||
$limits = [] |
|||
) |
Execute a shell command, returning both stdout and stderr.
Convenience function, as all the arguments to wfShellExec can become unwieldy.
string|string[] | $cmd If string, a properly shell-escaped command line, or an array of unescaped arguments, in which case each value will be escaped Example: [ 'convert', '-font', 'font name' ] would produce "'convert' '-font' 'font name'" | |
null | mixed | &$retval | Optional, will receive the program's exit code. (non-zero is usually failure) |
array | $environ | Optional environment variables which should be added to the executed command environment. |
array | $limits | Optional array with limits(filesize, memory, time, walltime) this overwrites the global wgMaxShell* limits. |
Definition at line 2544 of file GlobalFunctions.php.
Referenced by UploadBase\detectVirus(), SvgHandler\rasterize(), JpegHandler\rotate(), BitmapHandler\rotate(), ExifBitmapHandler\swapICCProfile(), BitmapHandler\transformCustom(), and BitmapHandler\transformImageMagick().
Generate a shell-escaped command line string to run a MediaWiki cli 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").
string | $script | MediaWiki cli script path |
array | $parameters | Arguments and options to the script |
array | $options | 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 2576 of file GlobalFunctions.php.
Referenced by CleanupSpam\execute(), SiteConfiguration\getConfig(), MWDocGen\init(), and GlobalTest\testWfShellWikiCmd().
wfShorthandToInteger | ( | $string = '' , |
|
$default = -1 |
|||
) |
Converts shorthand byte notation to integer form.
string | $string | |
int | $default | Returned if $string is empty |
Definition at line 3352 of file GlobalFunctions.php.
Referenced by Installer\envCheckMemory(), UploadBase\getMaxPhpUploadSize(), WebRequestUpload\isIniSizeOverflow(), WfShorthandToIntegerTest\testWfShorthandToInteger(), and GlobalTest\testWfShorthandToInteger().
wfShowingResults | ( | $offset, | |
$limit | |||
) |
int | $offset | |
int | $limit |
Definition at line 1622 of file GlobalFunctions.php.
wfSplitWikiID | ( | $wiki | ) |
Split a wiki ID into DB name and table prefix.
string | $wiki |
Definition at line 3040 of file GlobalFunctions.php.
Referenced by ForeignDBViaLBRepo\__construct(), JobQueueDB\getCacheKey(), JobQueueRedis\getQueueKey(), and JobQueue\getRootJobCacheKey().
wfStripIllegalFilenameChars | ( | $name | ) |
Replace all invalid characters with '-'.
Additional characters can be defined in $wgIllegalFileChars (see T22489). By default, $wgIllegalFileChars includes ':', '/', '\'.
string | $name | Filename to process |
Definition at line 3285 of file GlobalFunctions.php.
Referenced by UploadBase\getTitle(), and MovePage\isValidFileMove().
wfSuppressWarnings | ( | $end = false | ) |
Reference-counted warning suppression.
bool | $end |
Definition at line 1983 of file GlobalFunctions.php.
wfTempDir | ( | ) |
Tries to get the system directory for temporary files.
First $wgTmpDirectory is checked, and then the TMPDIR, TMP, and TEMP environment variables are then checked in sequence, then sys_get_temp_dir(), then upload_tmp_dir from php.ini.
NOTE: When possible, use instead the tmpfile() function to create temporary files to avoid race conditions on file creation, etc.
Definition at line 2074 of file GlobalFunctions.php.
Referenced by FSRepo\__construct(), UIDGenerator\__construct(), LocalisationCache\__construct(), UploadFromChunks\concatenateChunks(), FileBackendGroup\config(), ParserTestRunner\createRepoGroup(), MockFileBackend\doGetLocalCopyMulti(), FileBackendTest\doTestDoOperationsPipeline(), SvgHandler\doTransform(), WikiRevision\downloadSource(), WikiImporter\dumpTemp(), ApiImageRotate\execute(), HHVMMakeRepo\execute(), MWDocGen\execute(), TempFSFile\factory(), MockLocalRepo\getLocalCopy(), MockLocalRepo\getLocalReference(), MediaWikiTestCase\getNewTempFile(), UIDGenerator\getSequentialPerNodeIDs(), FileBackendGroup\guessMimeInternal(), JobRunner\loadBackoffs(), UploadFromUrl\makeTemporaryFile(), File\makeTransformTmpFile(), ClassicInterwikiLookupTest\populateCDB(), InterwikiTest\populateCDB(), FileBackendTest\provider_testStore(), ParserTestPrinter\quickDiff(), ResourceLoaderImage\rasterize(), CheckStorage\restoreText(), WebPHandlerTest\setUp(), MigrateFileRepoLayoutTest\setUp(), UploadStashTest\setUp(), JobRunner\syncBackoffDeltas(), and DifferenceEngine\textDiff().
Returns true if these thumbnail parameters match one that MediaWiki requests from file description pages and/or parser output.
$params is considered non-standard if they involve a non-standard width or any non-default parameters aside from width and page number. The number of possible files with standard parameters is far less than that of all combinations; rate-limiting for them can thus be more generious.
File | $file | |
array | $params |
Definition at line 3609 of file GlobalFunctions.php.
Referenced by WfThumbIsStandardTest\testIsStandard(), and wfStreamThumb().
wfTimestamp | ( | $outputtype = TS_UNIX , |
|
$ts = 0 |
|||
) |
Get a timestamp string in one of various formats.
mixed | $outputtype | A timestamp in one of the supported formats, the function will autodetect which format is supplied and act accordingly. |
mixed | $ts | Optional timestamp to convert, default 0 for the current time |
Definition at line 2007 of file GlobalFunctions.php.
Referenced by Block\__construct(), OutputPage\adaptCdnTTL(), BlockTest\addDBData(), LinkCache\addLinkObj(), ApiQuerySiteinfo\appendExtensions(), ApiQuerySiteinfo\appendGeneralInfo(), SpecialRecentChanges\buildMainQueryConds(), ApiStashEdit\buildStashValue(), FileCacheBase\cacheTimestamp(), SiteStatsUpdate\cacheUpdate(), ApiStashEdit\checkCache(), ApiMain\checkConditionalRequestHeaders(), AjaxResponse\checkLastModified(), OutputPage\checkLastModified(), WikiPage\commitRollback(), User\confirmationToken(), FileBackendMultiWrite\consistencyCheck(), LanguageWa\date(), Language\date(), DifferenceEngine\debug(), JobRunner\debugCallback(), LocalFile\decodeRow(), SqlBagOStuff\deleteObjectsExpiringBefore(), SpecialUndelete\diffHeader(), ApiTestCase\doApiRequestWithToken(), MemoryFileBackend\doCopyInternal(), MemoryFileBackend\doCreateInternal(), DBFileJournal\doLogChangeBatch(), WikiPage\doPurge(), MysqlUpdater\doSchemaRestructuring(), MemoryFileBackend\doStoreInternal(), FileBackendTest\doTestGetFileStat(), ApiProtect\execute(), ApiUndelete\execute(), ApiMergeHistory\execute(), ApiSetNotificationTimestamp\execute(), ApiEditPage\execute(), SpecialExport\execute(), ApiQueryBlocks\execute(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), RemoveUnusedAccounts\execute(), UploadStashCleanup\execute(), SpecialActiveUsers\execute(), FixTimestamps\execute(), ApiQueryImageInfo\execute(), PurgeParserCache\execute(), ApiQueryAllUsers\execute(), ImportTextFiles\execute(), ApiFeedWatchlist\execute(), UpdateSearchIndex\execute(), BenchmarkParse\execute(), ApiQueryUsers\execute(), GenerateSitemap\execute(), LocalFileRestoreBatch\execute(), JobRunner\executeJob(), CacheTime\expired(), ApiQueryWatchlist\extractOutputData(), ApiQueryInfo\extractPageInfo(), ApiQueryRevisionsBase\extractRevisionInfo(), ApiQueryLogEvents\extractRowInfo(), ApiQueryContributions\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), HistoryAction\feedEmpty(), MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(), FeedUtils\formatDiff(), Language\formatExpiry(), SpecialUndelete\formatFileRow(), LogFormatter\formatParameterValueForApi(), SpecialMergeHistory\formatRevisionRow(), SpecialUndelete\formatRevisionRow(), RSSFeed\formatTime(), AtomFeed\formatTime(), ImageListPager\formatValue(), GenerateSitemap\generateLimit(), RevDelArchivedFileItem\getApiData(), RevDelRevisionItem\getApiData(), RevDelFileItem\getApiData(), Block\getAutoblockExpiry(), ApiQueryUserInfo\getBlockInfo(), CacheTime\getCacheTime(), NewUsersLogFormatter\getComment(), ApiQueryUserInfo\getCurrentUserInfo(), LocalFile\getDescriptionTouched(), ProtectionForm\getExpiry(), FormatMetadata\getExtendedMetadataFromFile(), ApiQueryWatchlistIntegrationTest\getExternalRC(), User\getFirstEditTimestamp(), ApiQueryImageInfo\getInfo(), OutputPage\getJSVars(), MachineReadableRCFeedFormatter\getLine(), PNGMetadataExtractor\getMetadata(), SpecialRandomInCategory\getMinAndMaxForCat(), ApiParamInfo\getModuleInfo(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\getNewPasswordExpiry(), BlockLogFormatter\getParametersForApi(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(), PageArchive\getPreviousRevision(), ActiveUsersPager\getQueryInfo(), RawAction\getRawText(), ImageHistoryList\getThumbForLine(), MockFSFile\getTimestamp(), FSFile\getTimestamp(), RevisionItemBase\getTimestamp(), ForeignAPIFile\getTimestamp(), DatabaseLogEntry\getTimestamp(), RCDatabaseLogEntry\getTimestamp(), ArchivedFile\getTimestamp(), WikiPage\getTimestamp(), ManualLogEntry\getTimestamp(), Revision\getTimestamp(), FileJournal\getTimestampedUUID(), Revision\getTimestampFromId(), User\getTouched(), ContribsPager\getUserCond(), Parser\getVariableValue(), ApiQueryInfo\getVisitingWatcherInfo(), ForeignAPIRepo\httpGet(), ImageHistoryList\imageHistoryLine(), Block\initFromRow(), Language\internalUserTimeAndDate(), User\isEmailConfirmationPending(), SqlBagOStuff\isExpired(), RecentChange\isInRCLifespan(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\isTimestampValid(), User\loadDefaults(), ChangesFeed\loadFromCache(), LocalFile\loadFromCache(), User\loadFromCache(), MessageCache\loadFromDB(), WikiPage\loadFromRow(), RecentChange\loadFromRow(), User\loadFromRow(), SpecialUndelete\loadRequest(), GenerateSitemap\main(), FormatMetadata\makeFormattedData(), MediaWiki\Session\Token\match(), SpecialBlock\maybeAlterFormDefaults(), User\newTouchedTimestamp(), OutputPage\output(), InfoAction\pageCounts(), ApiStashEdit\parseAndStash(), SpecialBlock\parseExpiryInput(), TableCleanup\progress(), ImageBuilder\progress(), ApiMainTest\provideCheckConditionalRequestHeaders(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), LocalFile\publishTo(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), QueryPage\recache(), LocalFile\recordUpload2(), CategoryMembershipChangeJob\run(), ApiQueryProtectedTitles\run(), ApiQueryCategories\run(), ApiQueryWatchlistRaw\run(), ApiQueryDuplicateFiles\run(), ApiQuerySearch\run(), ApiQueryQueryPage\run(), ApiQueryCategoryMembers\run(), RefreshLinksJob\runForTitle(), ChangesFeed\saveToCache(), ApiMain\sendCacheHeaders(), ResourceLoader\sendResponseHeaders(), OutputPage\setLastModified(), WikiRevision\setTimestamp(), WikiPage\setTimestamp(), ApiMain\setupExecuteAction(), TextPassDumper\showReport(), BackupDumper\showReport(), UpdateLogging\sync(), EditPageTest\testAutoMerge(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetNewPasswordExpiry(), WfTimestampTest\testHttpDate(), WfTimestampTest\testNormalTimestamps(), WfTimestampTest\testOldTimestamps(), JobQueueTest\testRootDeduplication(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), WfTimestampTest\testTimestampParameter(), TitlePermissionTest\testUserBlock(), Language\time(), Language\timeanddate(), IPTC\timeHelper(), DatabaseOracle\timestamp(), MediaWiki\Session\Token\toString(), ApiUpload\transformWarnings(), ResourceLoader\tryRespondFromFileCache(), RecentChangesUpdateJob\updateActiveUsers(), WikiPage\updateIfNewerOn(), Block\updateTimestamp(), ApiBase\validateTimestamp(), EditPage\wasDeletedSinceLastEdit(), wfStreamThumb(), and XmlDumpWriter\writeTimestamp().
wfTimestampNow | ( | ) |
Convenience function; returns MediaWiki timestamp for the present time.
Definition at line 2036 of file GlobalFunctions.php.
Referenced by LinksDeletionUpdate\__construct(), CategoryMembershipChange\__construct(), Revision\__construct(), EditPageTest\assertEdit(), User\confirmEmail(), Preferences\datetimePreferences(), Block\doAutoblock(), WikiPage\doCreate(), SpecialWatchlist\doHeader(), WikiPage\doModify(), PoolWorkArticleView\doWork(), ApiProtect\execute(), ApiEditPage\execute(), SpecialExport\execute(), MigrateFileRepoLayout\execute(), ResetUserEmail\execute(), ImportTextFiles\execute(), UpdateSearchIndex\execute(), GenerateSitemap\execute(), PPFuzzTest\execute(), LogFormatterTestCase\expandDatabaseRow(), SqlBagOStuff\expireAll(), FormatMetadata\fetchExtendedMetadata(), Title\getCascadeProtectionSources(), Preferences\getDateOptions(), Parser\getRevisionTimestamp(), ParserOptions\getTimestamp(), ManualLogEntry\getTimestamp(), EditPage\importFormData(), ManualLogEntry\insert(), HTMLCacheUpdateJob\invalidateTitles(), MessageCache\isCacheExpired(), Block\isExpired(), Title\loadRestrictions(), Title\loadRestrictionsFromRows(), Job\newRootJobParams(), SpecialLockdb\onSubmit(), SpecialRecentChanges\optionsPanel(), RSSFeed\outHeader(), AtomFeed\outHeader(), WikiPage\prepareContentForEdit(), SpecialBlock\processForm(), WikiImporter\processRevision(), ProtectionForm\save(), ParserCache\save(), LogPage\saveContent(), HTMLFileCache\saveToFileCache(), AjaxResponse\storeInMemcached(), EditPageTest\testAutoMerge(), BlockTest\testBlockedUserCanNotCreateAccount(), EditPageTest\testCheckDirectEditingDisallowed_forNonTextContent(), BlockTest\testCrappyCrossWikiBlocks(), MessageTest\testExpiryParams(), and LanguageTest\testSprintfDateNoTtlIfNotNeeded().
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.
int | $outputtype | |
string | $ts |
Definition at line 2023 of file GlobalFunctions.php.
Referenced by Autopromote\checkCondition(), ApiQueryUsers\execute(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(), Job\getQueuedTimestamp(), Job\getReleaseTimestamp(), JobSpecification\getReleaseTimestamp(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\isTimestampValid(), ApiStashEdit\lastEditTime(), WikiPage\loadFromRow(), and User\loadFromRow().
wfTransactionalTimeLimit | ( | ) |
Set PHP's time limit to the larger of php.ini or $wgTransactionalTimeLimit.
Definition at line 3331 of file GlobalFunctions.php.
Referenced by RollbackAction\onView(), Action\useTransactionalTimeLimit(), SpecialPage\useTransactionalTimeLimit(), and ApiBase\useTransactionalTimeLimit().
wfUnpack | ( | $format, | |
$data, | |||
$length = false |
|||
) |
Wrapper around php's unpack.
string | $format | The format string (See php's docs) |
string | $data | A binary string of binary data |
int | bool | $length | The minimum length of $data or false. 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 3473 of file GlobalFunctions.php.
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:
;:&=$-_.+!*'(),
RFC 1738 says ~ is unsafe, however RFC 3986 considers it an unreserved character which should not be encoded. More importantly, google chrome always converts %7E back to ~, and converting it in this function can cause a redirect loop (T105265).
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 (see T24709), so no fancy : for IIS7.
%2F in the page titles seems to fatally break for some reason.
string | $s |
Definition at line 369 of file GlobalFunctions.php.
Referenced by Title\__wakeup(), OutputPage\addHelpLink(), CoreParserFunctions\basepagenamee(), FileRepo\getDescriptionRenderUrl(), FileRepo\getDescriptionUrl(), LoginSignupSpecialPage\getFakeTemplate(), WikiReference\getLocalUrl(), Title\getLocalURL(), MediaWikiSite\getPageUrl(), Title\getPrefixedURL(), LoginSignupSpecialPage\getReturnToQueryStringFragment(), Title\getSubpageUrlForm(), Interwiki\getURL(), Parser\getVariableValue(), ApiBase\logFeatureUsage(), ApiMain\logRequest(), Title\makeTitle(), CoreParserFunctions\namespacee(), CoreParserFunctions\nse(), CoreParserFunctions\rootpagenamee(), Title\secureAndSplit(), CoreParserFunctions\speciale(), CoreParserFunctions\subjectspacee(), CoreParserFunctions\talkspacee(), GlobalTest\testUrlencode(), and WfUrlencodeTest\verifyEncodingFor().
wfUrlProtocols | ( | $includeProtocolRelative = true | ) |
Returns a regular expression of url protocols.
bool | $includeProtocolRelative | If false, remove '//' from the returned protocol list. DO NOT USE this directly, use wfUrlProtocolsWithoutProtRel() instead |
Definition at line 756 of file GlobalFunctions.php.
Referenced by Parser\__construct(), Skin\addToSidebarPlain(), ResourceLoaderStartUpModule\getConfigSettings(), Skin\makeInternalOrExternalUrl(), Sanitizer\safeEncodeAttribute(), and Sanitizer\validateAttributes().
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 801 of file GlobalFunctions.php.
Referenced by Parser\doMagicLinks(), and Language\markNoConversion().
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
Note: Due to the behavior of PHP's version_compare() which is used in this function, if you want to allow the 'wmf' development versions add a 'c' (or any single letter other than 'a', 'b' or 'p') as a post-fix to your targeted version number. For example if you wanted to allow any variation of 1.22 use `wfUseMW( '1.22c' )`. Using an 'a' or 'b' instead of 'c' will not result in the same comparison due to the internal logic of version_compare().
string | int | float | $req_ver | The version to check, can be a string, an integer, or a float |
MWException |
Definition at line 2791 of file GlobalFunctions.php.
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
string | int | float | $req_ver | The version to check, can be a string, an integer, or a float |
MWException |
Definition at line 2761 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).
mixed | $var | A PHP variable to dump. |
Definition at line 1758 of file GlobalFunctions.php.
Waits for the replica DBs 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 replica DBs.
By default this waits on the main DB cluster of the current wiki. If $cluster is set to "*" it will wait on all DB clusters, including external ones. If the lag being waiting on is caused by the code that does this check, it makes since to use $ifWritesSince, particularly if cluster is "*", to avoid excess overhead.
Never call this function after a big DB write that is still in a transaction. This only makes sense after the possible lag inducing changes were committed.
float | null | $ifWritesSince | Only wait if writes were done since this UNIX timestamp |
string | bool | $wiki | Wiki identifier accepted by wfGetLB |
string | bool | $cluster | Cluster name accepted by LBFactory. Default: false. |
int | null | $timeout | Max wait time. Default: 1 day (cli), ~10 seconds (web) |
Definition at line 3227 of file GlobalFunctions.php.
Referenced by NamespaceConflictChecker\checkLinkTable(), CompressOld\compressWithConcat(), RefreshLinks\deleteLinksFromNonexistent(), RefreshLinks\dfnCheckInterval(), PopulateRecentChangesSource\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateParentId\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateLogUsertext\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateImageSha1\doDBUpdates(), PopulateRevisionLength\doLenUpdates(), RefreshLinks\doRefreshLinks(), PopulateRevisionSha1\doSha1LegacyUpdates(), PopulateRevisionSha1\doSha1Updates(), UpdateSpecialPages\doSpecialPageCacheUpdates(), TidyUpBug37714\execute(), RemoveInvalidEmails\execute(), DeleteSelfExternals\execute(), FixUserRegistration\execute(), DeleteDefaultMessages\execute(), InitEditCount\execute(), MakeTestEdits\execute(), MigrateUserGroup\execute(), BatchedQueryRunner\execute(), ConvertUserOptions\execute(), CleanupRemovedModules\execute(), UpdateRestrictions\execute(), UpdateSpecialPages\execute(), UploadStashCleanup\execute(), MwSql\execute(), DeleteBatch\execute(), ResetUserTokens\execute(), MoveBatch\execute(), UpdateCollation\execute(), PopulateCategory\execute(), UpdateMediaWiki\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), FixDefaultJsonContentPages\handleRow(), moveToExternal(), resolveStubs(), BackupReader\showReport(), UpdateLogging\sync(), TrackBlobs\trackOrphanText(), TrackBlobs\trackRevisions(), PopulateContentModel\updatePageRows(), 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.
To log warnings in production, use wfLogWarning() instead.
string | $msg | Message to send |
int | $callerOffset | Number of items to go back in the backtrace to find the correct caller (1 = function calling wfWarn, ...) |
int | $level | PHP error level; defaults to E_USER_NOTICE; only used when $wgDevelopmentWarnings is true |
Definition at line 1140 of file GlobalFunctions.php.
Referenced by FakeDatabase\__construct(), DatabaseTestHelper\__construct(), FakeDatabaseMysqlBase\__construct(), TextContent\__construct(), Exif\__construct(), Action\__construct(), MediaWiki\Tidy\RaggettExternal\cleanWrapped(), MediaWiki\Tidy\RaggettInternalPHP\cleanWrapped(), ForeignAPIRepo\fileExistsBatch(), Http\get(), SpecialPageFactory\getAliasList(), CacheHelper\getCachedValue(), WikiPage\getContentModel(), Action\getContext(), ParserCache\getKey(), SpecialPageFactory\getLocalNameFor(), Language\getMagic(), MediaWiki\initializeArticle(), Linker\link(), Linker\makeBrokenImageLinkObj(), BacklinkJobUtils\partitionBacklinkJob(), Autopromote\recCheckCondition(), EditPage\showEditForm(), and DifferenceEngine\textDiff().
wfWikiID | ( | ) |
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
Definition at line 3024 of file GlobalFunctions.php.
Referenced by FSRepo\__construct(), ApiMain\__construct(), MediaWiki\Logger\Monolog\WikiProcessor\__invoke(), ApiQuerySiteinfo\appendGeneralInfo(), UserDupes\checkDupes(), JobRunner\commitMasterChanges(), FileBackendGroup\config(), ParserTestRunner\createRepoGroup(), WikiPage\doDeleteUpdates(), WikiPage\doEditUpdates(), MysqlUpdater\doTemplatelinksUpdate(), DeleteRevision\execute(), InitEditCount\execute(), AttachLatest\execute(), CopyJobQueue\execute(), SyncFileBackend\execute(), CreateAndPromote\execute(), UpdateSearchIndex\execute(), UpdateMediaWiki\execute(), GenerateSitemap\execute(), UserrightsPage\fetchUser(), MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(), MediaWiki\Logger\LegacyLogger\formatAsWfLogDBError(), MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixesCached(), JobQueueGroup\getCachedConfigVar(), User\getCacheKey(), SiteConfiguration\getConfig(), ObjectCache\getDefaultKeyspace(), MediaWiki\Interwiki\ClassicInterwikiLookup\getInterwikiCacheEntry(), MachineReadableRCFeedFormatter\getLine(), FileBackendDBRepoWrapperTest\getMocks(), User\getNewMessageLinks(), User\getNewMessageRevisionId(), Skin\getNewtalks(), Profiler\getProfileID(), Revision\getTitle(), Title\invalidateCache(), LocalIdLookup\isAttached(), ApiMain\logRequest(), RecompressTracked\logToFile(), UserMailer\makeMsgId(), EnqueueJob\newFromLocalJobs(), JobQueueMemoryTest\newJobQueue(), LBFactoryTest\newLBFactoryMulti(), TextPassDumper\openSpawn(), JobQueue\pop(), ClassicInterwikiLookupTest\populateHash(), InterwikiTest\populateHash(), TableCleanup\progress(), RecentChangesUpdateJob\purgeExpiredRows(), RefreshLinksJob\run(), JobRunner\run(), MigrateFileRepoLayoutTest\setUp(), LocalFileTest\setUp(), StoreBatchTest\setUp(), MediaWikiMediaTestCase\setUp(), JobQueueTest\setUp(), UploadFromUrlTestSuite\setUp(), FileBackendTest\setUp(), TextPassDumper\showReport(), BackupDumper\showReport(), LockManagerGroup\singleton(), JobQueueGroup\singleton(), RecompressTracked\startReplicaProcs(), ExternalStoreMwstore\store(), FileBackendTest\testAsyncWrites(), FileTest\testGenerateBucketsIfNeeded(), ResourceLoaderWikiModuleTest\testGetPreloadedTitleInfo(), FileTest\testGetThumbnailSource(), JobQueueTest\testGetWiki(), LocalIdLookupTest\testIsAttached(), FileBackendTest\testReadAffinity(), FileBackendTest\testSanitizeOpHeaders(), and RecentChangesUpdateJob\updateActiveUsers().