MediaWiki
1.32.5
|
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) | |
wfArrayFilter (array $arr, callable $callback) | |
wfArrayFilterByKey (array $arr, callable $callback) | |
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... | |
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) | |
Whether the client accept gzip encoding. More... | |
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... | |
wfEscapeShellArg (... $args) | |
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... | |
wfExpandUrl ( $url, $defaultProto=PROTO_CURRENT) | |
Expand a potentially local URL to a fully-qualified URL. More... | |
wfFindFile ( $title, $options=[]) | |
Find a file. More... | |
wfForeignMemcKey ( $db, $prefix,... $args) | |
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... | |
wfGetPrecompiledData ( $name) | |
Get an object from the precompiled serialized directory. More... | |
wfGetRusage () | |
Get system resource usage of current request context. More... | |
wfGetScriptUrl () | |
Get the script URL. More... | |
wfGetServerUrl ( $proto) | |
Get the wiki's "server", i.e. More... | |
wfGlobalCacheKey (... $args) | |
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... | |
wfIsBadImage ( $name, $contextTitle=false, $blacklist=null) | |
Determine if an image exists on the 'bad image list'. More... | |
wfIsCLI () | |
Check if we are running from the commandline. 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 (... $args) | |
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, &$mergeAttemptResult=null) | |
wfMerge attempts to merge differences between three texts. More... | |
wfMergeErrorArrays (... $args) | |
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g. More... | |
wfMessage ( $key,... $params) | |
This is the function for getting translated interface messages. More... | |
wfMessageFallback (... $keys) | |
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 ( $nonce=null) | |
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 () | |
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... | |
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... | |
wfStringToBool ( $val) | |
Convert string value to boolean, when the following are interpreted as true: 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... | |
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 1864 of file GlobalFunctions.php.
References $type.
Referenced by GlobalTest\testMimeTypeMatch(), and wfNegotiateType().
wfAcceptToPrefs | ( | $accept, | |
$def = '*/*' |
|||
) |
Converts an Accept-* header into an array mapping string values to quality factors.
string | $accept | |
string | $def | Default |
Definition at line 1828 of file GlobalFunctions.php.
References as, and captcha-old\count.
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 460 of file GlobalFunctions.php.
References $query, and wfArrayToCgi().
Referenced by SpecialPage\addFeedLinks(), SpecialRedirect\dispatchLog(), SpecialRedirect\dispatchPage(), SpecialRedirect\dispatchRevision(), SpecialApiHelp\execute(), SpecialContributions\execute(), RedirectSpecialPage\execute(), ImportSiteScripts\execute(), SpecialRecentChanges\execute(), LoginSignupSpecialPage\execute(), ImportSiteScripts\fetchScriptList(), ApiHelp\fixHelpLinks(), FileRepo\getDescriptionRenderUrl(), ApiHelp\getHelpInternal(), FindHooks\getHooksFromOnlineDocCategory(), MediaWiki\Linker\LinkRenderer\getLinkURL(), Title\getLocalURL(), ContentSecurityPolicy\getReportUri(), ImageHandler\getScriptedTransform(), File\getTransformScript(), Linker\getUploadUrl(), ResourceLoaderImage\getUrl(), ForeignAPIRepo\httpGetCached(), Linker\makeThumbLink2(), FileRepo\makeUrl(), ImportStreamSource\newFromInterwiki(), MediaWiki\Site\MediaWikiPageNameNormalizer\normalizePageName(), InputBoxHooks\onMediaWikiPerformAction(), MediaWiki\Sparql\SparqlClient\query(), 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 175 of file GlobalFunctions.php.
References $value.
wfArrayDiff2 | ( | $a, | |
$b | |||
) |
Like array_diff( $a, $b ) except that it works with two-dimensional arrays.
array | $a | |
array | $b |
Definition at line 111 of file GlobalFunctions.php.
Referenced by WikiPage\doRollback(), EditPage\getEditPermissionErrors(), and GlobalTest\testWfArrayDiff2().
wfArrayDiff2_cmp | ( | $a, | |
$b | |||
) |
array | string | $a | |
array | string | $b |
Definition at line 120 of file GlobalFunctions.php.
References captcha-old\count, and key.
wfArrayFilter | ( | array | $arr, |
callable | $callback | ||
) |
array | $arr | |
callable | $callback | Will be called with the array value and key (in that order) and should return a bool which will determine whether the array element is kept. |
Definition at line 150 of file GlobalFunctions.php.
Referenced by WfArrayFilterTest\testWfArrayFilter().
wfArrayFilterByKey | ( | array | $arr, |
callable | $callback | ||
) |
array | $arr | |
callable | $callback | Will be called with the array key and should return a bool which will determine whether the array element is kept. |
Definition at line 162 of file GlobalFunctions.php.
Referenced by WfArrayFilterTest\testWfArrayFilterByKey().
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 229 of file GlobalFunctions.php.
References $keys, $output, and captcha-old\count.
Referenced by ApiComparePages\getAllowedParams(), DeletedContributionsPage\getSubTitle(), and UpdateExtensionJsonSchema\updateTo2().
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 3282 of file GlobalFunctions.php.
Referenced by HTMLUserTextField\__construct(), ExtensionRegistry\exportExtractedData(), GadgetDefinitionContent\getAssocArray(), 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 368 of file GlobalFunctions.php.
Referenced by WebRequest\appendQueryArray(), SkinTemplate\buildPersonalUrls(), SpecialPage\checkLoginSecurityLevel(), PhpHttpRequest\execute(), SpecialNewpages\execute(), PopulateInterwiki\fetchLinks(), Title\fixUrlQueryArgs(), AllMessagesTablePager\formatValue(), MediaTransformOutput\getDescLinkAttribs(), getEscapedProfileUrl(), FormAction\getForm(), FormSpecialPage\getForm(), SpecialRunJobs\getQuerySignature(), WebInstaller\getUrl(), AuthManagerSpecialPage\handleReauthBeforeExecute(), UserNotLoggedIn\report(), SkinTemplate\setupTemplateForOutput(), PurgeAction\show(), GlobalTest\testArrayToCGI(), GlobalTest\testArrayToCGI2(), GlobalTest\testCgiRoundTrip(), ChangesListSpecialPage\validateOptions(), and wfAppendQuery().
wfAssembleUrl | ( | $urlParts | ) |
This function will reassemble a URL parsed with wfParseURL.
This is useful if you need to edit part of a URL and put it back together.
This is the basic structure used (brackets contain keys for $urlParts): [scheme][delimiter][user]:[pass]@[host]:[port][path]?[query]#[fragment]
array | $urlParts | URL parts, as output from wfParseUrl |
Definition at line 608 of file GlobalFunctions.php.
Referenced by WfAssembleUrlTest\testWfAssembleUrl(), and wfExpandUrl().
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 1483 of file GlobalFunctions.php.
References $line, $wgCommandLineMode, use, and wfDebugBacktrace().
Referenced by MWDebug\deprecated(), and Revision\RevisionStore\getTitle().
wfBaseName | ( | $path, | |
$suffix = '' |
|||
) |
Return the final portion of a pathname.
Reimplemented because PHP5's "basename()" is buggy with multibyte text. https://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 2470 of file GlobalFunctions.php.
References $matches, and $path.
Referenced by Exif\__construct(), ImageBuilder\checkMissingImage(), FileOpPerfTest\doPerfTest(), ImportImages\execute(), WfBaseNameTest\testBaseName(), wfRelativePath(), and wfStripIllegalFilenameChars().
wfBCP47 | ( | $code | ) |
Get the normalised IETF language tag See unit test for examples.
See mediawiki.language.bcp47 for the JavaScript implementation.
string | $code | The language code. |
Definition at line 3007 of file GlobalFunctions.php.
References $code, LanguageCode\bcp47(), and wfDeprecated().
wfBoolToStr | ( | $value | ) |
Convenience function converts boolean values into "true" or "false" (string) values.
bool | $value |
Definition at line 2812 of file GlobalFunctions.php.
References $value.
Referenced by LocalSettingsGenerator\__construct(), ApiRsd\formatRsdApiList(), LocalSettingsGenerator\getDefaultText(), 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 3163 of file GlobalFunctions.php.
References Hooks\run().
Referenced by LoginSignupSpecialPage\execute(), MediaWiki\Preferences\DefaultPreferencesFactory\getFormDescriptor(), 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 413 of file GlobalFunctions.php.
References $keys, $query, $ret, $value, as, and list.
Referenced by SkinTemplate\buildPersonalUrls(), Linker\link(), Linker\makeBrokenImageLinkObj(), SpecialChangeEmail\onSuccess(), LoginHelper\showReturnToPage(), MediaWiki\Storage\SqlBlobStore\splitBlobAddress(), 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 1816 of file GlobalFunctions.php.
References wfResetOutputBuffers().
Referenced by ApiMain\checkConditionalRequestHeaders().
wfClientAcceptsGzip | ( | $force = false | ) |
Whether the client accept gzip encoding.
Uses the Accept-Encoding header to check if the client supports gzip encoding. Use this when considering to send a gzip-encoded response to the client.
bool | $force | Forces another check even if we already have a cached result. |
Definition at line 1582 of file GlobalFunctions.php.
References wfDebug().
Referenced by MediaWiki\OutputHandler\handleGzip(), HTMLFileCache\loadFromFileCache(), HTMLFileCache\saveToFileCache(), and GlobalTest\testClientAcceptsGzipTest().
wfConfiguredReadOnlyReason | ( | ) |
Get the value of $wgReadOnly or the contents of $wgReadOnlyFile.
Definition at line 1261 of file GlobalFunctions.php.
Referenced by 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 2883 of file GlobalFunctions.php.
References wfDeprecated().
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 988 of file GlobalFunctions.php.
References $context, $wgDebugLogPrefix, $wgDebugRawPage, $wgDebugTimestamps, and wfIsDebugRawPage().
Referenced by QuickTemplate\__construct(), PageArchive\__construct(), UploadFromChunks\__construct(), UploadFromStash\__construct(), ApiMain\__construct(), DifferenceEngine\__construct(), UploadStashFile\__construct(), StubObject\_unstub(), LogPage\actionText(), ImageGalleryBase\add(), MediaHandler\addMeta(), LinkBatch\addObj(), LocalFileMoveBatch\addOlds(), ParserOutput\addTrackingCategory(), Skin\afterContentHook(), SkinTemplate\buildContentActionUrls(), SimpleCaptcha\buildRegexes(), EmailNotification\canSendUserTalkEmail(), SimpleCaptcha\canSkipCaptcha(), CategoryTree\capDepth(), AjaxResponse\checkLastModified(), JobQueueDB\claimOldest(), LocalRepo\cleanupDeletedBatch(), SpecialEditWatchlist\cleanupWatchlist(), UploadStash\clear(), CloneDatabase\cloneTableStructure(), MediaWiki\Storage\SqlBlobStore\compressData(), UploadFromChunks\concatenateChunks(), Article\confirmDelete(), SimpleCaptcha\confirmEditMerged(), BaseDump\debug(), WikiImporter\debug(), RecompressTracked\debug(), SVGReader\debug(), SectionProfiler\debug(), Block\defaultRetroactiveAutoblock(), Article\delete(), Block\deleteIfExpired(), User\deleteNewtalk(), ChangeTags\deleteTagEverywhere(), DiffEngine\diffInternal(), BitmapMetadataHandler\doApp13(), Block\doAutoblock(), JobQueueDB\doBatchPushInternal(), SimpleCaptcha\doConfirmEdit(), WikiPage\doDeleteArticleBatched(), WikiPage\doDeleteArticleReal(), MockImageHandler\doFakeTransform(), WikiFilePage\doPurge(), DatabaseOracle\doQuery(), Block\doRetroactiveAutoblock(), UserrightsPage\doSaveUserGroups(), TransformationalImageHandler\doTransform(), PdfHandler\doTransform(), DjVuHandler\doTransform(), MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), EditPage\edit(), ZipDirectoryReader\error(), ApiUpload\execute(), SpecialUserLogout\execute(), ChangesFeed\execute(), SpecialUpload\execute(), LocalFileRestoreBatch\execute(), DjVuHandler\extractTreesFromMetadata(), PoolWorkArticleView\fallback(), IcuCollation\fetchFirstLetterData(), Article\fetchRevisionRecord(), MediaWikiGadgetsDefinitionRepo\fetchStructuredList(), 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(), WikiPage\getDeletionUpdates(), ForeignDBFile\getDescriptionText(), File\getDescriptionText(), UploadStash\getFile(), DoubleRedirectJob\getFinalDestination(), WikiFilePage\getForeignCategories(), GenderCache\getGenderOf(), MediaHandlerFactory\getHandler(), SpecialUpload\getInitialPageText(), MediaWiki\Interwiki\ClassicInterwikiLookup\getInterwikiCacheEntry(), ParserCache\getKey(), TransformationalImageHandler\getMagickVersion(), RequestContext\getMainAndWarn(), PdfHandler\getMetaArray(), GIFHandler\getMetadata(), PNGHandler\getMetadata(), PNGMetadataExtractor\getMetadata(), GIFMetadataExtractor\getMetadata(), TiffHandler\getMetadata(), JpegHandler\getMetadata(), DjVuHandler\getMetadata(), SvgHandler\getMetadata(), DjVuHandler\getMetaTree(), WebRequestUpload\getName(), Title\getNsText(), WikiPage\getParserOutput(), SpecialEmailUser\getPermissionsError(), EditPage\getPreloadedContent(), UserCache\getProp(), Title\getRestrictionTypes(), ExternalStoreDB\getSlave(), SpecialEmailUser\getTarget(), ForeignAPIRepo\getThumbError(), ForeignAPIRepo\getThumbUrl(), UploadStashFile\getThumbUrl(), ForeignAPIRepo\getThumbUrlFromCache(), Title\getTitleValue(), File\getViewURL(), XCFHandler\getXCFMetaData(), MediaWiki\OutputHandler\handleGzip(), ThumbnailRenderJob\hitThumbUrl(), ForeignAPIRepo\httpGet(), EditPage\importFormData(), WikiRevision\importLogItem(), Block\insert(), ExternalStore\insertWithFallback(), EditPage\internalAttemptSave(), User\isBlockedFrom(), FileCacheBase\isCacheGood(), MediaWiki\Shell\Shell\isDisabled(), PdfHandler\isEnabled(), DjVuHandler\isEnabled(), SvgHandler\isEnabled(), FileDependency\isExpired(), LocalisationCache\isExpired(), Block\isExpired(), WebPHandler\isMetadataValid(), ExifBitmapHandler\isMetadataValid(), PNGHandler\isMetadataValid(), GIFHandler\isMetadataValid(), MovePage\isValidMoveTarget(), Title\isValidMoveTarget(), Block\isWhitelistedFromAutoblocks(), FancyCaptcha\keyMatch(), MessageCache\load(), SiteStats\loadAndLazyInit(), ChangesFeed\loadFromCache(), User\loadFromCache(), HTMLFileCache\loadFromFileCache(), AjaxResponse\loadFromMemcached(), User\loadOptions(), PopulateArchiveRevId\makeDummyRevisionRow(), Linker\makeExternalImage(), Linker\makeExternalLink(), Linker\makeImageLink(), Linker\makeMediaLinkFile(), ImportStreamSource\newFromURL(), WikiImporter\notice(), RawAction\onView(), DumpUploads\outputItem(), Revision\RenderedRevision\outputVariesOnRevisionMetaData(), SearchMySQL\parseQuery(), SearchSqlite\parseQuery(), SearchPostgres\parseQuery(), BacklinkCache\partition(), DiffHistoryBlob\patch(), AjaxDispatcher\performAction(), ApiUpload\performStash(), FancyCaptcha\pickImageDir(), FancyCaptcha\pickImageFromDir(), User\pingLimiter(), MediaWiki\preOutputCommit(), SkinTemplate\prepareQuickTemplate(), SpecialUpload\processUpload(), LocalFile\purgeThumbList(), BacklinkCache\queryLinks(), SvgHandler\rasterize(), TextPassDumper\readDump(), LocalisationCache\recache(), LocalFile\recordUpload2(), UploadStash\removeFileNoAuth(), WikiPage\replaceSectionAtRev(), MediaWiki\restInPeace(), JpegHandler\rotate(), BitmapHandler\rotate(), DoubleRedirectJob\run(), ParserCache\save(), FileCacheBase\saveText(), HTMLFileCache\saveToFileCache(), SearchPostgres\searchQuery(), JpegMetadataExtractor\segmentSplitter(), UserMailer\send(), UserMailer\sendInternal(), UserMailer\sendWithPear(), ApiMain\setCacheMode(), LanguageClassesTestCase\setUp(), ParserTestTopLevelSuite\setUp(), SimpleCaptcha\shouldCheck(), ViewAction\show(), LocalRepo\skipWriteOperationIfSha1(), User\spreadBlock(), UploadStash\stashFile(), FileRepo\storeBatch(), ParserTestTopLevelSuite\tearDown(), GlobalTest\testDebugFunctionTest(), ApiUploadTest\testUploadChunks(), WikiImporter\throwXmlError(), MediaWiki\Tidy\RaggettBase\tidy(), MediaWiki\Tidy\RemexDriver\tidy(), MediaWiki\Tidy\RemexCompatMunger\trace(), 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(), Revision\RevisionRecord\userCanBitfield(), LogEventsList\userCanBitfield(), SpecialEmailUser\validateTarget(), ImageHandler\validateThumbParams(), Article\view(), WikiImporter\warn(), wfClientAcceptsGzip(), wfDebugBacktrace(), wfDebugMem(), wfDiff(), wfGetLangObj(), wfMemoryLimit(), wfMerge(), wfMkdirParents(), wfRecursiveRemoveDir(), and wfTimestamp().
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 1455 of file GlobalFunctions.php.
References wfDebug().
Referenced by MWDebug\getCallerDescription(), wfBacktrace(), wfGetAllCallers(), and wfGetCaller().
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 1082 of file GlobalFunctions.php.
References $context.
Referenced by GitInfo\__construct(), LocalisationCache\__construct(), MediaWikiPHPUnitTestListener\addError(), MediaWikiPHPUnitTestListener\addFailure(), MediaWikiPHPUnitTestListener\addIncompleteTest(), MediaWikiPHPUnitTestListener\addSkippedTest(), AutoLoader\autoload(), ExternalStoreDB\batchFetchBlobs(), RCCacheEntryFactory\buildCLink(), RCCacheEntryFactory\buildDiffLink(), SpamRegexBatch\buildSafeRegexes(), BaseBlacklist\buildSharedBlacklists(), ApiMain\checkBotReadOnly(), EmailBlacklist\checkUser(), BaseBlacklist\clearCache(), UploadFromChunks\concatenateChunks(), IPTC\convIPTCHelper(), RenameuserSQL\debug(), ParserTestTopLevelSuite\debug(), Exif\debug(), Exif\debugFile(), SectionProfiler\debugGroup(), WebPHandler\decodeLosslessChunkHeader(), WebPHandler\decodeLossyChunkHeader(), JobQueueRedis\doAck(), JobQueueRedis\doBatchPush(), FileBackendMultiWrite\doOperationsInternal(), JobQueueRedis\doPop(), TransformationalImageHandler\doTransform(), PdfHandler\doTransform(), DjVuHandler\doTransform(), SvgHandler\doTransform(), MediaWikiPHPUnitTestListener\endTest(), MediaWikiPHPUnitTestListener\endTestSuite(), CheckUsernames\execute(), LocalFileMoveBatch\execute(), WebPHandler\extractMetadata(), WebPHandler\extractMetadataFromChunks(), PoolWorkArticleView\fallback(), ExternalStoreDB\fetchBlob(), SpamBlacklist\filter(), ParserCache\get(), BaseBlacklist\getArticleText(), IPTC\getCharset(), LocalisationCache\getCompiledPluralRules(), ContentHandler\getContentText(), ContentHandler\getForModelID(), BaseBlacklist\getHttpText(), ResourceLoaderImage\getImageData(), ParserCache\getKey(), RequestContext\getLanguage(), LocalFileMoveBatch\getMoveTriplets(), BaseBlacklist\getSharedBlacklists(), ResourceLoaderFileModule\getTemplates(), RequestContext\getTitle(), WebResponse\header(), CdnCacheUpdate\HTCPPurge(), User\inDnsBlacklist(), CreatePdfThumbnailsJob\insertJobs(), ExternalStore\insertWithFallback(), EditPage\internalAttemptSave(), User\isCreatableName(), TitleBlacklist\load(), MessageCache\load(), MessageCache\loadFromDB(), SquidPurgeClient\log(), SimpleCaptcha\log(), MWLBFactory\logDeprecation(), PoolCounterWork\logError(), MediaHandler\logErrorForExternalProcess(), JobQueueFederated\logException(), ApiBase\logFeatureUsage(), ApiMain\logRequest(), SpamBlacklist\logUrlChange(), MediaWiki\main(), TitleBlacklistEntry\matches(), ApiMain\matchRequestedHeaders(), LocalFile\move(), MediaWiki\Site\MediaWikiPageNameNormalizer\normalizePageName(), IPTC\parse(), MessageCache\parse(), User\pingLimiter(), GitInfo\precomputeValues(), MediaWiki\preOutputCommit(), CdnCacheUpdate\purge(), ResourceLoaderFileModule\readStyleFile(), UploadFromUrl\reallyFetchFile(), MediaHandler\removeBadFile(), LocalFileMoveBatch\removeNonexistentFiles(), FileBackendMultiWrite\resyncFiles(), CreatePdfThumbnailsJob\run(), RenameUserJob\run(), SquidPurgeClientPool\run(), ResourceLoaderModule\saveFileDependencies(), UploadFromUrl\saveTempFileChunk(), MWDebug\sendMessage(), WebResponse\setCookie(), MediaWikiPHPUnitTestListener\startTest(), MediaWikiPHPUnitTestListener\startTestSuite(), WebResponse\statusHeader(), IPTC\timeHelper(), and SpamBlacklistHooks\validate().
wfDebugMem | ( | $exact = false | ) |
Send a line giving PHP memory usage.
bool | $exact | Print exact byte values instead of kibibytes (default: false) |
Definition at line 1047 of file GlobalFunctions.php.
References wfDebug().
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 1118 of file GlobalFunctions.php.
References MWDebug\deprecated().
Referenced by MediaWiki\Tidy\RaggettBase\__construct(), MediaWiki\Widget\Search\SimpleSearchResultWidget\__construct(), MediaWiki\Widget\Search\SimpleSearchResultSetWidget\__construct(), DoubleReplacer\__construct(), RegexlikeReplacer\__construct(), HashtableReplacer\__construct(), SearchResultSet\__construct(), Block\__construct(), ApiResult\__construct(), HTMLFormField\__construct(), LoginForm\__construct(), __get(), __set(), DeprecatedGlobal\_newObject(), WebInstallerOutput\addWikiText(), MediaWiki\Session\SessionManager\autoCreateUser(), SearchResultSet\bcIterator(), buildHeadItem(), Hooks\callHook(), Replacer\cb(), User\checkPassword(), User\checkTemporaryPassword(), UtfNormal\cleanUp(), LoginForm\clearCreateaccountToken(), LoginForm\clearLoginThrottle(), LoginForm\clearLoginToken(), ConfirmEditHooks\confirmEditSetup(), User\createNew(), Preferences\datetimePreferences(), Article\doEditContent(), Skin\doEditSectionLink(), Preferences\editingPreferences(), Maintenance\error(), Title\escapeFragmentForURL(), FancyCaptcha\estimateCaptchaCount(), MWTidy\factory(), Interwiki\fetch(), Revision\fetchRevision(), Preferences\filesPreferences(), SpecialRecentChanges\filterByCategories(), Title\fixUrlQueryArgs(), DummyLinker\formatSize(), Linker\formatSize(), DummyLinker\formatTemplates(), Linker\formatTemplates(), Preferences\generateSkinOptions(), Interwiki\getAllPrefixes(), BufferingStatsdDataFactory\getBuffer(), ResourceLoaderWikiModule\getContentObj(), EditPage\getContextTitle(), LoginForm\getCreateaccountToken(), WikiPage\getDeletionUpdates(), ParserOptions\getEditSection(), ParserOutput\getEditSectionTokens(), DifferenceEngine\getEngine(), HTMLForm\getErrors(), LoginSignupSpecialPage\getFakeTemplate(), ApiBase\getFinalDescription(), ApiBase\getFinalSummary(), ReCaptcha\getFormInformation(), User\getGroupMember(), User\getGroupName(), User\getGroupPage(), IcuCollation\getICUVersion(), ActorMigration\getInsertValuesWithTempTable(), JsonContent\getJsonData(), PageArchive\getLastRevisionText(), MWLBFactory\getLBFactoryClass(), ResourceLoaderStartUpModule\getLegacyModules(), MWExceptionHandler\getLogId(), LoginForm\getLoginToken(), HTMLFormField\getNotices(), HTMLInfoField\getOOUI(), Title\getSkinFromCssJsSubpage(), ResourceLoaderStartUpModule\getStartupModules(), StripState\getSubState(), SpecialEmailUser\getTarget(), PageArchive\getTextFromRow(), SpecialPage\getTitle(), ParserOutput\getTOCEnabled(), WatchAction\getUnwatchToken(), MediaWikiTestCase\hideDeprecated(), LoginForm\incLoginThrottle(), LoginForm\incrementLoginThrottle(), Language\initEncoding(), CommentStore\insertWithTempTable(), Interwiki\invalidateCache(), Title\isCssJsSubpage(), Title\isCssOrJsPage(), Title\isCssSubpage(), Title\isJsSubpage(), User\isLocallyBlockedProxy(), Interwiki\isValidInterwiki(), ParserOptions\legacyOptions(), Linker\link(), PageArchive\listAllPages(), Revision\loadFromId(), User\makeGroupLinkHTML(), User\makeGroupLinkWiki(), ContentHandler\makeParserOptions(), Language\markNoConversion(), StripState\merge(), Preferences\miscPreferences(), BaseTemplate\msgHtml(), QuickTemplate\msgHtml(), CommentStore\newKey(), SearchResultSet\next(), ParsoidVirtualRESTService\onParsoid1Request(), RestbaseVirtualRESTService\onParsoid1Request(), SkinTemplate\outputPage(), Revision\pageJoinCond(), prepare(), WikiPage\prepareContentForEdit(), Preferences\profilePreferences(), JobQueueGroup\pushLazyJobs(), UtfNormal\quickIsNFC(), UtfNormal\quickIsNFCVerify(), Preferences\rcPreferences(), ExtensionRegistry\readFromQueue(), ResourceLoaderFileModule\readStyleFiles(), Language\recodeForEdit(), Language\recodeInput(), Preferences\renderingPreferences(), SearchResultSet\rewind(), ApiQuerySearch\run(), Preferences\searchPreferences(), Revision\selectArchiveFields(), OldLocalFile\selectFields(), LocalFile\selectFields(), Block\selectFields(), ArchivedFile\selectFields(), RecentChange\selectFields(), WikiPage\selectFields(), Revision\selectFields(), User\selectFields(), Revision\selectPageFields(), Revision\selectTextFields(), Revision\selectUserFields(), LoginForm\setCreateaccountToken(), ParserOptions\setEditSection(), ParserOutput\setEditSectionTokens(), SearchResult\setExtensionData(), User\setInternalPassword(), LoginForm\setLoginToken(), User\setPassword(), QuickTemplate\setRef(), HTMLForm\setSubmitProgressive(), DifferenceEngine\setTextLanguage(), ParserOutput\setTOCEnabled(), ParserOptions\setWrapOutputClass(), LogEventsList\showOptions(), SpecialSearch\showResults(), EventRelayerGroup\singleton(), MWTidy\singleton(), Preferences\skinPreferences(), UploadFromChunks\stashFile(), UploadFromChunks\stashFileGetKey(), MediaWikiTestCase\stashMwGlobals(), UploadFromChunks\stashSession(), SpecialEmailUser\submit(), EditPage\submit(), UtfNormal\toNFC(), UtfNormal\toNFD(), UtfNormal\toNFKC(), UtfNormal\toNFKD(), Language\truncate(), ApiBase\truncateArray(), EmailNotification\updateWatchlistTimestamp(), Revision\userJoinCond(), SpecialEmailUser\validateTarget(), Preferences\watchlistPreferences(), wfBCP47(), wfCountDown(), wfResetSessionID(), wfSetupSession(), 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 2390 of file GlobalFunctions.php.
References $params, $wgDiff, wfDebug(), and wfTempDir().
Referenced by ParserDiffTest\__call(), CompareParserCache\execute(), and CompareParsers\processRevision().
wfEscapeShellArg | ( | $args | ) |
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|string[] | ...$args strings to escape and glue together, or a single array of strings parameter |
Definition at line 2183 of file GlobalFunctions.php.
References $args.
Referenced by DumpPipeOutput\__construct(), DumpPipeOutput\closeAndRename(), PopulateImageSha1\doDBUpdates(), PdfHandler\doTransform(), DjVuHandler\doTransform(), HHVMMakeRepo\execute(), GenerateFancyCaptchas\execute(), TransformationalImageHandler\getMagickVersion(), MWDocGen\init(), ParserTestPrinter\quickDiff(), SvgHandler\rasterize(), ResourceLoaderImage\rasterize(), Maintenance\readlineEmulation(), CheckStorage\restoreText(), JpegHandler\rotate(), BitmapHandler\rotate(), Dump7ZipOutput\setup7zCommand(), RecompressTracked\startReplicaProcs(), SevenZipStream\stream_open(), JpegHandler\swapICCProfile(), WfEscapeShellArgTest\testMultipleArgs(), WfEscapeShellArgTest\testMultipleArgsAsArray(), WfEscapeShellArgTest\testSingleInput(), BitmapHandler\transformCustom(), BitmapHandler\transformImageMagick(), 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 |
-taint | $text | escapes_html |
Definition at line 1617 of file GlobalFunctions.php.
References $wgEnableMagicLinks, $wgUrlProtocols, and as.
Referenced by MediaHandler\addMeta(), CoreParserFunctions\basepagename(), CoreParserFunctions\basepagenamee(), SpecialPageLanguage\changePageLanguage(), ApiMain\checkAsserts(), ApiQueryImageInfo\checkParameterNormalise(), SpecialContributions\contributionsSub(), ApiMain\createPrinterByName(), CoreParserFunctions\defaultsort(), Article\delete(), CoreParserFunctions\displaytitle(), FileDeleteForm\doDelete(), Article\doDelete(), WikiPage\doDeleteArticleBatched(), ApiCSPReport\error(), ApiMain\errorMessagesFromException(), ApiValidatePassword\execute(), ApiCategoryTree\execute(), ApiProtect\execute(), ApiUndelete\execute(), ApiMergeHistory\execute(), ApiMove\execute(), ApiEditPage\execute(), ApiExpandTemplates\execute(), ApiQueryTitleBlacklist\execute(), ApiQueryAllMessages\execute(), ApiOptions\execute(), ApiComparePages\execute(), ApiParse\execute(), SpecialUnblock\execute(), ApiQueryLogEvents\execute(), ApiQueryUserContribs\execute(), ApiUserrights\execute(), ApiLinkAccount\execute(), ApiAMCreateAccount\execute(), ApiClientLogin\execute(), FileDuplicateSearchPage\execute(), SpecialMergeHistory\execute(), PasswordReset\execute(), ApiQueryRevisionsBase\extractDeprecatedContent(), ApiBase\extractRequestParams(), ApiQueryRevisionsBase\extractRevisionInfo(), CoreParserFunctions\fullpagename(), CoreParserFunctions\fullpagenamee(), ApiComparePages\getDiffRevision(), ApiFeedRecentChanges\getFeedObject(), ApiErrorFormatter\getMessageFromException(), ApiBase\getModuleFromPath(), ApiRollback\getRbTitle(), ApiRollback\getRbUser(), TextSlotDiffRenderer\getTextDiffInternal(), ApiBase\getTitleFromTitleOrPageId(), ApiBase\getTitleOrPageId(), ApiBase\getWatchlistUser(), EditPage\importFormData(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\makeFailResponse(), SpecialBlock\maybeAlterFormDefaults(), ApiQueryImageInfo\mergeThumbParams(), SpecialRandomInCategory\onSubmit(), SpecialBlock\onSuccess(), ImagePage\openShowImage(), ImageListPager\outputUserDoesNotExist(), CoreParserFunctions\pagename(), CoreParserFunctions\pagenamee(), ApiBase\parseMultiValue(), SpecialBlock\postText(), ApiQueryBase\prefixedTitlePartToKey(), FileDeleteForm\prepareMessage(), ApiQueryBlocks\prepareUsername(), CoreParserFunctions\rootpagename(), CoreParserFunctions\rootpagenamee(), ApiQueryImages\run(), ApiQueryCategories\run(), ApiQueryLinks\run(), ApiQueryRevisions\run(), ApiQueryRecentChanges\run(), ApiMain\setupModule(), 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(), CoreParserFunctionsTest\testGender(), ApiQueryBase\titlePartToKey(), ApiFileRevert\validateParameters(), SpecialBlock\validateTarget(), ApiBase\validateTimestamp(), and ApiBase\validateUser().
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 884 of file GlobalFunctions.php.
References $matches, array(), and wfExpandUrl().
Referenced by Skin\printSource(), and GlobalTest\testExpandIRI().
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 | int | null | $defaultProto | One of the PROTO_* constants. Determines the protocol to use if $url or $wgServer is protocol-relative |
Definition at line 512 of file GlobalFunctions.php.
References $wgCanonicalServer, $wgHttpsPort, $wgInternalServer, $wgRequest, $wgServer, PROTO_CANONICAL, PROTO_CURRENT, PROTO_HTTP, PROTO_HTTPS, PROTO_INTERNAL, wfAssembleUrl(), wfParseUrl(), and wfRemoveDotSegments().
Referenced by MWHttpRequest\__construct(), DumpCategoriesAsRdf\addDumpHeader(), EmailNotification\composeCommonMailtext(), ApiQueryExternalLinks\execute(), SpecialApiHelp\execute(), ApiQueryLangLinks\execute(), ApiQueryIWLinks\execute(), CdnCacheUpdate\expand(), ApiQueryInfo\extractPageInfo(), CoreParserFunctions\filepath(), MediaWiki\Widget\Search\InterwikiSearchResultSetWidget\footerHtml(), ApiParse\formatIWLinks(), ApiParse\formatLangLinks(), File\getCanonicalUrl(), Title\getCanonicalURL(), SpecialVersion\getEntryPointInfo(), RevertAction\getFormFields(), File\getFullUrl(), Title\getFullURL(), ApiQueryImageInfo\getInfo(), LocalRepo\getInfo(), Title\getInternalURL(), ApiRsd\getRsdApiList(), FeedItem\getUniqueIdUnescaped(), MediaWiki\Widget\Search\SimpleSearchResultSetWidget\headerHtml(), ForeignAPIRepo\httpGet(), BaseBlacklist\isLocalSource(), MediaWiki\Widget\Search\InterwikiSearchResultSetWidget\iwIcon(), MediaWiki\main(), RevertAction\onSuccess(), SpecialUploadStash\outputRemoteScaledThumb(), MediaWiki\performAction(), FileDeleteForm\prepareMessage(), ApiMainTest\provideExceptionErrors(), ApiQuerySiteinfoTest\rightsInfoProvider(), ApiQueryExtLinksUsage\run(), ApiOpenSearch\search(), SearchSuggestion\setSuggestedTitle(), EditPage\showIntro(), ApiMain\substituteResultWithError(), ApiQuerySiteinfoTest\testInterwikiMap(), SpecialSearchTest\testSubPageRedirect(), WfExpandUrlTest\testWfExpandUrl(), File\transform(), MediaWiki\tryNormaliseRedirect(), wfExpandIRI(), wfGetServerUrl(), and wfStreamThumb().
wfFindFile | ( | $title, | |
$options = [] |
|||
) |
Find a file.
Shortcut for RepoGroup::singleton()->findFile()
string | Title | $title | String or Title object |
array | $options | Associative array of options (see RepoGroup::findFile) |
Definition at line 2734 of file GlobalFunctions.php.
References $options, $title, and RepoGroup\singleton().
Referenced by UploadFromUrlTest\deleteFile(), ApiUploadTestCase\deleteFileByTitle(), SpecialRedirect\dispatchFile(), MovePageForm\doSubmit(), ApiImageRotate\execute(), ApiMove\execute(), DeleteBatch\execute(), FileDuplicateSearchPage\execute(), WantedFilesPage\existenceCheck(), CoreParserFunctions\filepath(), MediaWiki\Widget\Search\FullSearchResultWidget\generateFileHtml(), SearchNearMatcher\getNearMatchInternal(), ExtParserFunctions\ifexistCommon(), SearchResult\initFromTitle(), Title\isAlwaysKnown(), WikiFilePage\loadFile(), ImagePage\loadFile(), Linker\makeBrokenImageLinkObj(), Linker\makeMediaLinkObj(), Linker\makeThumbLink2(), DumpUploads\outputItem(), InfoAction\pageInfo(), ImageMap\render(), EditPage\showIntro(), TraditionalImageGallery\toHTML(), Title\validateFileMoveOperation(), and wfIsBadImage().
wfForeignMemcKey | ( | $db, | |
$prefix, | |||
$args | |||
) |
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 2617 of file GlobalFunctions.php.
References $args, and ObjectCache\getLocalClusterInstance().
Referenced by JobQueue\getRootJobCacheKey(), ForeignDBRepo\getSharedCacheKey(), and GlobalTest\testWfForeignMemcKey().
wfFormatStackFrame | ( | $frame | ) |
Return a string representation of frame.
array | $frame |
Definition at line 1551 of file GlobalFunctions.php.
Referenced by wfGetCaller().
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 1536 of file GlobalFunctions.php.
References captcha-old\count, and wfDebugBacktrace().
Referenced by MediaWiki\Session\SessionBackend\addData(), MediaWiki\Session\SessionBackend\dirty(), RequestContext\getTitle(), MessageCache\parse(), 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 3019 of file GlobalFunctions.php.
References ObjectCache\getInstance().
Referenced by JobQueue\__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 1520 of file GlobalFunctions.php.
References wfDebugBacktrace(), and wfFormatStackFrame().
Referenced by StubObject\_unstub(), DeferredUpdates\addCallableUpdate(), MediaWikiTestCase\assertSelect(), WfGetCallerTest\callerOne(), ParserTestTopLevelSuite\debug(), MediaWiki\Shell\Command\execute(), WfGetCallerTest\intermediateFunction(), MWDebug\log(), WfGetCallerTest\testZero(), MediaWiki\HeaderCallback\warnIfHeadersSent(), wfShellExec(), and wfShellExecWithStderr().
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 2693 of file GlobalFunctions.php.
References wfGetLB().
Referenced by SpecialRandomrootpage\__construct(), MergeHistoryPager\__construct(), SearchDatabase\__construct(), DeletedContribsPager\__construct(), ContribsPager\__construct(), ImageListPager\__construct(), MergeHistory\__construct(), LogPager\__construct(), Block\__construct(), IndexPager\__construct(), Pingback\acquireLock(), BotPasswordTest\addDBData(), ApiComparePagesTest\addDBDataOnce(), MediaWiki\Session\BotPasswordSessionProviderTest\addDBDataOnce(), LinkCache\addLinkObj(), LogPage\addRelations(), User\addToDatabase(), MediaWikiTestCase\assertSelect(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProvider\beginSecondaryAccountCreation(), ImageListPager\buildQueryConds(), SpecialPageLanguage\changePageLanguage(), CheckStorage\check(), User\checkAndSetTouched(), Pingback\checkIfSent(), TrackBlobs\checkIntegrity(), User\checkNewtalk(), RenameUserCleanup\checkRenameLog(), RevisionDeleter\checkRevisionExistence(), RecompressTracked\checkTrackingTable(), MediaWiki\Tests\Maintenance\PopulateChangeTagDefTest\cleanChangeTagTables(), MediaWiki\Tests\Maintenance\DeleteAutoPatrolLogsTest\cleanLoggingTable(), CgzCopyTransaction\commit(), WikiPage\commitRollback(), Title\countRevisionsBetween(), SearchEngineFactory\create(), User\createNew(), ChangesListSpecialPageTest\createUsers(), Block\defaultRetroactiveAutoblock(), PrefixSearch\defaultSearchBackend(), ChangeTags\defineTag(), UserGroupMembership\delete(), SearchMySQL\delete(), Block\delete(), Article\delete(), DifferenceEngine\deletedLink(), User\deleteNewtalk(), ChangeTags\deleteTagEverywhere(), Title\deleteTitleProtection(), SpecialUndelete\diffHeader(), RecompressTracked\doAllOrphans(), RecompressTracked\doAllPages(), UsersPager\doBatchLookups(), CategoryViewer\doCategoryQuery(), FileDeleteForm\doDelete(), WikiPage\doDeleteArticleBatched(), SpecialExport\doExport(), SpecialRecentChangesLinked\doMainQuery(), RecompressTracked\doOrphanList(), RecompressTracked\doPage(), PopulateInterwiki\doPopulate(), UserCache\doQuery(), GenderCache\doQuery(), LinkBatch\doQuery(), ReplaceTextSearch\doSearchQuery(), SpecialInterwiki\doSubmit(), MovePageForm\doSubmit(), WikiPage\doUpdateRestrictions(), LinkHolderArray\doVariants(), Title\estimateRevisionCount(), CleanupArchiveUserText\execute(), Cleanup\execute(), SpecialRenameuser\execute(), ApiSetNotificationTimestamp\execute(), ParserTestsMaintenance\execute(), QueryPage\fetchFromCache(), HistoryAction\fetchRevisions(), ChangesListSpecialPageTest\fetchUsers(), TrackBlobs\findOrphanBlobs(), User\findUsersByGroup(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\finishAccountCreation(), RecompressTracked\finishIncompleteMoves(), DoubleRedirectJob\fixRedirects(), EditPageTest\forceRevisionDate(), ApiEditPageTest\forceRevisionDate(), ApiResult\formatExpiry(), Language\formatExpiry(), DoubleRedirectsPage\formatResult(), LCStoreDB\get(), User\getActorId(), MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixesDB(), PageProps\getAllProperties(), BaseBlacklist\getArticleText(), Title\getAuthorsBetween(), ContentHandler\getAutoDeleteReason(), EditPage\getBaseRevision(), SpecialBlockList\getBlockListPager(), Block\getBlocksForIPList(), Title\getBrokenLinksFrom(), QueryPage\getCachedTimestamp(), Title\getCascadeProtectionSources(), WikiPage\getCategories(), RCDatabaseLogEntry\getComment(), ApiCategoryTree\getConditionalRequestData(), ResourceLoaderWikiModule\getContentObj(), WikiPage\getContributors(), RevDelRevisionList\getCurrent(), SpamBlacklist\getCurrentLinks(), AllMessagesTablePager\getCustomisedStatuses(), RangeChronologicalPagerTest\getDateRangeCondProvider(), UserRightsProxy\getDB(), BacklinkCache\getDB(), ResourceLoaderWikiModule\getDB(), LinksDeletionUpdate\getDB(), SpecialRecentChanges\getDB(), SpecialWatchlist\getDB(), ApiBase\getDB(), LinksUpdate\getDB(), Maintenance\getDB(), ChangesListSpecialPage\getDB(), LocalRepo\getDBFactory(), User\getEditCount(), ResourceLoaderModule\getFileDependencies(), DoubleRedirectJob\getFinalDestination(), User\getFirstEditTimestamp(), Title\getFirstRevision(), User\getFormerGroups(), GadgetDefinitionNamespaceRepo\getGadget(), GadgetDefinitionNamespaceRepo\getGadgetIds(), WikiPage\getHiddenCategories(), SpecialActiveUsers\getIntroText(), EditPage\getLastDelete(), PageArchive\getLastRevisionId(), SpecialExport\getLinks(), Title\getLinksFrom(), SimpleCaptcha\getLinksFromTracker(), Title\getLinksTo(), DifferenceEngine\getMarkPatrolledLinkInfo(), LocalRepo\getMasterDB(), ReplaceTextSearch\getMatchingTitles(), Category\getMembers(), UserGroupMembership\getMembership(), UserGroupMembership\getMembershipsForUser(), SpecialRandomInCategory\getMinAndMaxForCat(), ApiQuery\getNamedDB(), User\getNewMessageLinks(), SpecialNuke\getNewPages(), Pingback\getOrCreatePingbackId(), SpecialExport\getPagesFromCategory(), SpecialExport\getPagesFromNamespace(), Title\getParentCategories(), PageArchive\getPreviousRevision(), PageProps\getProperties(), WantedPagesPage\getQueryInfo(), BrokenRedirectsPage\getQueryInfo(), NewFilesPager\getQueryInfo(), DeletedContribsPager\getQueryInfo(), UnwatchedpagesPage\getQueryInfo(), MediaStatisticsPage\getQueryInfo(), UncategorizedCategoriesPage\getQueryInfo(), SpecialGadgetUsage\getQueryInfo(), WithoutInterwikiPage\getQueryInfo(), UsersPager\getQueryInfo(), LinkSearchPage\getQueryInfo(), SpecialRandomInCategory\getQueryInfo(), Block\getRangeCond(), QueryPage\getRecacheDB(), Title\getRedirectsHere(), WikiPage\getRedirectTarget(), Title\getRelativeRevisionID(), LocalRepo\getReplicaDB(), PageArchive\getRevision(), PageArchive\getRevisionByConditions(), Linker\getRollbackEditCount(), Title\getSubpages(), MIMEsearchPage\getSuggestionsForTypes(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\getTestPage(), HistoryBlobStub\getText(), HistoryBlobCurStub\getText(), TrackBlobs\getTextClause(), Title\getTitleProtectionInternal(), Title\getTouched(), SpecialUpload\getUploadForm(), PasswordReset\getUsersByEmail(), LCStoreDB\getWriteConnection(), User\idForName(), User\idFromName(), WikiRevision\importLogItem(), CheckStorage\importRevision(), User\incEditCount(), User\incEditCountImmediate(), User\initEditCount(), Block\initFromRow(), Category\initialize(), BackupDumper\initProgress(), TrackBlobs\initTrackingTable(), UserGroupMembership\insert(), Block\insert(), ManualLogEntry\insert(), MediaWiki\Tests\Maintenance\PopulateChangeTagDefTest\insertChangeTagData(), MediaWiki\Tests\Maintenance\DeleteAutoPatrolLogsTest\insertLoggingData(), WikiPage\insertProtectNullRevision(), WikiPage\insertRedirect(), WikiPage\insertRedirectEntry(), Title\invalidateCache(), HTMLCacheUpdateJob\invalidateTitles(), WikiPage\isBatchedDelete(), Title\isBigDeletion(), WikiPage\isCountable(), PageArchive\isDeleted(), Title\isDeleted(), Title\isDeletedQuick(), Title\isNewPage(), Title\isSingleRevRedirect(), Block\isWhitelistedFromAutoblocks(), ApiStashEdit\lastEditTime(), LogPager\limitPerformer(), PageArchive\listAllPages(), ChangeTags\listExplicitlyDefinedTags(), ChangeTags\listExplicitlyDefinedTagsNewBackend(), PageArchive\listFiles(), PageArchive\listPagesByPrefix(), PageArchive\listPagesBySearch(), PageArchive\listRevisions(), ChangeTags\listSoftwareActivatedTags(), ChangeTags\listSoftwareDefinedTags(), ArchivedFile\load(), MediaWiki\Interwiki\ClassicInterwikiLookup\load(), User\load(), MessageCache\loadCachedMessagePageEntry(), User\loadFromCache(), User\loadFromDatabase(), MessageCache\loadFromDB(), ArchivedFile\loadFromRow(), RecentChange\loadFromRow(), MediaWikiGadgetsDefinitionRepo\loadGadgets(), User\loadGroups(), WikiPage\loadLastEdit(), User\loadOptions(), Title\loadRestrictions(), Title\loadRestrictionsFromRows(), DifferenceEngine\loadRevisionData(), WikiPage\lockAndGetLatest(), RenameuserSQL\lockUserAndGetId(), ProfilerOutputDb\log(), ChangeTags\logTagManagementAction(), LocalIdLookup\lookupCentralIds(), LocalIdLookup\lookupUserNames(), LinkFilter\makeLikeArray(), RevisionDbTestBase\makeRevisionWithProps(), Pingback\markSent(), EditPage\mergeChangesIntoContent(), SearchMySQL\minSearchLength(), ChangeTags\modifyDisplayQuery(), MovePage\move(), RecompressTracked\moveTextRow(), moveToExternal(), MovePage\moveToInternal(), LinkSearchPage\mungeQuery(), Title\nameOf(), RecentChange\newFromConds(), User\newFromConfirmationCode(), WikiPage\newFromID(), Block\newFromID(), Title\newFromID(), UserArray\newFromIDs(), Title\newFromIDs(), UserArray\newFromNames(), Block\newLoad(), User\newSystemUser(), ChangeTags\newTagUsageStatistics(), ChangesListSpecialPageTest\normalizeCondition(), RecentChange\notifyEdit(), RecentChange\notifyNew(), InterwikiHooks\onInterwikiLoadPrefix(), CategoryTreeHooks\onSpecialTrackingCategoriesPreprocess(), HistoryAction\onView(), ImagePage\openShowImage(), InfoAction\pageCounts(), ApiStashEdit\parseAndStash(), ClassicInterwikiLookupTest\populateDB(), InterwikiTest\populateDB(), ReplaceTextSearch\prefixCondition(), MediaWiki\Tests\Revision\NoContentModelRevisionStoreDbTest\provideGetSlotsQueryInfo(), CommentStoreTest\provideInsertRoundTrip(), ActorMigrationTest\provideInsertRoundTrip(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\providerChangeAuthenticationData(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\providerChangeAuthenticationData(), MediaWiki\Tests\Revision\RevisionQueryInfoTest\provideSlotsQueryInfo(), ManualLogEntry\publish(), Block\purgeExpired(), Title\purgeExpiredRestrictions(), RecentChangesUpdateJob\purgeExpiredRows(), SpecialPagesWithProp\queryExistingProps(), ImagePage\queryImageLinks(), DoubleRedirectsPage\reallyGetQueryInfo(), RecentChange\reallyMarkPatrolled(), RebuildRecentchanges\rebuildRecentChangesTablePass5(), QueryPage\recache(), MessageBlobStore\recacheMessageBlob(), Category\refreshCounts(), Category\refreshCountsIfEmpty(), ChangeTagsList\reloadFromMaster(), RevDelList\reloadFromMaster(), RenameuserSQL\rename(), CategoryTree\renderChildren(), CategoryTree\renderParents(), LinkHolderArray\replaceInternal(), ImportReporter\reportPage(), RevisionListBase\reset(), resolveStub(), resolveStubs(), CheckStorage\restoreText(), DeleteLinksJob\run(), RenameUserJob\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(), PagePropsTest\setProperties(), DatabaseIntegrationTest\setUp(), ApiQueryRecentChangesIntegrationTest\setUp(), LinksUpdateTest\setUp(), PageArchiveTestBase\setUp(), ParserTestTopLevelSuite\setUp(), ApiLoginTest\setUpForBotPassword(), MediaWikiShell\setupLegacy(), RevisionDeleteUser\setUsernameBitfields(), RevDelList\setVisibility(), SpecialAllPages\showChunk(), SpecialInterwiki\showForm(), MovePageForm\showForm(), SpecialReplaceText\showForm(), SpecialWhatLinksHere\showIndirectLinks(), EditPage\showIntro(), SpecialInterwiki\showList(), LogEventsList\showLogExtract(), Article\showMissingArticle(), Article\showPatrolFooter(), SpecialPrefixindex\showPrefixChunk(), UserOptionsMaintenance\showUsageStats(), SpecialVersion\softwareInformation(), 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(), ApiBlockTest\testBlockWithEmailBlock(), ApiBlockTest\testBlockWithExpiry(), ApiBlockTest\testBlockWithHide(), ApiBlockTest\testBlockWithTag(), ApiBlockTest\testBlockWithTagNewBackend(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testCountRevisionsByPageId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testCountRevisionsByTitle(), EditPageTest\testCreatePageTrx(), ChangeTagsTest\testDeleteTagsMigrationOld(), ChangeTagsTest\testDeleteTagsMigrationWriteBoth(), ApiDeleteTest\testDeleteWithTag(), ApiDeleteTest\testDeleteWithTagNewBackend(), WikiPageDbTestBase\testDoDeleteArticle(), WikiPageDbTestBase\testDoDeleteUpdates(), WikiPageDbTestBase\testDoEditContent(), WikiPageDbTestBase\testDoEditUpdates(), SiteStatsUpdateTest\testDoUpdate(), MediaWiki\Tests\Maintenance\PopulateChangeTagDefTest\testDryRunMigrationNew(), MediaWiki\Tests\Maintenance\PopulateChangeTagDefTest\testDryRunMigrationWriteBoth(), ApiEditPageTest\testEditWithTag(), ApiEditPageTest\testEditWithTagNewBackend(), UserTest\testExperienceLevel(), MediaWiki\Tests\Maintenance\DeleteAutoPatrolLogsTest\testFromId(), ReverseChronologicalPagerTest\testGetDateCond(), TitleTest\testGetFragmentForURL(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetParentLengths(), RevisionDbTestBase\testGetParentLengths_multipleRevIds(), RevisionDbTestBase\testGetParentLengths_noRevIds(), RevisionDbTestBase\testGetParentLengths_oneRevId(), BotPasswordTest\testGetPassword(), ResourceLoaderWikiModuleTest\testGetPreloadedBadTitle(), ResourceLoaderWikiModuleTest\testGetPreloadedTitleInfo(), ResourceLoaderWikiModuleTest\testGetPreloadedTitleInfoEmpty(), RevisionDbTestBase\testInsertOn(), RevisionDbTestBase\testInsertOn_exceptionOnIncomplete(), RevisionDbTestBase\testInsertOn_success(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_archive(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_blobAddressExists(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_failures(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_successes(), ApiQuerySiteinfoTest\testInterwikiMap(), ChangeTagsTest\testListExplicitlyDefinedTagsNew(), ChangeTagsTest\testListExplicitlyDefinedTagsOld(), ChangeTagsTest\testListExplicitlyDefinedTagsWriteBoth(), RevisionDbTestBase\testLoadFromId(), RevisionDbTestBase\testLoadFromPageId(), RevisionDbTestBase\testLoadFromPageIdWithLatestRevId(), RevisionDbTestBase\testLoadFromPageIdWithNotLatestRevId(), RevisionDbTestBase\testLoadFromTimestamp(), RevisionDbTestBase\testLoadFromTitle(), RevisionDbTestBase\testLoadFromTitleWithLatestRevId(), RevisionDbTestBase\testLoadFromTitleWithNotLatestRevId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromPageId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromTimestamp(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromTitle(), ChangeTagsTest\testModifyDisplayQuery(), RevisionDbTestBase\testNewFromArchiveRow(), RevisionDbTestBase\testNewFromArchiveRowOverrides(), MediaWiki\Session\UserInfoTest\testNewFromId(), RevisionDbTestBase\testNewFromRow(), RevisionDbTestBase\testNewKnownCurrent(), RevisionDbTestBase\testNewKnownCurrent_returnsFalseWhenTitleDoesntExist(), RevisionDbTestBase\testNewKnownCurrent_withPageId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewNullRevision(), RevisionDbTestBase\testNewNullRevision(), RevisionDbTestBase\testNewNullRevision_badPage(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewNullRevision_nonExistingTitle(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_getArchiveQueryInfo(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_legacyEncoding(), LBFactoryTest\testNiceDomains(), MessageCacheTest\testNoDBAccess(), ApiStashEditTest\testPageWithNoRevisions(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationDataEmail(), ChangesListSpecialPageTest\testRcHidebyothersFilter(), ChangesListSpecialPageTest\testRcHidemyselfFilter(), LBFactoryTest\testRedefineLocalDomain(), MessageCacheTest\testReplaceMsg(), MediaWiki\Tests\Maintenance\PopulateChangeTagDefTest\testRun(), MediaWiki\Tests\Maintenance\DeleteAutoPatrolLogsTest\testRun(), MediaWiki\Tests\Maintenance\PopulateChangeTagDefTest\testRunUpdateHitCountMigrationNew(), MediaWiki\Tests\Maintenance\PopulateChangeTagDefTest\testRunUpdateHitCountMigrationWriteBoth(), PrefixSearchTest\testSearch(), PrefixSearchTest\testSearchWithOffset(), MultiWriteBagOStuffTest\testSetDelayed(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), CategoryChangesRdfTest\testSparqlUpdate(), DatabaseIntegrationTest\testStoredFunctions(), MultiWriteBagOStuffTest\testSyncMerge(), ChangeTagsTest\testTagUsageStatisticsNewBackend(), ChangeTagsTest\testTagUsageStatisticsNewMigrationOldBackedn(), ChangeTagsTest\testTagUsageStatisticsOldBackend(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testTestUserCanAuthenticate(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testTestUserCanAuthenticate(), LBFactoryTest\testTrickyDomain(), DeferredUpdatesTest\testTryOpportunisticExecute(), ApiUnblockTest\testUnblockWithTag(), ApiUnblockTest\testUnblockWithTagNewBackend(), PageArchiveTestBase\testUndeleteRevisions(), ApiEditPageTest\testUndoAfterToInvalidRev(), ApiEditPageTest\testUndoWithSwappedRevisions(), ImportTest\testUnknownUserHandling(), EditPageTest\testUpdatePageTrx(), ChangeTagsTest\testUpdateTagsMigrationOld(), ChangeTagsTest\testUpdateTagsMigrationWriteBoth(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\testUserCanAuthenticate(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\testUserCanAuthenticate(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\testUserExists(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\testUserExists(), RevisionDbTestBase\testUserWasLastToEdit(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testUserWasLastToEdit_false(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testUserWasLastToEdit_true(), ApiUserrightsTest\testWithTag(), ApiUserrightsTest\testWithTagNewBackend(), TrackBlobs\trackOrphanText(), TrackBlobs\trackRevisions(), ChangeTags\undefineTag(), PageArchive\undeleteRevisions(), SearchOracle\update(), SearchSqlite\update(), SearchMySQL\update(), Block\update(), RecentChangesUpdateJob\updateActiveUsers(), WikiPage\updateCategoryCounts(), User\updateNewtalk(), UserOptionsMaintenance\updateOptions(), RenameUserCleanup\updateTable(), ChangeTags\updateTags(), ChangeTags\updateTagSummaryRow(), ChangeTags\updateTagsWithChecks(), Block\updateTimestamp(), SearchOracle\updateTitle(), SearchSqlite\updateTitle(), SearchMySQL\updateTitle(), ActivityUpdateJob\updateWatchlistNotification(), Revision\userWasLastToEdit(), and ApiTag\validateLogId().
wfGetLangObj | ( | $langcode = false | ) |
Return a Language object from $langcode.
Language | string | bool | $langcode | Either:
|
Definition at line 1281 of file GlobalFunctions.php.
References $wgLang, $wgLanguageCode, Language\factory(), Language\fetchLanguageNames(), and wfDebug().
Referenced by Skin\doEditSectionLink(), SpecialAllMessages\execute(), MessageCache\get(), ContentHandler\getPageLanguage(), Title\getPageLanguage(), 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 2706 of file GlobalFunctions.php.
Referenced by wfGetDB().
wfGetLBFactory | ( | ) |
Get the load balancer factory object.
Definition at line 2722 of file GlobalFunctions.php.
wfGetMainCache | ( | ) |
Get the main cache object.
Definition at line 3029 of file GlobalFunctions.php.
References ObjectCache\getLocalClusterInstance().
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 3038 of file GlobalFunctions.php.
References $wgMessageCacheType, and ObjectCache\getInstance().
Referenced by UploadFromUrlTestSuite\setUp(), and MessageCache\singleton().
wfGetNull | ( | ) |
Get a platform-independent path to the null file, e.g.
/dev/null
Definition at line 2821 of file GlobalFunctions.php.
References wfIsWindows().
Referenced by MediaWiki\Tidy\RaggettExternal\cleanWrapped(), and Dump7ZipOutput\setup7zCommand().
wfGetPrecompiledData | ( | $name | ) |
Get an object from the precompiled serialized directory.
string | $name |
Definition at line 2583 of file GlobalFunctions.php.
References $blob, $IP, and unserialize().
Referenced by IcuCollation\fetchFirstLetterData().
wfGetRusage | ( | ) |
Get system resource usage of current request context.
Invokes the getrusage(2) system call, requesting RUSAGE_SELF if on PHP5 or RUSAGE_THREAD if on HHVM. Returns false if getrusage is not available.
Definition at line 3303 of file GlobalFunctions.php.
Referenced by JobRunner\getMaxRssKb(), SectionProfiler\getTime(), and ParserOutput\getTimes().
wfGetScriptUrl | ( | ) |
wfGetServerUrl | ( | $proto | ) |
Get the wiki's "server", i.e.
the protocol and host part of the URL, with a protocol specified using a PROTO_* constant as in wfExpandUrl()
string | int | null | $proto | One of the PROTO_* constants. |
Definition at line 590 of file GlobalFunctions.php.
References wfExpandUrl().
Referenced by WebRequest\getFullRequestURL().
wfGlobalCacheKey | ( | $args | ) |
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 2634 of file GlobalFunctions.php.
References $args, and ObjectCache\getLocalClusterInstance().
Referenced by SimpleCaptcha\badLoginKey(), SimpleCaptcha\badLoginPerUserKey(), 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 1392 of file GlobalFunctions.php.
References $wgOverrideHostname.
Referenced by MediaWiki\Logger\Monolog\WikiProcessor\__invoke(), ApiMain\addRequestedFields(), MWLBFactory\applyDefaultConfig(), DifferenceEngine\debug(), TransformationalImageHandler\doTransform(), PdfHandler\doTransform(), DjVuHandler\doTransform(), SvgHandler\doTransform(), MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(), MediaWiki\Logger\LegacyLogger\formatAsWfLogDBError(), ApiMain\getMaxLag(), ProfilerOutputDb\log(), MediaHandler\logErrorForExternalProcess(), RecompressTracked\logToFile(), ApiMainTest\provideExceptionErrors(), Maintenance\setAgentAndTriggers(), wfReportTime(), and wfThumbError().
wfHttpError | ( | $code, | |
$label, | |||
$desc | |||
) |
Provide a simple HTTP error.
int | string | $code | |
string | $label | |
string | $desc |
Definition at line 1725 of file GlobalFunctions.php.
References $code, $wgOut, HttpStatus\header(), and MediaWiki\HeaderCallback\warnIfHeadersSent().
Referenced by SpecialRunJobs\execute(), RawAction\getRawText(), MWExceptionRenderer\output(), AjaxDispatcher\performAction(), MWException\report(), and FancyCaptcha\showImage().
wfIncrStats | ( | $key, | |
$count = 1 |
|||
) |
Increment a statistics counter.
string | $key | |
int | $count |
Definition at line 1227 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 2146 of file GlobalFunctions.php.
References wfStringToBool().
Referenced by MediaWiki\Http\HttpRequestFactory\canMakeRequests(), MWHttpRequest\canMakeRequests(), MediaWiki\Http\HttpRequestFactory\create(), MWHttpRequestTester\factory(), WebInstaller\startSession(), and MediaWiki\Session\PHPSessionHandlerTest\testInstall().
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 | null | $blacklist | Wikitext of a file blacklist |
Definition at line 3093 of file GlobalFunctions.php.
References $cache, $line, $lines, $name, $title, as, ObjectCache\getLocalServerInstance(), Title\newFromText(), Hooks\run(), wfFindFile(), and wfMessage().
Referenced by ApiQueryImageInfo\execute(), ImageMap\render(), GlobalWithDBTest\testWfIsBadImage(), and TraditionalImageGallery\toHTML().
wfIsCLI | ( | ) |
Check if we are running from the commandline.
Definition at line 2016 of file GlobalFunctions.php.
Referenced by ForkController\__construct(), MediaWiki\Logger\Monolog\WikiProcessor\__invoke(), UIDGenerator\getSequentialPerNodeIDs(), MWExceptionHandler\handleUncaughtException(), and ProfilerOutputText\log().
wfIsDebugRawPage | ( | ) |
Returns true if debug logging should be suppressed if $wgDebugRawPage = false.
Definition at line 1022 of file GlobalFunctions.php.
References $cache.
Referenced by wfDebug(), and wfLogProfilingData().
wfIsHHVM | ( | ) |
Check if we are running under HHVM.
Definition at line 2006 of file GlobalFunctions.php.
Referenced by TidySupport\__construct(), Installer\doEnvironmentChecks(), MWDebug\getDebugInfo(), MWTidy\singleton(), and SpecialVersion\softwareInformation().
wfIsInfinity | ( | $str | ) |
Determine input string is represents as infinity.
string | $str | The string to determine |
Definition at line 3176 of file GlobalFunctions.php.
Referenced by ApiProtect\execute(), UserrightsPage\expiryToTimestamp(), ProtectLogFormatter\formatExpiry(), ApiResult\formatExpiry(), ProtectionForm\getExpiry(), BlockLogFormatter\getParametersForApi(), SpecialBlock\parseExpiryInput(), SpecialBlock\processForm(), and Language\translateBlockExpiry().
wfIsWindows | ( | ) |
Check if the operating system is Windows.
Definition at line 1993 of file GlobalFunctions.php.
Referenced by UIDGenerator\__construct(), MediaWiki\Shell\Command\buildFinalCommand(), Installer\envCheckDiff3(), Installer\envCheckGit(), Installer\envCheckGraphics(), MediaWiki\Shell\Shell\escape(), TransformationalImageHandler\escapeMagickPath(), RebuildLocalisationCache\execute(), ParserTestsMaintenance\execute(), Maintenance\getTermSize(), ParserTestPrinter\quickDiff(), Maintenance\readlineEmulation(), CommandTest\requirePosix(), UserMailer\sendInternal(), FirejailCommandIntegrationTest\setUp(), SevenZipStream\stream_open(), ShellTest\testEscape(), WfEscapeShellArgTest\testMultipleArgs(), WfEscapeShellArgTest\testMultipleArgsAsArray(), MailAddressTest\testNewFromUser(), WfEscapeShellArgTest\testSingleInput(), WfShellExecTest\testT69870(), CommandTest\testT69870(), MailAddressTest\testToString(), GlobalTest\testWfShellWikiCmd(), MailAddress\toString(), wfGetNull(), 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 45 of file GlobalFunctions.php.
References $path, $wgExtensionDirectory, and ExtensionRegistry\getInstance().
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 66 of file GlobalFunctions.php.
References $ext, $wgExtensionDirectory, as, and ExtensionRegistry\getInstance().
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 82 of file GlobalFunctions.php.
References $path, $wgStyleDirectory, and ExtensionRegistry\getInstance().
wfLoadSkins | ( | array | $skins | ) |
Load multiple skins at once.
string[] | $skins | Array of extension names to load |
Definition at line 97 of file GlobalFunctions.php.
References $skin, $wgStyleDirectory, as, and ExtensionRegistry\getInstance().
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 2745 of file GlobalFunctions.php.
References $title, and RepoGroup\singleton().
Referenced by ImageBuilder\addMissingImage(), PopulateImageSha1\doDBUpdates(), SpecialNuke\doDelete(), RevDelFileList\doPostCommitUpdates(), MovePageForm\doSubmit(), EraseArchivedFile\execute(), ApiQueryImageInfo\execute(), ImportImages\execute(), LocalFileMoveBatch\execute(), ImageListPager\formatValue(), FileContentHandler\getDataForSearchIndex(), WANCacheReapUpdate\getEventAffectedKeys(), SpecialUpload\getWatchCheck(), ImportableUploadRevisionImporter\import(), MovePage\isValidFileMove(), MovePage\isValidMoveTarget(), Title\isValidMoveTarget(), SpecialNuke\listForm(), WikiFilePage\loadFile(), ImagePage\loadFile(), MovePage\move(), LocalFile\move(), CreatePdfThumbnailsJob\run(), ThumbnailRenderJob\run(), UploadFromUrlTest\setUp(), 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 1100 of file GlobalFunctions.php.
References $context.
wfLogProfilingData | ( | ) |
document
Move logic to MediaWiki.php
Definition at line 1153 of file GlobalFunctions.php.
References $context, $request, $user, $wgDebugLogGroups, $wgDebugRawPage, MediaWiki\emitBufferedStatsdData(), false, RequestContext\getMain(), Profiler\instance(), and wfIsDebugRawPage().
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 1145 of file GlobalFunctions.php.
References MWDebug\warning().
Referenced by ChangesListSpecialPage\areFiltersInConflict(), MediaWiki\Storage\SqlBlobStore\compressData(), Language\convertGrammar(), WikiPage\doDeleteArticleBatched(), Revision\ensureTitle(), MediaWiki\Storage\SqlBlobStore\fetchBlob(), CommentStore\getCommentInternal(), MediaWiki\Special\SpecialPageFactory\getPage(), Revision\getRevisionText(), TextSlotDiffRenderer\getTextDiffInternal(), SiteImporter\handleException(), Html\inlineScript(), ParserOutput\mergeInternalMetaDataFrom(), and wfMkdirParents().
wfMakeUrlIndexes | ( | $url | ) |
Make URL indexes, appropriate for the el_index field of externallinks.
string | $url |
Definition at line 900 of file GlobalFunctions.php.
References captcha-old\count, and wfParseUrl().
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 | |
array | $domains | Array of domains (strings) |
Definition at line 954 of file GlobalFunctions.php.
References array(), as, and wfParseUrl().
Referenced by Skin\addToSidebarPlain(), and GlobalTest\testWfMatchesDomainList().
wfMemcKey | ( | $args | ) |
Make a cache key for the local wiki.
string | ...$args |
Definition at line 2603 of file GlobalFunctions.php.
References $args, and ObjectCache\getLocalClusterInstance().
Referenced by PoolWorkArticleView\__construct(), CaptchaCacheStore\clear(), CacheHelper\getCacheKeyString(), ApiCategoryTree\getHTML(), FileRepo\getLocalCacheKey(), LocalRepo\getSharedCacheKey(), CaptchaCacheStore\retrieve(), CaptchaCacheStore\store(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), GlobalTest\testWfMemcKey(), and OATHAuthKey\verifyToken().
wfMemoryLimit | ( | ) |
Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit.
Definition at line 2924 of file GlobalFunctions.php.
References $wgMemoryLimit, wfDebug(), and wfShorthandToInteger().
wfMerge | ( | $old, | |
$mine, | |||
$yours, | |||
& | $result, | ||
& | $mergeAttemptResult = null |
||
) |
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 | |
string | null | &$mergeAttemptResult |
Definition at line 2307 of file GlobalFunctions.php.
References $wgDiff3, wfDebug(), and wfTempDir().
Referenced by TextContentHandler\merge3(), GlobalTest\testMerge(), and GlobalTest\testMerge_worksWithLessParameters().
wfMergeErrorArrays | ( | $args | ) |
Merge arrays in the style of getUserPermissionsErrors, with duplicate removal e.g.
wfMergeErrorArrays( [ [ 'x' ] ], [ [ 'x', '2' ] ], [ [ 'x' ] ], [ [ 'y' ] ] ); returns: [ [ 'x', '2' ], [ 'x' ], [ 'y' ] ]
array | ...$args |
Definition at line 203 of file GlobalFunctions.php.
References $args, $out, $params, and as.
Referenced by MovePage\checkPermissions(), MergeHistory\checkPermissions(), SpecialImport\execute(), Title\isValidMoveOperation(), SpecialChangeContentModel\onSubmit(), and DifferenceEngine\showDiffPage().
wfMessage | ( | $key, | |
$params | |||
) |
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 |
string|string[] | ...$params Normal message parameters |
Definition at line 1330 of file GlobalFunctions.php.
References $params.
Referenced by wfIsBadImage(), and wfShowingResults().
wfMessageFallback | ( | $keys | ) |
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 | ...$keys Message keys |
Definition at line 1353 of file GlobalFunctions.php.
References $keys.
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 | null | $mode | Chmod value to use, default is $wgDirectoryMode |
string | null | $caller | Optional caller param for debugging. |
MWException |
Definition at line 2050 of file GlobalFunctions.php.
References $wgDirectoryMode, FileBackend\isStoragePath(), wfDebug(), and wfLogWarning().
Referenced by FileCacheBase\checkCacheDirs(), MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\checkpointHelper(), SqliteInstaller\dataDirOKmaybeCreate(), TransformationalImageHandler\doTransform(), PdfHandler\doTransform(), DjVuHandler\doTransform(), SvgHandler\doTransform(), GenerateFancyCaptchas\execute(), ManageForeignResources\execute(), MediaWikiTestCase\getNewTempDirectory(), ManageForeignResources\handleTypeFile(), ManageForeignResources\handleTypeMultiFile(), ManageForeignResources\handleTypeTar(), CleanupImages\pokeFile(), GitInfo\precomputeValues(), LCStoreStaticArray\startWrite(), LCStoreCDB\startWrite(), and GlobalTest\testWfMkdirParents().
wfMsgReplaceArgs | ( | $message, | |
$args | |||
) |
Replace message parameter keys on the given formatted output.
string | $message | |
array | $args |
Definition at line 1365 of file GlobalFunctions.php.
Referenced by WikiPage\commitRollback(), MWException\msg(), and MWExceptionRenderer\msg().
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 1892 of file GlobalFunctions.php.
References $type, as, and mimeTypeMatch().
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 252 of file GlobalFunctions.php.
Referenced by GadgetDefinitionContent\getAssocArray().
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 (see (2)). 4) Verifies that the protocol is on the $wgUrlProtocols whitelist. 5) Rejects some invalid URLs that parse_url doesn't, e.g. the empty string or URLs starting with a line feed character.
string | $url | A URL to parse |
Definition at line 814 of file GlobalFunctions.php.
References $wgUrlProtocols.
Referenced by MWHttpRequest\__construct(), SpecialInterwiki\doSubmit(), ApiLinkAccount\execute(), ApiAMCreateAccount\execute(), ApiClientLogin\execute(), LinkSearchPage\execute(), MediaWiki\Widget\Search\InterwikiSearchResultSetWidget\footerHtml(), WikiMap\getCanonicalServerInfoForAllWikis(), WikiReference\getDisplayName(), WikiMap\getWikiFromUrl(), WikiMap\getWikiWikiReferenceFromSites(), MediaWiki\Widget\Search\SimpleSearchResultSetWidget\headerHtml(), ThumbnailRenderJob\hitThumbUrl(), UploadFromUrl\isAllowedHost(), MediaWiki\Widget\Search\InterwikiSearchResultSetWidget\iwIcon(), SpamBlacklist\logUrlChange(), LinkFilter\makeLikeArray(), UserMailer\makeMsgId(), ContentSecurityPolicy\prepareUrlForCSP(), WfAssembleUrlTest\provideURLParts(), SquidPurgeClient\queuePurge(), RedisPubSubFeedEngine\send(), AbstractChangesListSpecialPageTestCase\testValidateOptions(), WfParseUrlTest\testWfParseUrl(), MediaWiki\triggerAsyncJobs(), wfExpandUrl(), wfMakeUrlIndexes(), and wfMatchesDomainList().
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 2118 of file GlobalFunctions.php.
References $ret.
Referenced by profile_point\display(), ParserTestPrinter\reportPercentage(), and GlobalTest\testWfPercentTest().
wfQueriesMustScale | ( | ) |
Should low-performance queries be disabled?
Definition at line 2755 of file GlobalFunctions.php.
References $wgMiserMode, SiteStats\edits(), SiteStats\pages(), and SiteStats\users().
Referenced by RenameuserSQL\__construct().
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 278 of file GlobalFunctions.php.
Referenced by CompareParserCache\execute(), RandomPage\getRandomTitle(), SpecialRandomInCategory\getRandomTitle(), InputBox\getSearchForm(), InputBox\getSearchForm2(), 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 296 of file GlobalFunctions.php.
Referenced by MockFileBackend\doGetLocalCopyMulti(), JobQueueDB\doPop(), SvgHandler\doTransform(), BenchmarkLruHash\execute(), BenchmarkSanitizer\execute(), MakeTestEdits\execute(), GenerateFancyCaptchas\execute(), TestUserRegistry\getImmutableTestUser(), MockLocalRepo\getLocalCopy(), MockLocalRepo\getLocalReference(), TestUserRegistry\getMutableTestUser(), WebRequest\getRequestId(), StripState\merge(), UIDGenerator\newUUIDv4(), BenchmarkTitleValue\randomize(), UploadSourceAdapter\registerSource(), FileBackendTest\setUp(), GitInfoTest\setUpBeforeClass(), WANObjectCacheTest\testBusyValue(), WANObjectCacheTest\testCheckKeyInitHoldoff(), GlobalVarConfigTest\testConstructor(), WANObjectCacheTest\testDelete(), MediaWiki\Auth\LegacyHookPreAuthenticationProvider\testForAuthentication(), ReplicatedBagOStuffTest\testGet(), ReplicatedBagOStuffTest\testGetAbsent(), WANObjectCacheTest\testGetMulti(), WANObjectCacheTest\testGetMultiCheckKeys(), WANObjectCacheTest\testGetMultiWithSetCallback(), WANObjectCacheTest\testGetMultiWithUnionSetCallback(), WANObjectCacheTest\testGetNotExists(), WANObjectCacheTest\testGetWithSetCallback(), WANObjectCacheTest\testGetWithSetCallback_versions(), WANObjectCacheTest\testGetWithSeveralCheckKeys(), GlobalVarConfigTest\testHas(), WANObjectCacheTest\testInterimHoldOffCaching(), WANObjectCacheTest\testLockTSE(), WANObjectCacheTest\testLockTSESlow(), WANObjectCacheTest\testPreemtiveRefresh(), WANObjectCacheTest\testProcessCache(), GlobalTest\testRandomString(), WANObjectCacheTest\testReap(), 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 1237 of file GlobalFunctions.php.
Referenced by ProtectionForm\__construct(), User\addAutopromoteOnceGroups(), MediaWiki\Auth\AuthManager\autoCreateUser(), SpecialInterwiki\canModify(), ProfilerOutputDb\canUse(), MediaWiki\Auth\AuthManager\checkAccountCreatePermissions(), Action\checkCanExecute(), SpecialPage\checkReadOnly(), ApiMain\checkReadOnly(), User\clearAllNotifications(), User\clearNotification(), WikiPage\commitRollback(), UserGroupMembership\delete(), Block\delete(), Article\delete(), WikiPage\doUpdateRestrictions(), WikiPage\doViewUpdates(), EditPage\edit(), SpecialRenameuser\execute(), 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(), McrUndoAction\show(), 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 1250 of file GlobalFunctions.php.
Referenced by ReadOnlyError\__construct(), ProtectionForm\__construct(), MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\checkAccountCreatePermissions(), ApiBase\dieReadOnly(), WikiPage\doUpdateRestrictions(), McrUndoAction\show(), EditPage\showHeader(), ReadOnlyErrorTest\testConstruction(), and GlobalTest\testReadOnlyGlobalChange().
wfRecursiveRemoveDir | ( | $dir | ) |
Remove a directory and all its content.
Does not hide error.
string | $dir |
Definition at line 2093 of file GlobalFunctions.php.
Referenced by MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\checkpointHelper(), ManageForeignResources\cleanUp(), GenerateFancyCaptchas\execute(), ManageForeignResources\execute(), MediaWikiTestCase\setUp(), MediaWikiTestCase\tearDown(), and GitInfoTest\tearDownAfterClass().
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 2494 of file GlobalFunctions.php.
References $path, captcha-old\count, and wfBaseName().
Referenced by DumpUploads\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 662 of file GlobalFunctions.php.
References $output.
Referenced by PathRouter\parse(), WfRemoveDotSegmentsTest\testWfRemoveDotSegments(), and wfExpandUrl().
wfReportTime | ( | $nonce = null | ) |
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.
string | null | $nonce | Value from OutputPage::getCSPNonce |
Definition at line 1432 of file GlobalFunctions.php.
References $wgShowHostnames, Skin\makeVariablesScript(), and wfHostname().
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 1762 of file GlobalFunctions.php.
References $wgDisableOutputCompression.
Referenced by SpecialExport\execute(), SpecialUploadStash\outputContents(), and wfClearOutputBuffers().
wfResetSessionID | ( | ) |
Reset the session id.
Definition at line 2536 of file GlobalFunctions.php.
References wfDeprecated(), and wfSetupSession().
wfRestoreWarnings | ( | ) |
Definition at line 1942 of file GlobalFunctions.php.
Referenced by QuickArrayReader\__construct(), SpamBlacklist\filter(), PdfHandler\formatMetadata(), PdfHandler\getMetaArray(), TitleBlacklistEntry\matches(), QuickArrayReader\parseScalar(), ImageMap\render(), TitleBlacklist\validate(), and SpamRegexBatch\validateRegexes().
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 2771 of file GlobalFunctions.php.
References $wgLoadScript, $wgScript, and $wgScriptPath.
Referenced by SpecialPage\addFeedLinks(), SpecialRedirect\dispatchLog(), SpecialRedirect\dispatchPage(), SpecialRedirect\dispatchRevision(), SpecialRecentChanges\doHeader(), SpecialWatchlist\doHeader(), SpecialApiHelp\execute(), SpecialContributions\execute(), RedirectSpecialPage\execute(), LinkSearchPage\execute(), FileDuplicateSearchPage\execute(), SpecialRecentChanges\execute(), ApiHelp\fixHelpLinks(), HTMLForm\getAction(), SpecialLog\getActionButtons(), ResourceLoaderStartUpModule\getConfigSettings(), SpecialVersion\getEntryPointInfo(), SpecialContributions\getForm(), ApiHelp\getHelpInternal(), TablePager\getLimitForm(), ApiOpenSearch\getOpenSearchTemplate(), ContentSecurityPolicy\getReportUri(), ApiRsd\getRsdApiList(), HistoryPager\getStartBody(), HistoryAction\onView(), ApiMainTest\provideExceptionErrors(), MediaWiki\Widget\Search\SearchFormWidget\render(), ApiTestCase\setUp(), SpecialMergeHistory\showMergeForm(), 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 1690 of file GlobalFunctions.php.
wfSetupSession | ( | $sessionId = false | ) |
Initialise php session.
bool | string | $sessionId |
Definition at line 2561 of file GlobalFunctions.php.
References wfDeprecated().
Referenced by wfResetSessionID().
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 1673 of file GlobalFunctions.php.
References $source.
Referenced by LinkCache\forUpdate(), Block\fromMaster(), SpecialPage\including(), Block\isAutoblocking(), Block\isHardblock(), SpecialPage\listed(), ParserOutput\preventClickjacking(), Block\prevents(), CacheTime\setCacheTime(), ParserOutput\setCategoryLinks(), ParserOutput\setIndexPolicy(), ParserOutput\setLanguageLinks(), SpecialPage\setListed(), WikiImporter\setNoticeCallback(), ParserOptions\setOptionLegacy(), ParserOutput\setSections(), ParserOutput\setText(), ParserOutput\setTimestamp(), ParserOptions\setTimestamp(), ParserOutput\setTitleText(), ParserOutput\setTOCHTML(), ContentSecurityPolicyTest\testGetReportUri(), and ContentSecurityPolicyTest\testMakeCSPDirectivesImage().
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 2210 of file GlobalFunctions.php.
References $options, $retval, array(), and wfGetCaller().
Referenced by UIDGenerator\__construct(), DjVuHandler\doTransform(), GenerateFancyCaptchas\execute(), ParserTestPrinter\quickDiff(), Maintenance\readlineEmulation(), JpegPixelFormatTest\testPixelFormatRendering(), WfShellExecTest\testT69870(), wfShellExecWithStderr(), RandomImageGenerator\writeImageWithApi(), and RandomImageGenerator\writeImageWithCommandLine().
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 2263 of file GlobalFunctions.php.
References $retval, wfGetCaller(), and wfShellExec().
Referenced by PdfHandler\doTransform(), TransformationalImageHandler\getMagickVersion(), SvgHandler\rasterize(), JpegHandler\rotate(), BitmapHandler\rotate(), JpegHandler\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 2282 of file GlobalFunctions.php.
References $options, $wgPhpCli, and Hooks\run().
Referenced by CleanupSpam\execute(), 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 2973 of file GlobalFunctions.php.
References $last.
Referenced by Installer\envCheckMemory(), WebRequestUpload\isIniSizeOverflow(), WfShorthandToIntegerTest\testWfShorthandToInteger(), GlobalTest\testWfShorthandToInteger(), and wfMemoryLimit().
wfShowingResults | ( | $offset, | |
$limit | |||
) |
int | $offset | |
int | $limit |
Definition at line 1569 of file GlobalFunctions.php.
References wfMessage().
wfSplitWikiID | ( | $wiki | ) |
Split a wiki ID into DB name and table prefix.
string | $wiki |
Definition at line 2660 of file GlobalFunctions.php.
References captcha-old\count.
Referenced by ForeignDBViaLBRepo\__construct(), JobQueueRedis\getQueueKey(), and JobQueue\getRootJobCacheKey().
wfStringToBool | ( | $val | ) |
Convert string value to boolean, when the following are interpreted as true:
string | $val |
Definition at line 2162 of file GlobalFunctions.php.
Referenced by WfStringToBoolTest\testStr2Bool(), and wfIniGetBool().
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 2906 of file GlobalFunctions.php.
References $name, $wgIllegalFileChars, Title\legalChars(), and wfBaseName().
Referenced by MovePage\isValidFileMove().
wfSuppressWarnings | ( | $end = false | ) |
Reference-counted warning suppression.
bool | $end |
Definition at line 1934 of file GlobalFunctions.php.
Referenced by QuickArrayReader\__construct(), SpamBlacklist\filter(), PdfHandler\formatMetadata(), PdfHandler\getMetaArray(), TitleBlacklistEntry\matches(), QuickArrayReader\parseScalar(), ImageMap\render(), TitleBlacklist\validate(), and SpamRegexBatch\validateRegexes().
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 2031 of file GlobalFunctions.php.
References $wgTmpDirectory, and TempFSFile\getUsableTempDirectory().
Referenced by UIDGenerator\__construct(), UploadFromChunks\concatenateChunks(), FileBackendGroup\config(), MockFileBackend\doGetLocalCopyMulti(), FileBackendTest\doTestDoOperationsPipeline(), SvgHandler\doTransform(), ImportableUploadRevisionImporter\downloadSource(), WikiImporter\dumpTemp(), ApiImageRotate\execute(), HHVMMakeRepo\execute(), MediaWikiShell\execute(), GenerateFancyCaptchas\execute(), MWDocGen\execute(), MockLocalRepo\getLocalCopy(), MockLocalRepo\getLocalReference(), MediaWikiTestCase\getNewTempFile(), ParserEditTests\getOutputFileName(), UIDGenerator\getSequentialPerNodeIDs(), TextSlotDiffRenderer\getTextDiffInternal(), FileBackendGroup\guessMimeInternal(), JobRunner\loadBackoffs(), UploadFromUrl\makeTemporaryFile(), File\makeTransformTmpFile(), ClassicInterwikiLookupTest\populateCDB(), FileBackendTest\provider_testStore(), ParserTestPrinter\quickDiff(), ResourceLoaderImage\rasterize(), CheckStorage\restoreText(), WebPHandlerTest\setUp(), MigrateFileRepoLayoutTest\setUp(), GitInfoTest\setUpBeforeClass(), JobRunner\syncBackoffDeltas(), wfDiff(), and wfMerge().
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 3196 of file GlobalFunctions.php.
References $handler, $params, $value, $wgImageLimits, $wgResponsiveImages, $wgThumbLimits, as, File\getHandler(), and use.
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 1954 of file GlobalFunctions.php.
References $ret, and wfDebug().
Referenced by Revision\RevisionStoreRecord\__construct(), Revision\RevisionArchiveRecord\__construct(), Block\__construct(), DumpCategoriesAsRdf\addDumpHeader(), UserRightsProxy\addGroup(), User\addGroup(), LinkCache\addLinkObj(), ApiMain\addRequestedFields(), ChangesListSpecialPage\buildQuery(), ApiStashEdit\buildStashValue(), FileCacheBase\cacheTimestamp(), ApiStashEdit\checkCache(), ApiMain\checkConditionalRequestHeaders(), AjaxResponse\checkLastModified(), WikiPage\commitRollback(), User\confirmationToken(), FileBackendMultiWrite\consistencyCheck(), LanguageWa\date(), Language\date(), DifferenceEngine\debug(), JobRunner\debugCallback(), LocalFile\decodeRow(), SqlBagOStuff\deleteObjectsExpiringBefore(), SpecialUndelete\diffHeader(), MemoryFileBackend\doCopyInternal(), MemoryFileBackend\doCreateInternal(), ApiBaseTest\doGetParameterFromSettings(), DBFileJournal\doLogChangeBatch(), MysqlUpdater\doSchemaRestructuring(), ApiStashEditTest\doStashOld(), MemoryFileBackend\doStoreInternal(), FileBackendTest\doTestGetFileStat(), DefaultPreferencesFactoryTest\emailAuthenticationProvider(), ApiProtect\execute(), ApiUndelete\execute(), ApiMergeHistory\execute(), ApiEditPage\execute(), ApiQueryBlocks\execute(), ApiSetNotificationTimestamp\execute(), ApiQueryDeletedrevs\execute(), SpecialExport\execute(), ApiQueryFilearchive\execute(), RemoveUnusedAccounts\execute(), ApiQueryAllUsers\execute(), CleanupUploadStash\execute(), ApiQueryImageInfo\execute(), FixTimestamps\execute(), ApiFeedWatchlist\execute(), ImportTextFiles\execute(), PurgeParserCache\execute(), UpdateSearchIndex\execute(), BenchmarkParse\execute(), ApiQueryUsers\execute(), LocalFileRestoreBatch\execute(), JobRunner\executeJob(), UserrightsPage\expiryToTimestamp(), ApiQueryWatchlist\extractOutputData(), ApiQueryInfo\extractPageInfo(), ApiQueryRevisionsBase\extractRevisionInfo(), ApiQueryLogEvents\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), ApiQueryUserContribs\extractRowInfo(), HistoryAction\feedEmpty(), MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(), FeedUtils\formatDiff(), ApiResult\formatExpiry(), Language\formatExpiry(), SpecialUndelete\formatFileRow(), LogFormatter\formatParameterValueForApi(), SpecialMergeHistory\formatRevisionRow(), SpecialUndelete\formatRevisionRow(), ImageListPager\formatValue(), RevDelArchivedFileItem\getApiData(), RevDelRevisionItem\getApiData(), RevDelFileItem\getApiData(), Block\getAutoblockExpiry(), ApiQueryUserInfo\getBlockInfo(), NewUsersLogFormatter\getComment(), ApiQueryUserInfo\getCurrentUserInfo(), LocalFile\getDescriptionTouched(), User\getExperienceLevel(), ProtectionForm\getExpiry(), FormatMetadata\getExtendedMetadataFromFile(), ApiQueryRecentChangesIntegrationTest\getExternalRC(), ApiQueryWatchlistIntegrationTest\getExternalRC(), User\getFirstEditTimestamp(), ApiQueryImageInfo\getInfo(), SpecialActiveUsers\getIntroText(), LogFormatter\getIRCActionText(), MachineReadableRCFeedFormatter\getLine(), BlockLogFormatter\getMessageParameters(), PNGMetadataExtractor\getMetadata(), SpecialRandomInCategory\getMinAndMaxForCat(), ApiParamInfo\getModuleInfo(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\getNewPasswordExpiry(), BlockLogFormatter\getParametersForApi(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(), PageArchive\getPreviousRevision(), NewFilesPager\getQueryInfo(), ActiveUsersPager\getQueryInfo(), ContribsPager\getQueryInfo(), RawAction\getRawText(), ApiQuerySearch\getSearchResultData(), ImageHistoryList\getThumbForLine(), MockFSFile\getTimestamp(), FSFile\getTimestamp(), RevisionItemBase\getTimestamp(), ForeignAPIFile\getTimestamp(), DatabaseLogEntry\getTimestamp(), RCDatabaseLogEntry\getTimestamp(), ArchivedFile\getTimestamp(), WikiPage\getTimestamp(), ManualLogEntry\getTimestamp(), FileJournal\getTimestampedUUID(), Revision\RevisionStore\getTimestampFromId(), WANCacheReapUpdate\getTitleChangeEvents(), ResourceLoaderWikiModule\getTitleInfo(), User\getTouched(), ApiQueryInfo\getVisitingWatcherInfo(), ForeignAPIRepo\httpGet(), ImageHistoryList\imageHistoryLine(), UserGroupMembership\initFromRow(), 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(), FormatMetadata\makeFormattedData(), MediaWiki\Session\Token\match(), SpecialBlock\maybeAlterFormDefaults(), User\newTouchedTimestamp(), InfoAction\pageCounts(), ApiStashEdit\parseAndStash(), SpecialBlock\parseExpiryInput(), PdfImage\postProcessDump(), TableCleanup\progress(), ImageBuilder\progress(), ApiMainTest\provideCheckConditionalRequestHeaders(), ApiBaseTest\provideGetParameterFromSettings(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), LanguageTest\provideTranslateBlockExpiry(), LocalFile\publishTo(), RebuildRecentchanges\rebuildRecentChangesTablePass1(), QueryPage\recache(), LocalFile\recordUpload2(), ManageJobs\repushAbandoned(), ApiQueryProtectedTitles\run(), ApiQueryWatchlistRaw\run(), ApiQueryCategories\run(), ApiQueryDuplicateFiles\run(), CategoryMembershipChangeJob\run(), ApiQueryQueryPage\run(), ApiQueryCategoryMembers\run(), RefreshLinksJob\runForTitle(), ChangesFeed\saveToCache(), ApiMain\sendCacheHeaders(), Block\setCookie(), Revision\MutableRevisionRecord\setTimestamp(), WikiRevision\setTimestamp(), WikiPage\setTimestamp(), UserGroupMembershipTest\setUp(), PageArchiveTestBase\setUp(), TextPassDumper\showReport(), BackupDumper\showReport(), UpdateLogging\sync(), UserTest\testAutoblockCookieInfiniteExpiry(), UserTest\testAutoblockCookies(), EditPageTest\testAutoMerge(), ApiBlockTest\testBlockWithExpiry(), ApiMainTest\testCheckConditionalRequestHeadersFailed(), ApiQueryInfoTest\testExecute(), RangeChronologicalPagerTest\testGetDateCond(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetNewPasswordExpiry(), PageArchiveTestBase\testGetPreviousRevision(), WfTimestampTest\testHttpDate(), RevisionDbTestBase\testInsertOn(), UserTest\testIpBlockCookieIgnoredWhenUserLoggedIn(), UserTest\testIpBlockCookieNotSet(), UserTest\testIpBlockCookieSet(), WfTimestampTest\testNormalTimestamps(), WfTimestampTest\testOldTimestamps(), JobQueueTest\testRootDeduplication(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), BlockTest\testT28425BlockTimestampDefaultsToTime(), WfTimestampTest\testTimestampParameter(), TitlePermissionTest\testUserBlock(), Language\time(), Language\timeanddate(), IPTC\timeHelper(), DatabaseOracle\timestamp(), MediaWiki\Session\Token\toString(), ApiUpload\transformWarnings(), RecentChangesUpdateJob\updateActiveUsers(), WikiPage\updateIfNewerOn(), Block\updateTimestamp(), CategoryChangesAsRdf\updateTS(), ApiBase\validateTimestamp(), EditPage\wasDeletedSinceLastEdit(), wfStreamThumb(), wfTimestampOrNull(), and XmlDumpWriter\writeTimestamp().
wfTimestampNow | ( | ) |
Convenience function; returns MediaWiki timestamp for the present time.
Definition at line 1983 of file GlobalFunctions.php.
Referenced by LinksDeletionUpdate\__construct(), CategoryMembershipChange\__construct(), EditPageTest\assertEdit(), User\confirmEmail(), MediaWiki\Preferences\DefaultPreferencesFactory\datetimePreferences(), Block\doAutoblock(), SpecialWatchlist\doHeader(), PoolWorkArticleView\doWork(), ApiProtect\execute(), ApiEditPage\execute(), SpecialExport\execute(), MigrateFileRepoLayout\execute(), ResetUserEmail\execute(), ApiUserrights\execute(), ImportTextFiles\execute(), UpdateSearchIndex\execute(), PPFuzzTest\execute(), LogFormatterTestCase\expandDatabaseRow(), SqlBagOStuff\expireAll(), FormatMetadata\fetchExtendedMetadata(), Title\getCascadeProtectionSources(), MediaWiki\Preferences\DefaultPreferencesFactory\getDateOptions(), ApiCategoryTree\getHTML(), ManualLogEntry\getTimestamp(), ParserOptions\getTimestamp(), MediaWiki\Storage\PageUpdater\getTimestampNow(), EditPage\importFormData(), Revision\RevisionStore\initializeMutableRevisionFromArray(), ManualLogEntry\insert(), HTMLCacheUpdateJob\invalidateTitles(), MessageCache\isCacheExpired(), UserGroupMembership\isExpired(), Block\isExpired(), Title\loadRestrictions(), Title\loadRestrictionsFromRows(), Revision\RevisionStore\newNullRevision(), Job\newRootJobParams(), SpecialLockdb\onSubmit(), SpecialRecentChanges\optionsPanel(), MediaWiki\Storage\DerivedPageDataUpdater\prepareContent(), SpecialBlock\processForm(), WikiImporter\processRevision(), ManageJobs\repushAbandoned(), ProtectionForm\save(), ParserCache\save(), LogPage\saveContent(), HTMLFileCache\saveToFileCache(), UserrightsPage\saveUserGroups(), AjaxResponse\storeInMemcached(), EditPageTest\testAutoMerge(), BlockTest\testBlockedUserCanNotCreateAccount(), EditPageTest\testCheckDirectEditingDisallowed_forNonTextContent(), BlockTest\testCrappyCrossWikiBlocks(), RevisionDbTestBase\testGetTimestamp(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewNullRevision(), LanguageTest\testSprintfDateNoTtlIfNotNeeded(), BlockTest\testSystemBlocks(), and MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testUserWasLastToEdit_true().
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 | null | $ts |
Definition at line 1970 of file GlobalFunctions.php.
References wfTimestamp().
Referenced by Autopromote\checkCondition(), ApiQueryUsers\execute(), WatchedItemStore\getNotificationTimestampsBatch(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(), Job\getQueuedTimestamp(), Job\getReleaseTimestamp(), JobSpecification\getReleaseTimestamp(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\isTimestampValid(), ApiStashEdit\lastEditTime(), WikiPage\loadFromRow(), User\loadFromRow(), WatchedItemStore\loadWatchedItem(), and MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData().
wfTransactionalTimeLimit | ( | ) |
Set PHP's time limit to the larger of php.ini or $wgTransactionalTimeLimit.
Definition at line 2952 of file GlobalFunctions.php.
References $wgTransactionalTimeLimit.
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 3057 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 331 of file GlobalFunctions.php.
References $s.
Referenced by Title\__wakeup(), CoreParserFunctions\basepagenamee(), FileRepo\getDescriptionRenderUrl(), FileRepo\getDescriptionUrl(), LoginSignupSpecialPage\getFakeTemplate(), WikiReference\getLocalUrl(), Title\getLocalURL(), MediaWikiSite\getPageUrl(), Title\getPrefixedURL(), LoginSignupSpecialPage\getReturnToQueryStringFragment(), Title\getSubpageUrlForm(), ParserOutput\getText(), Interwiki\getURL(), 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 740 of file GlobalFunctions.php.
References $retval, $wgUrlProtocols, and as.
Referenced by Skin\addToSidebarPlain(), ResourceLoaderStartUpModule\getConfigSettings(), Skin\makeInternalOrExternalUrl(), and wfUrlProtocolsWithoutProtRel().
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 785 of file GlobalFunctions.php.
References wfUrlProtocols().
Referenced by Language\markNoConversion().
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 1708 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: 60 seconds (cli), 1 second (web) |
Definition at line 2847 of file GlobalFunctions.php.
Referenced by NamespaceDupes\checkLinkTable(), CleanupUsersWithNoId\cleanup(), CleanupInvalidDbKeys\cleanupTable(), CompressOld\compressWithConcat(), RefreshLinks\deleteLinksFromNonexistent(), RefreshLinks\dfnCheckInterval(), PopulateRecentChangesSource\doDBUpdates(), MigrateActors\doDBUpdates(), PopulateBacklinkNamespace\doDBUpdates(), PopulateFilearchiveSha1\doDBUpdates(), PopulateParentId\doDBUpdates(), FixExtLinksProtocolRelative\doDBUpdates(), PopulateExternallinksIndex60\doDBUpdates(), PopulateArchiveRevId\doDBUpdates(), PopulateLogSearch\doDBUpdates(), PopulateImageSha1\doDBUpdates(), RefreshLinks\doRefreshLinks(), TidyUpT39714\execute(), CleanupArchiveUserText\execute(), RemoveInvalidEmails\execute(), FixUserRegistration\execute(), MakeTestEdits\execute(), DeleteDefaultMessages\execute(), InitEditCount\execute(), UpdateRestrictions\execute(), ConvertUserOptions\execute(), CleanupUploadStash\execute(), RunBatchedQuery\execute(), DeleteBatch\execute(), ResetUserTokens\execute(), MwSql\execute(), UpdateCollation\execute(), PopulateCategory\execute(), UpdateMediaWiki\execute(), RefreshImageMetadata\execute(), DeleteEqualMessages\execute(), ImportImages\execute(), FixDefaultJsonContentPages\handleRow(), MigrateComments\migrate(), MigrateActors\migrate(), MigrateActors\migrateLogSearch(), MigrateComments\migrateToTemp(), MigrateActors\migrateToTemp(), moveToExternal(), RefreshLinks\refreshCategory(), resolveStubs(), RenameUserJob\run(), BackupReader\showReport(), UpdateLogging\sync(), TrackBlobs\trackOrphanText(), TrackBlobs\trackRevisions(), and PopulateContentModel\updatePageRows().
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 1132 of file GlobalFunctions.php.
References MWDebug\warning().
Referenced by DatabaseTestHelper\__construct(), TextContent\__construct(), Exif\__construct(), Action\__construct(), MediaWiki\Tidy\RaggettInternalPHP\cleanWrapped(), MediaWiki\Tidy\RaggettExternal\cleanWrapped(), MediaWiki\Storage\SqlBlobStore\decompressData(), ApiEditPage\execute(), MediaWiki\Storage\SqlBlobStore\fetchBlob(), ForeignAPIRepo\fileExistsBatch(), Http\get(), MediaWiki\Special\SpecialPageFactory\getAliasList(), CacheHelper\getCachedValue(), WikiPage\getContentModel(), Action\getContext(), DifferenceEngine\getEngine(), ParserCache\getKey(), Revision\RevisionStore\getKnownCurrentRevision(), MediaWiki\Special\SpecialPageFactory\getLocalNameFor(), Language\getMagic(), ChangeTags\getSoftwareTags(), MediaWiki\initializeArticle(), Html\inlineScript(), Linker\link(), Html\linkedScript(), Linker\makeBrokenImageLinkObj(), Revision\RevisionStore\newRevisionFromArchiveRow(), Revision\RevisionStore\newRevisionFromRow(), BacklinkJobUtils\partitionBacklinkJob(), Autopromote\recCheckCondition(), and EditPage\showEditForm().
wfWikiID | ( | ) |
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
Definition at line 2644 of file GlobalFunctions.php.
References $wgDBname, and $wgDBprefix.
Referenced by ApiMain\__construct(), MediaWiki\Logger\Monolog\WikiProcessor\__invoke(), Revision\RevisionStore\checkDatabaseWikiId(), UserDupes\checkDupes(), FileBackendGroup\config(), WikiPage\doDeleteUpdates(), MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), InitEditCount\execute(), AttachLatest\execute(), CopyJobQueue\execute(), SyncFileBackend\execute(), CreateAndPromote\execute(), UpdateSearchIndex\execute(), CleanupInvalidDbKeys\execute(), UpdateMediaWiki\execute(), UserrightsPage\fetchUser(), MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(), MediaWiki\Logger\LegacyLogger\formatAsWfLogDBError(), MediaWiki\Interwiki\ClassicInterwikiLookup\getAllPrefixesCached(), FancyCaptcha\getBackend(), WikiMap\getCanonicalServerInfoForAllWikis(), SiteConfiguration\getConfig(), ObjectCache\getDefaultKeyspace(), MediaWiki\Interwiki\ClassicInterwikiLookup\getInterwikiCacheEntry(), MachineReadableRCFeedFormatter\getLine(), FileBackendDBRepoWrapperTest\getMocks(), User\getNewMessageLinks(), User\getNewMessageRevisionId(), Skin\getNewtalks(), Profiler\getProfileID(), MediaWiki\getUrlDomainDistance(), LocalIdLookup\isAttached(), ApiMain\logRequest(), RecompressTracked\logToFile(), UserMailer\makeMsgId(), EnqueueJob\newFromLocalJobs(), JobQueueMemoryTest\newJobQueue(), InterwikiHooks\onInterwikiLoadPrefix(), TextPassDumper\openSpawn(), ClassicInterwikiLookupTest\populateHash(), TableCleanup\progress(), WikiMapTest\provideGetWikiIdFromDomain(), RecentChangesUpdateJob\purgeExpiredRows(), WikiPage\purgeInterwikiCheckKey(), LocalFileTest\setUp(), MigrateFileRepoLayoutTest\setUp(), StoreBatchTest\setUp(), MediaWikiMediaTestCase\setUp(), UploadFromUrlTestSuite\setUp(), JobQueueTest\setUp(), FileBackendTest\setUp(), SpecialInterwiki\showList(), TextPassDumper\showReport(), BackupDumper\showReport(), LockManagerGroup\singleton(), RecompressTracked\startReplicaProcs(), ExternalStoreMwstore\store(), FileBackendTest\testAsyncWrites(), FileTest\testGenerateBucketsIfNeeded(), ResourceLoaderWikiModuleTest\testGetPreloadedTitleInfo(), FileTest\testGetThumbnailSource(), JobQueueTest\testGetWiki(), LocalIdLookupTest\testIsAttached(), LBFactoryTest\testNiceDomains(), FileBackendTest\testReadAffinity(), LBFactoryTest\testRedefineLocalDomain(), FileBackendTest\testSanitizeOpHeaders(), and RecentChangesUpdateJob\updateActiveUsers().