MediaWiki master
|
Global functions used everywhere. More...
Go to the source code of this file.
Functions | |
wfAppendQuery ( $url, $query) | |
Append a query string to an existing URL, which may or may not already have query string parameters already. | |
wfArrayDiff2 ( $arr1, $arr2) | |
Like array_diff( $arr1, $arr2 ) except that it works with two-dimensional arrays. | |
wfArrayInsertAfter (array $array, array $insert, $after) | |
Insert an array into another array after the specified key. | |
wfArrayPlus2d (array $baseArray, array $newValues) | |
Merges two (possibly) 2 dimensional arrays into the target array ($baseArray). | |
wfArrayToCgi ( $array1, $array2=null, $prefix='') | |
This function takes one or two arrays as input, and returns a CGI-style string, e.g. | |
wfAssembleUrl ( $urlParts) | |
This function will reassemble a URL parsed with wfParseURL. | |
wfBacktrace ( $raw=null) | |
Get a debug backtrace as a string. | |
wfBaseName ( $path, $suffix='') | |
Return the final portion of a pathname. | |
wfBoolToStr ( $value) | |
Convenience function converts boolean values into "true" or "false" (string) values. | |
wfCgiToArray ( $query) | |
This is the logical opposite of wfArrayToCgi(): it accepts a query string as its argument and returns the same string in array form. | |
wfClientAcceptsGzip ( $force=false) | |
Whether the client accept gzip encoding. | |
wfDebug ( $text, $dest='all', array $context=[]) | |
Sends a line to the debug log if enabled or, optionally, to a comment in output. | |
wfDebugBacktrace ( $limit=0) | |
Safety wrapper for debug_backtrace(). | |
wfDebugLog ( $logGroup, $text, $dest='all', array $context=[]) | |
Send a line to a supplementary debug log file, if configured, or main debug log if not. | |
wfDeprecated ( $function, $version=false, $component=false, $callerOffset=2) | |
Logs a warning that a deprecated feature was used. | |
wfDeprecatedMsg ( $msg, $version=false, $component=false, $callerOffset=2) | |
Log a deprecation warning with arbitrary message text. | |
wfEscapeShellArg (... $args) | |
Locale-independent version of escapeshellarg() | |
wfEscapeWikiText ( $input) | |
Escapes the given text so that it may be output using addWikiText() without any linking, formatting, etc. | |
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. | |
wfExpandUrl ( $url, $defaultProto=PROTO_CURRENT) | |
Expand a potentially local URL to a fully-qualified URL using $wgServer (or one of its alternatives). | |
wfFormatStackFrame ( $frame) | |
Return a string representation of frame. | |
wfGetAllCallers ( $limit=3) | |
Return a string consisting of callers in the stack. | |
wfGetCaller ( $level=2) | |
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfGetCaller() call (ie. | |
wfGetDB ( $db, $groups=[], $wiki=false) | |
Get a Database object. | |
wfGetNull () | |
Get a platform-independent path to the null file, e.g. | |
wfGetServerUrl ( $proto) | |
Get the wiki's "server", i.e. | |
wfGetUrlUtils () | |
wfHostname () | |
Get host name of the current machine, for use in error reporting. | |
wfHttpError ( $code, $label, $desc) | |
Provide a simple HTTP error. | |
wfIniGetBool ( $setting) | |
Safety wrapper around ini_get() for boolean settings. | |
wfIsDebugRawPage () | |
Returns true if debug logging should be suppressed if $wgDebugRawPage = false. | |
wfIsInfinity ( $str) | |
Determine input string is represents as infinity. | |
wfLoadExtension ( $ext, $path=null) | |
Load an extension. | |
wfLoadExtensions (array $exts) | |
Load multiple extensions at once. | |
wfLoadSkin ( $skin, $path=null) | |
Load a skin. | |
wfLoadSkins (array $skins) | |
Load multiple skins at once. | |
wfLogDBError ( $text, array $context=[]) | |
Log for database errors. | |
wfLogWarning ( $msg, $callerOffset=1, $level=E_USER_WARNING) | |
Send a warning as a PHP error and the debug log. | |
wfMatchesDomainList ( $url, $domains) | |
Check whether a given URL has a domain that occurs in a given set of domains. | |
wfMemoryLimit ( $newLimit) | |
Raise PHP's memory limit (if needed). | |
wfMerge (string $old, string $mine, string $yours, ?string &$simplisticMergeAttempt, ?string &$mergeLeftovers=null) | |
wfMerge attempts to merge differences between three texts. | |
wfMergeErrorArrays (... $args) | |
Merge arrays in the style of PermissionManager::getPermissionErrors, with duplicate removal e.g. | |
wfMessage ( $key,... $params) | |
This is the function for getting translated interface messages. | |
wfMessageFallback (... $keys) | |
This function accepts multiple message keys and returns a message instance for the first message which is non-empty. | |
wfMkdirParents ( $dir, $mode=null, $caller=null) | |
Make directory, and make all parent directories if they don't exist. | |
wfMsgReplaceArgs ( $message, $args) | |
Replace message parameter keys on the given formatted output. | |
wfObjectToArray ( $objOrArray, $recursive=true) | |
Recursively converts the parameter (an object) to an array with the same data. | |
wfParseUrl ( $url) | |
parse_url() work-alike, but non-broken. | |
wfPercent ( $nr, int $acc=2, bool $round=true) | |
wfRandom () | |
Get a random decimal value in the domain of [0, 1), in a way not likely to give duplicate values for any realistic number of articles. | |
wfRandomString ( $length=32) | |
Get a random string containing a number of pseudo-random hex characters. | |
wfRecursiveRemoveDir ( $dir) | |
Remove a directory and all its content. | |
wfRelativePath ( $path, $from) | |
Generate a relative path name to the given file. | |
wfResetOutputBuffers ( $resetGzipEncoding=true) | |
Clear away any user-level output buffers, discarding contents. | |
wfScript ( $script='index') | |
Get the URL path to a MediaWiki entry point. | |
wfSetBit (&$dest, $bit, $state=true) | |
As for wfSetVar except setting a bit. | |
wfSetVar (&$dest, $source, $force=false) | |
Sets dest to source and returns the original value of dest If source is NULL, it just returns the value, it doesn't set the variable If force is true, it will set the value even if source is NULL. | |
wfShellExec ( $cmd, &$retval=null, $environ=[], $limits=[], $options=[]) | |
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported. | |
wfShellExecWithStderr ( $cmd, &$retval=null, $environ=[], $limits=[]) | |
Execute a shell command, returning both stdout and stderr. | |
wfShellWikiCmd ( $script, array $parameters=[], array $options=[]) | |
Generate a shell-escaped command line string to run a MediaWiki cli script. | |
wfShorthandToInteger (?string $string='', int $default=-1) | |
Converts shorthand byte notation to integer form. | |
wfStringToBool ( $val) | |
Convert string value to boolean, when the following are interpreted as true: | |
wfStripIllegalFilenameChars ( $name) | |
Replace all invalid characters with '-'. | |
wfTempDir () | |
Tries to get the system directory for temporary files. | |
wfThumbIsStandard (File $file, array $params) | |
Returns true if these thumbnail parameters match one that MediaWiki requests from file description pages and/or parser output. | |
wfTimestamp ( $outputtype=TS_UNIX, $ts=0) | |
Get a timestamp string in one of various formats. | |
wfTimestampNow () | |
Convenience function; returns MediaWiki timestamp for the present time. | |
wfTimestampOrNull ( $outputtype=TS_UNIX, $ts=null) | |
Return a formatted timestamp, or null if input is null. | |
wfTransactionalTimeLimit () | |
Raise the request time limit to $wgTransactionalTimeLimit. | |
wfUrlencode ( $s) | |
We want some things to be included as literal characters in our title URLs for prettiness, which urlencode encodes by default. | |
wfUrlProtocols ( $includeProtocolRelative=true) | |
Returns a partial regular expression of recognized URL protocols, e.g. | |
wfUrlProtocolsWithoutProtRel () | |
Like wfUrlProtocols(), but excludes '//' from the protocol list. | |
wfVarDump ( $var) | |
A wrapper around the PHP function var_export(). | |
wfWarn ( $msg, $callerOffset=1, $level=E_USER_NOTICE) | |
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings. | |
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.
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 | array | $query | String or associative array |
Definition at line 439 of file GlobalFunctions.php.
References $url, and wfArrayToCgi().
Referenced by MediaWiki\SpecialPage\SpecialPage\addFeedLinks(), MediaWiki\Specials\SpecialRedirect\dispatchLog(), MediaWiki\Specials\SpecialRedirect\dispatchPage(), MediaWiki\Specials\SpecialRedirect\dispatchRevision(), MediaWiki\SpecialPage\ContributionsSpecialPage\execute(), MediaWiki\Specials\SpecialApiHelp\execute(), MediaWiki\SpecialPage\LoginSignupSpecialPage\execute(), MediaWiki\SpecialPage\RedirectSpecialPage\execute(), MediaWiki\Specials\SpecialRecentChanges\execute(), MediaWiki\Api\ApiEntryPoint\execute(), ImportSiteScripts\execute(), ImportSiteScripts\fetchScriptList(), MediaWiki\Api\ApiHelp\fixHelpLinks(), FileRepo\getDescriptionRenderUrl(), File\getFilePageThumbUrl(), MediaWiki\Output\OutputPage\getHeadLinksArray(), MediaWiki\Title\Title\getLocalURL(), ImageHandler\getScriptedTransform(), MediaWiki\Linker\Linker\getUploadUrl(), MediaWiki\ResourceLoader\Image\getUrl(), ForeignAPIRepo\httpGetCached(), MediaWiki\Linker\Linker\makeThumbLink2(), FileRepo\makeUrl(), ImportStreamSource\newFromInterwiki(), and MediaWiki\Site\MediaWikiPageNameNormalizer\normalizePageName().
wfArrayDiff2 | ( | $arr1, | |
$arr2 ) |
Like array_diff( $arr1, $arr2 ) except that it works with two-dimensional arrays.
string[] | array[] | $arr1 | |
string[] | array[] | $arr2 |
Definition at line 120 of file GlobalFunctions.php.
References wfDeprecated().
wfArrayInsertAfter | ( | array | $array, |
array | $insert, | ||
$after ) |
Insert an array into another array after the specified key.
If the key is not present in the input array, it is returned without modification.
array | $array | |
array | $insert | The array to insert. |
mixed | $after | The key to insert after. |
Definition at line 203 of file GlobalFunctions.php.
Referenced by MediaWiki\Api\ApiComparePages\getAllowedParams(), MediaWiki\Specials\SpecialDeletedContributions\getUserLinks(), SkinTemplate\injectLegacyMenusIntoPersonalTools(), and UpdateExtensionJsonSchema\updateTo2().
wfArrayPlus2d | ( | array | $baseArray, |
array | $newValues ) |
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 2103 of file GlobalFunctions.php.
Referenced by MediaWiki\HTMLForm\Field\HTMLUserTextField\__construct(), and MediaWiki\Registration\ExtensionRegistry\exportExtractedData().
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 347 of file GlobalFunctions.php.
References wfArrayToCgi().
Referenced by MediaWiki\Request\WebRequest\appendQueryArray(), MediaWiki\SpecialPage\SpecialPage\checkLoginSecurityLevel(), MediaWiki\Specials\SpecialNewPages\execute(), PopulateInterwiki\fetchLinks(), MediaWiki\Pager\AllMessagesTablePager\formatValue(), MediaWiki\Title\Title\getCanonicalURL(), MediaTransformOutput\getDescLinkAttribs(), MediaWiki\SpecialPage\LoginSignupSpecialPage\getFieldDefinitions(), FormAction\getForm(), MediaWiki\SpecialPage\FormSpecialPage\getForm(), MediaWiki\Title\Title\getFullURL(), MediaWiki\Title\Title\getInternalURL(), MediaWiki\Title\Title\getLocalURL(), MediaWiki\Specials\SpecialRunJobs\getQuerySignature(), MediaWiki\Skin\SkinComponentUtils\getReturnToParam(), MediaWiki\Installer\WebInstaller\getUrl(), MediaWiki\SpecialPage\AuthManagerSpecialPage\handleReauthBeforeExecute(), UserNotLoggedIn\report(), PurgeAction\show(), MediaWiki\Output\OutputPage\showPermissionInternal(), MediaWiki\SpecialPage\ChangesListSpecialPage\validateOptions(), wfAppendQuery(), and wfArrayToCgi().
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 556 of file GlobalFunctions.php.
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 true if MW_ENTRY_POINT is 'cli', otherwise false. |
Definition at line 967 of file GlobalFunctions.php.
References MW_ENTRY_POINT, and wfDebugBacktrace().
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 1733 of file GlobalFunctions.php.
References $matches, and $path.
Referenced by Exif\__construct(), ImageBuilder\checkMissingImage(), FileOpPerfTest\doPerfTest(), MediaWiki\FileRepo\AuthenticatedFileEntryPoint\execute(), ImportImages\execute(), wfRelativePath(), and wfStripIllegalFilenameChars().
wfBoolToStr | ( | $value | ) |
Convenience function converts boolean values into "true" or "false" (string) values.
bool | $value |
Definition at line 1872 of file GlobalFunctions.php.
Referenced by MediaWiki\Api\ApiRsd\formatRsdApiList(), and MediaWiki\Cache\FileCacheBase\isCacheGood().
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 392 of file GlobalFunctions.php.
Referenced by MediaWiki\Linker\Linker\makeBrokenImageLinkObj(), MediaWiki\Specials\SpecialChangeEmail\onSuccess(), MediaWiki\Output\OutputPage\returnToMain(), LoginHelper\showReturnToPage(), MediaWiki\Linker\Linker\specialLink(), MediaWiki\Storage\SqlBlobStore\splitBlobAddress(), and MediaWiki\Specials\SpecialCreateAccount\successfulAction().
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 1055 of file GlobalFunctions.php.
References wfDebug().
Referenced by HTMLFileCache\loadFromFileCache(), and HTMLFileCache\saveToFileCache().
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 663 of file GlobalFunctions.php.
References $wgDebugLogPrefix, $wgDebugRawPage, and wfIsDebugRawPage().
Referenced by MediaWiki\Api\ApiMain\__construct(), DifferenceEngine\__construct(), UploadStashFile\__construct(), QuickTemplate\__construct(), UploadFromStash\__construct(), MediaWiki\Parser\ParserFactory\__construct(), UploadFromChunks\__construct(), MediaWiki\StubObject\StubGlobalUser\_unstub(), MediaWiki\StubObject\StubObject\_unstub(), LogPage\actionText(), ImageGalleryBase\add(), MediaHandler\addMeta(), Skin\afterContentHook(), MediaWiki\Linker\Linker\blockLink(), MediaWiki\Output\OutputPage\checkLastModified(), UploadBase\checkSvgScriptCallback(), UploadBase\checkXMLEncodingMissmatch(), JobQueueDB\claimOldest(), LocalRepo\cleanupDeletedBatch(), UploadBase\cleanupTempFile(), UploadStash\clear(), MediaWiki\MediaWikiEntryPoint\commitMainTransaction(), MediaWiki\Storage\SqlBlobStore\compressData(), UploadBase\createFromRequest(), WikiImporter\debug(), RecompressTracked\debug(), BaseDump\debug(), UploadBase\detectScript(), UploadBase\detectVirus(), JobQueueDB\doBatchPushInternal(), WikiFilePage\doPurge(), MediaWiki\Specials\SpecialUserRights\doSaveUserGroups(), DjVuHandler\doTransform(), TransformationalImageHandler\doTransform(), MediaWiki\Storage\DerivedPageDataUpdater\doUpdates(), MediaWiki\EditPage\EditPage\edit(), MediaWiki\Specials\SpecialUpload\execute(), LocalFileRestoreBatch\execute(), Article\fetchRevisionRecord(), WikiImporter\finishImportPage(), FormatMetadata\flattenArrayReal(), FileRepo\freeTemp(), File\generateAndSaveThumb(), LCStoreCDB\get(), MediaWiki\PoolCounter\PoolCounterConnectionManager\get(), Action\getContext(), MediaWiki\Context\ContextSource\getContext(), MediaWiki\SpecialPage\SpecialPage\getContext(), MediaWiki\Specials\SpecialVersion\getCreditsForExtension(), File\getDescriptionText(), ForeignDBFile\getDescriptionText(), UploadStash\getFile(), DoubleRedirectJob\getFinalDestination(), WikiFilePage\getForeignCategories(), MediaWiki\Cache\GenderCache\getGenderOf(), MediaWiki\Specials\SpecialUpload\getInitialPageText(), TransformationalImageHandler\getMagickVersion(), MediaWiki\Context\RequestContext\getMainAndWarn(), GIFMetadataExtractor\getMetadata(), PNGMetadataExtractor\getMetadata(), MediaWiki\Request\WebRequestUpload\getName(), MediaWiki\Title\Title\getNsText(), GIFHandler\getSizeAndMetadata(), JpegHandler\getSizeAndMetadata(), PNGHandler\getSizeAndMetadata(), SvgHandler\getSizeAndMetadata(), TiffHandler\getSizeAndMetadata(), DjVuHandler\getSizeAndMetadata(), ForeignAPIRepo\getThumbError(), UploadStashFile\getThumbUrl(), ForeignAPIRepo\getThumbUrlFromCache(), MediaWiki\Title\Title\getTitleValue(), File\getViewURL(), MediaWiki\Output\OutputPage\haveCacheVaryCookies(), ThumbnailRenderJob\hitThumbUrl(), ForeignAPIRepo\httpGet(), MediaWiki\EditPage\EditPage\importFormData(), WikiRevision\importLogItem(), MediaWiki\Cache\FileCacheBase\isCacheGood(), MediaWiki\Specials\SpecialRecentChanges\isDenseTagFilter(), MediaWiki\Shell\Shell\isDisabled(), DjVuHandler\isEnabled(), SvgHandler\isEnabled(), MediaWiki\Block\DatabaseBlock\isExpired(), FileDependency\isExpired(), ExifBitmapHandler\isFileMetadataValid(), GIFHandler\isFileMetadataValid(), PNGHandler\isFileMetadataValid(), WebPHandler\isFileMetadataValid(), MediaWiki\Page\MovePage\isValidMoveTarget(), MediaWiki\SiteStats\SiteStats\loadAndLazyInit(), MediaWiki\User\User\loadFromCache(), HTMLFileCache\loadFromFileCache(), MediaWiki\Linker\Linker\makeExternalImage(), MediaWiki\Linker\LinkRenderer\makeExternalLink(), MediaWiki\Linker\Linker\makeImageLink(), MediaWiki\Linker\Linker\makeMediaLinkFile(), ImportStreamSource\newFromURL(), WikiImporter\notice(), RawAction\onView(), LocalFile\purgeThumbList(), SvgHandler\rasterize(), MediaWiki\Maintenance\TextPassDumper\readDump(), UploadStash\removeFileNoAuth(), WikiPage\replaceSectionAtRev(), MediaWiki\MediaWikiEntryPoint\restInPeace(), DjVuImage\retrieveMetaData(), BitmapHandler\rotate(), DoubleRedirectJob\run(), MediaWiki\Cache\FileCacheBase\saveText(), HTMLFileCache\saveToFileCache(), JpegMetadataExtractor\segmentSplitter(), UserMailer\send(), MediaWiki\Output\OutputPage\sendCacheControl(), UserMailer\sendInternal(), UserMailer\sendWithPear(), MediaWiki\Api\ApiMain\setCacheMode(), ViewAction\show(), LocalRepo\skipWriteOperationIfSha1(), MediaWiki\User\User\spreadBlock(), UploadStash\stashFile(), FileRepo\storeBatch(), WikiImporter\throwXmlError(), MediaWiki\Tidy\RemexDriver\tidy(), File\transform(), BitmapHandler\transformCustom(), BitmapHandler\transformGd(), BitmapHandler\transformImageMagick(), BitmapHandler\transformImageMagickExt(), LocalisationCacheBulkLoad\trimCache(), Article\tryFileCache(), LocalFile\upgradeRow(), OldLocalFile\upgradeRow(), MediaWiki\Revision\RevisionRecord\userCanBitfield(), MediaWiki\Linker\Linker\userLink(), MediaWiki\Linker\Linker\userTalkLink(), MediaWiki\Linker\Linker\userToolLinks(), UploadBase\verifyExtension(), UploadBase\verifyFile(), UploadBase\verifyMimeType(), MediaWiki\Api\ApiUpload\verifyUpload(), Article\view(), WikiImporter\warn(), wfClientAcceptsGzip(), wfDebugBacktrace(), wfMemoryLimit(), wfMkdirParents(), 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 939 of file GlobalFunctions.php.
References wfDebug().
Referenced by 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 727 of file GlobalFunctions.php.
Referenced by MediaWiki\MediaWikiEntryPoint\commitMainTransaction(), UploadFromChunks\concatenateChunks(), WebPHandler\decodeLosslessChunkHeader(), WebPHandler\decodeLossyChunkHeader(), JobQueueRedis\doAck(), JobQueueRedis\doBatchPush(), JobQueueRedis\doPop(), DjVuHandler\doTransform(), SvgHandler\doTransform(), TransformationalImageHandler\doTransform(), MediaWiki\FileRepo\AuthenticatedFileEntryPoint\execute(), CheckUsernames\execute(), WebPHandler\extractMetadata(), WebPHandler\extractMetadataFromChunks(), MediaWiki\Message\Message\formatListParam(), IPTC\getCharset(), MediaWiki\Content\ContentHandler\getContentText(), MediaWiki\Request\WebResponse\header(), MediaHandler\logErrorForExternalProcess(), JobQueueFederated\logException(), MediaWiki\Api\ApiBase\logFeatureUsage(), MediaWiki\Api\ApiMain\logRequest(), MediaWiki\Actions\ActionEntryPoint\maybeDoHttpsRedirect(), LocalFile\move(), MediaWiki\Site\MediaWikiPageNameNormalizer\normalizePageName(), IPTC\parse(), MediaWiki\Deferred\CdnCacheUpdate\purge(), UploadFromUrl\reallyFetchFile(), MediaHandler\removeBadFile(), UploadFromUrl\saveTempFileChunk(), MediaWiki\Request\WebResponse\setCookie(), and MediaWiki\Request\WebResponse\statusHeader().
wfDeprecated | ( | $function, | |
$version = false, | |||
$component = false, | |||
$callerOffset = 2 ) |
Logs a warning that a deprecated feature was used.
To write a custom deprecation message, use wfDeprecatedMsg() instead.
string | $function | Feature that is deprecated. |
string | false | $version | Version of MediaWiki that the feature was deprecated in (Added in 1.19). |
string | bool | $component | Component to which the feature belongs. If false, it is assumed the function is in MediaWiki core (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). |
InvalidArgumentException | If the MediaWiki version number specified by $version is neither a string nor false. |
Definition at line 766 of file GlobalFunctions.php.
Referenced by ReverseArrayIterator\__construct(), SearchResultSet\__construct(), ImportReporter\__construct(), MediaWiki\SpecialPage\SpecialRedirectWithAction\__construct(), MediaWiki\Parser\ParserOutput\__construct(), SearchResult\__construct(), MediaWiki\Rest\Handler\Helper\HtmlMessageOutputHelper\__construct(), Wikimedia\ObjectCache\WANObjectCache\__construct(), MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper\__construct(), MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper\__construct(), MediaWiki\Search\Entity\SearchResultThumbnail\__construct(), MediaWiki\Debug\__get(), MediaWiki\User\User\__get(), MediaWiki\Debug\__isset(), MediaWiki\Debug\__set(), MediaWiki\User\User\__set(), MediaWiki\StubObject\DeprecatedGlobal\_newObject(), MediaWiki\StubObject\StubGlobalUser\_newObject(), MediaWiki\HTMLForm\HTMLForm\addFooterText(), MediaWiki\HTMLForm\HTMLForm\addHeaderText(), MediaWiki\Api\ApiModuleManager\addModule(), MediaWiki\Output\OutputPage\addParserOutputText(), MediaWiki\HTMLForm\HTMLForm\addPostText(), MediaWiki\HTMLForm\HTMLForm\addPreText(), ChangeTags\addTags(), MediaWiki\Parser\ParserOutput\addTemplate(), MediaWiki\Parser\Parser\attributeStripCallback(), MediaWiki\User\TempUser\Pattern\buildLike(), MediaWiki\Html\Html\buttonAttributes(), MediaWiki\Specials\SpecialBlock\canBlockEmail(), MediaWiki\User\User\canSendEmail(), MediaWiki\User\ActorMigrationBase\checkDeprecation(), MediaWiki\Content\ContentModelChange\checkPermissions(), Wikimedia\ObjectCache\BagOStuff\clearLastError(), Wikimedia\ObjectCache\WANObjectCache\clearLastError(), MediaWiki\Parser\Parsoid\Config\PageConfigFactory\create(), MediaWiki\Xml\Xml\dateMenu(), JobQueueGroup\deduplicateRootJob(), SearchEngine\defaultNearMatcher(), ChangeTags\defineTag(), SqlBagOStuff\deleteAll(), ChangeTags\deleteTagEverywhere(), MediaWiki\Parser\Parser\doBlockLevels(), WikiPage\doEditUpdates(), RecentChange\doMarkPatrolled(), MediaWiki\Parser\Parser\enableOOUI(), MediaWiki\Maintenance\Maintenance\error(), SqlBagOStuff\expireAll(), MediaWiki\User\CentralId\CentralIdLookup\factory(), MediaWiki\RCFeed\RCFeed\factory(), MediaWiki\Title\Title\flushRestrictions(), MediaWiki\Auth\AuthManager\forcePrimaryAuthenticationProviders(), MediaWiki\Output\OutputPage\formatPermissionsErrorMessage(), MediaWiki\Deferred\LinksUpdate\LinksUpdate\getAddedLinks(), MediaWiki\Content\ContentHandler\getAllContentFormats(), Profiler\getAllowOutput(), MediaWiki\Block\DatabaseBlock\getAutoblockExpiry(), WikiPage\getAutoDeleteReason(), MediaWiki\Content\ContentHandler\getAutoDeleteReason(), LogFormatter\getCommentFormatter(), SearchEngineConfig\getConfig(), LogFormatter\getContentLanguage(), MediaWiki\Content\ContentHandler\getContentModels(), MediaWiki\Content\ContentHandler\getContentText(), MediaWiki\Request\WebRequest\getCrossSiteCookie(), Wikimedia\Rdbms\DBAccessObjectUtils\getDBOptions(), MediaWiki\Content\ContentHandler\getDefaultModelFor(), MediaWiki\Parser\Parser\getDefaultSort(), MediaWiki\ResourceLoader\Module\getDeprecationInformation(), EnhancedChangesList\getDiffHistLinks(), MediaWiki\Language\Language\getDirMarkEntity(), ChangeTags\getDisplayTableName(), BaseTemplate\getFooterIcons(), MediaWiki\HTMLForm\HTMLForm\getFooterText(), MediaWiki\Content\ContentHandler\getForContent(), MediaWiki\Content\ContentHandler\getForModelID(), MediaWiki\Parser\Parser\getFunctionLang(), MediaWiki\Specials\SpecialVersion\getGitHeadSha1(), MediaWiki\Api\ApiPageSet\getGoodAndMissingTitles(), MediaWiki\Api\ApiPageSet\getGoodTitles(), MediaWiki\HTMLForm\HTMLForm\getHeaderText(), MediaWiki\Parser\MagicWord\getId(), MediaWiki\Deferred\LinksUpdate\LinksUpdate\getImages(), LogFormatter\getLinkRenderer(), MediaWiki\Api\ApiPageSet\getMissingTitles(), MediaWiki\Content\AbstractContent\getNativeData(), MediaWiki\Parser\Parser\getOutput(), MediaWiki\Parser\Parser\getPage(), MediaWiki\Title\Title\getPageViewLanguage(), MediaWiki\Content\Renderer\ContentRenderer\getParserOutput(), MediaWiki\SpecialPage\AuthManagerSpecialPage\getPreservedParams(), MediaWiki\HTMLForm\HTMLForm\getPreText(), MediaWiki\Block\DatabaseBlock\getQueryInfo(), Wikimedia\Rdbms\Platform\SQLPlatform\getQueryVerb(), MediaWiki\Block\DatabaseBlock\getRangeCond(), MediaWiki\Block\DatabaseBlockStore\getReadStage(), Article\getRedirectHeaderHtml(), MediaWiki\Content\WikitextContent\getRedirectTargetAndText(), MediaWiki\Api\ApiPageSet\getRedirectTitles(), MediaWiki\Deferred\LinksUpdate\LinksUpdate\getRemovedLinks(), MediaWiki\Linker\Linker\getRollbackEditCount(), Wikimedia\ObjectCache\BagOStuff\getSegmentationSize(), Wikimedia\ObjectCache\MediumSpecificBagOStuff\getSegmentationSize(), Wikimedia\ObjectCache\BagOStuff\getSegmentedValueMaxSize(), Wikimedia\ObjectCache\MediumSpecificBagOStuff\getSegmentedValueMaxSize(), SkinFactory\getSkinNames(), MediaWiki\Content\ContentHandler\getSlotDiffRendererWithOptions(), ChangeTags\getSoftwareTags(), MediaWiki\Api\ApiPageSet\getSpecialTitles(), MediaWiki\Specials\SpecialBlock\getSuggestedDurations(), ChangeTags\getTags(), ChangeTags\getTagsWithData(), MediaWiki\Html\Html\getTextInputAttributes(), MediaWiki\Parser\ParserOutput\getTimeSinceStart(), MediaWiki\Deferred\LinksUpdate\TitleLinksTable\getTitleArray(), MediaWiki\Title\Title\getTitleProtection(), MediaWiki\Api\ApiPageSet\getTitles(), LogFormatter\getUserEditTracker(), WikiImporterFactory\getWikiImporter(), MediaWiki\Block\DatabaseBlockStore\getWriteStage(), MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper\init(), MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper\init(), MediaWiki\EditPage\EditPage\internalAttemptSave(), MediaWiki\User\User\isBlockedFromEmailuser(), MediaWiki\User\User\isBlockedGlobally(), MediaWiki\Request\WebRequest\isSafeRequest(), UploadBase\isThrottled(), MediaWiki\Xml\Xml\languageSelector(), ChangeTags\listDefinedTags(), ChangeTags\listExplicitlyDefinedTags(), ChangeTags\listSoftwareActivatedTags(), ChangeTags\listSoftwareDefinedTags(), MediaWiki\Title\Title\loadRestrictions(), MediaWiki\Api\ApiBase\makeMessage(), Skin\makeSpecialUrl(), Skin\makeSpecialUrlSubpage(), ChangeTags\makeTagSummarySubquery(), MediaWiki\Request\WebRequest\markAsSafeRequest(), ChangeTags\modifyDisplayQuery(), MediaWiki\Xml\Xml\monthSelector(), LogFormatter\newFromEntry(), MediaWiki\Block\DatabaseBlock\newFromID(), LogFormatter\newFromRow(), MediaWiki\Rest\Handler\Helper\PageRestHelperFactory\newHtmlInputTransformHelper(), MediaWiki\Rest\Handler\Helper\PageRestHelperFactory\newHtmlMessageOutputHelper(), MediaWiki\Rest\Handler\Helper\PageRestHelperFactory\newHtmlOutputRendererHelper(), BaseSearchResultSet\next(), MediaWiki\Parser\Parser\Options(), MediaWiki\Parser\Parser\OutputType(), MediaWiki\Storage\PageEditStash\parseAndCache(), MediaWiki\Specials\SpecialBlock\parseExpiryInput(), MediaWiki\SpecialPage\FormSpecialPage\postText(), MediaWiki\Output\OutputPage\prepareErrorPage(), MediaWiki\SpecialPage\FormSpecialPage\preText(), MediaWiki\Specials\SpecialBlock\processForm(), ChangeTags\purgeTagCacheAll(), MediaWiki\Parser\Parser\replaceVariables(), MediaWiki\User\Options\UserOptionsManager\resetOptions(), BaseSearchResultSet\rewind(), UserNamePrefixSearch\search(), MediaWiki\Output\OutputPage\setCategoryLinks(), MediaWiki\Session\SessionProvider\setConfig(), setExtensionData(), MediaWiki\HTMLForm\HTMLForm\setFooterText(), Action\setHeaders(), MediaWiki\SpecialPage\SpecialPage\setHeaders(), MediaWiki\HTMLForm\HTMLForm\setHeaderText(), ImageGalleryBase\setHeights(), MediaWiki\Session\SessionProvider\setHookContainer(), MediaWiki\Output\OutputPage\setIndexPolicy(), MediaWiki\HTMLForm\HTMLForm\setIntro(), TextSlotDiffRenderer\setLanguage(), MediaWiki\Parser\ParserOutput\setLanguageLinks(), MediaWiki\Session\SessionProvider\setLogger(), MediaWiki\Session\SessionProvider\setManager(), MediaWiki\Parser\ParserOutput\setPageProperty(), MediaWiki\Output\OutputPage\setPageTitle(), MediaWiki\HTMLForm\HTMLForm\setPostText(), MediaWiki\HTMLForm\HTMLForm\setPreText(), Profiler\setProfileID(), TextSlotDiffRenderer\setStatsdDataFactory(), MediaWiki\Parser\ParserOptions\setSuppressTOC(), MediaWikiShell\setupLogging(), ImageGalleryBase\setWidths(), MediaWiki\Parser\ParserOptions\setWrapOutputClass(), MediaWiki\Output\OutputPage\showFatalError(), MediaWiki\Output\OutputPage\showPermissionsErrorPage(), MediaWiki\SpecialPage\LoginSignupSpecialPage\showSuccessPage(), MediaWiki\Cache\UserCache\singleton(), ChangeTags\tagUsageStatistics(), JobSpecification\toSerializableArray(), PageArchive\undeleteAsUser(), ChangeTags\updateTags(), MediaWiki\Parser\Sanitizer\validateAttributes(), MediaWiki\Rest\Validator\Validator\validateBody(), MediaWiki\Parser\Parsoid\Config\SiteConfig\variants(), JobQueueGroup\waitForBackups(), wfArrayDiff2(), wfExpandIRI(), wfGetDB(), wfGetServerUrl(), wfMergeErrorArrays(), wfUrlProtocols(), MediaWiki\Xml\Xml\wrapClass(), and MediaWiki\Session\PHPSessionHandler\write().
wfDeprecatedMsg | ( | $msg, | |
$version = false, | |||
$component = false, | |||
$callerOffset = 2 ) |
Log a deprecation warning with arbitrary message text.
A caller description will be appended. If the message has already been sent for this caller, it won't be sent again.
Although there are component and version parameters, they are not automatically appended to the message. The message text should include information about when the thing was deprecated. The component and version are just used to implement $wgDeprecationReleaseLimit.
string | $msg | The message |
string | false | $version | Version of MediaWiki that the function was deprecated in. |
string | bool | $component | Component to which the function belongs. If false, it is assumed the function is in MediaWiki core. |
int | false | $callerOffset | How far up the call stack is the original caller. 2 = function that called the function that called us. If false, the caller description will not be appended. |
Definition at line 797 of file GlobalFunctions.php.
Referenced by MediaWiki\Language\Language\__construct(), MediaWiki\HTMLForm\HTMLFormField\__construct(), MediaWiki\Rest\Validator\JsonBodyValidator\__construct(), Wikimedia\Message\ScalarParam\__construct(), MediaWiki\StubObject\StubGlobalUser\__destruct(), MediaWiki\Parser\CacheTime\__get(), MediaWiki\Parser\ParserOutput\__get(), MediaWiki\Parser\CacheTime\__set(), MediaWiki\Parser\ParserOutput\__set(), MediaWiki\Parser\ParserOutput\addWarningMsg(), MediaWiki\Parser\Parser\braceSubstitution(), MediaWiki\DAO\deprecateInvalidCrossWiki(), MediaWiki\User\User\getActorId(), RecentChange\getAttribute(), MediaWiki\Site\MediaWikiSite\getFileUrl(), MediaWiki\SpecialPage\ContributionsSpecialPage\getForm(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\HTMLForm\Field\HTMLInfoField\getOOUI(), MediaWiki\MediaWikiServices\getService(), MediaWiki\Revision\RevisionStore\getTitle(), LocalFile\loadFromRow(), MediaWiki\User\User\newSystemUser(), MediaWiki\HookContainer\FauxGlobalHookArray\offsetExists(), MediaWiki\HookContainer\FauxGlobalHookArray\offsetGet(), MediaWiki\HookContainer\FauxGlobalHookArray\offsetSet(), MediaWiki\HookContainer\FauxGlobalHookArray\offsetUnset(), MediaWiki\Deferred\LinksUpdate\LinksUpdate\queueRecursiveJobsForTable(), MediaWiki\Api\ApiBase\requirePostedParameters(), MediaWiki\Search\SearchWidgets\DidYouMeanWidget\rewrittenHtml(), MediaWiki\Parser\CacheTime\setCacheTime(), MediaWiki\Specials\SpecialSearch\showResults(), and MediaWiki\Search\SearchWidgets\DidYouMeanWidget\suggestionHtml().
wfEscapeShellArg | ( | $args | ) |
Locale-independent version of escapeshellarg()
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+ (https://bugs.php.net/bug.php?id=54391). The second bug is still open as of 2021.
string|string[] | ...$args strings to escape and glue together, or a single array of strings parameter |
Definition at line 1511 of file GlobalFunctions.php.
wfEscapeWikiText | ( | $input | ) |
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 | null | false | $input | Text to be escaped |
Definition at line 1089 of file GlobalFunctions.php.
References $wgEnableMagicLinks, and $wgUrlProtocols.
Referenced by MediaWiki\Title\MalformedTitleException\__construct(), MediaHandler\addMeta(), MediaWiki\Parser\CoreParserFunctions\basepagename(), MediaWiki\Parser\CoreParserFunctions\basepagenamee(), MediaWiki\Parser\Parser\braceSubstitution(), MediaWiki\Specials\SpecialPageLanguage\changePageLanguage(), MediaWiki\Api\ApiMain\checkAsserts(), MediaWiki\Api\ApiQueryImageInfo\checkParameterNormalise(), MediaWiki\SpecialPage\ContributionsSpecialPage\contributionsSub(), MediaWiki\Api\ApiMain\createPrinterByName(), MediaWiki\Parser\CoreParserFunctions\defaultsort(), MediaWiki\Parser\CoreParserFunctions\displaytitle(), WikiPage\doDeleteArticleReal(), MediaWiki\Api\ApiMain\errorMessagesFromException(), MediaWiki\Specials\SpecialAuthenticationPopupSuccess\execute(), MediaWiki\Specials\SpecialFileDuplicateSearch\execute(), MediaWiki\Specials\SpecialMergeHistory\execute(), MediaWiki\Specials\SpecialUnblock\execute(), MediaWiki\Api\ApiAMCreateAccount\execute(), MediaWiki\Api\ApiClientLogin\execute(), MediaWiki\Api\ApiComparePages\execute(), MediaWiki\Api\ApiEditPage\execute(), MediaWiki\Api\ApiEmailUser\execute(), MediaWiki\Api\ApiExpandTemplates\execute(), MediaWiki\Api\ApiLinkAccount\execute(), MediaWiki\Api\ApiMergeHistory\execute(), MediaWiki\Api\ApiMove\execute(), MediaWiki\Api\ApiOptionsBase\execute(), MediaWiki\Api\ApiParse\execute(), MediaWiki\Api\ApiProtect\execute(), MediaWiki\Api\ApiQueryAllMessages\execute(), MediaWiki\Api\ApiQueryLogEvents\execute(), MediaWiki\Api\ApiQueryUserContribs\execute(), MediaWiki\Api\ApiUndelete\execute(), MediaWiki\Api\ApiUserrights\execute(), MediaWiki\Api\ApiValidatePassword\execute(), MediaWiki\Api\ApiBase\extractRequestParams(), MediaWiki\Parser\CoreParserFunctions\fullpagename(), MediaWiki\Parser\CoreParserFunctions\fullpagenamee(), MediaWiki\Api\ApiErrorFormatter\getMessageFromException(), MediaWiki\Api\ApiBase\getModuleFromPath(), MediaWiki\Api\ApiBase\getTitleFromTitleOrPageId(), MediaWiki\Api\ApiBase\getTitleOrPageId(), MediaWiki\Parser\Parser\getUserSig(), MediaWiki\Api\ApiBase\getWatchlistUser(), RollbackAction\handleRollbackRequest(), MediaWiki\EditPage\EditPage\importFormData(), MediaWiki\Specials\SpecialBlock\maybeAlterFormDefaults(), MediaWiki\Api\ApiQueryImageInfo\mergeThumbParams(), MediaWiki\Specials\SpecialRandomInCategory\onSubmit(), MediaWiki\Specials\SpecialBlock\onSuccess(), MediaWiki\Specials\SpecialPasswordReset\onSuccess(), ImagePage\openShowImage(), MediaWiki\Pager\ImageListPager\outputUserDoesNotExist(), MediaWiki\Parser\CoreParserFunctions\pagename(), MediaWiki\Parser\CoreParserFunctions\pagenamee(), MediaWiki\Api\ApiQueryBase\parsePrefixedTitlePart(), MediaWiki\Specials\SpecialBlock\postHtml(), MediaWiki\Parser\CoreParserFunctions\rootpagename(), MediaWiki\Parser\CoreParserFunctions\rootpagenamee(), MediaWiki\Api\ApiQueryRecentChanges\run(), MediaWiki\Api\ApiQueryRevisions\run(), MediaWiki\Api\ApiMain\setupModule(), MediaWiki\Specials\SpecialSearch\showCreateLink(), MediaWiki\Specials\SpecialUserRights\showEditUserGroupsForm(), MediaWiki\Specials\SpecialUndelete\showHistory(), Article\showMissingArticle(), MediaWiki\Specials\SpecialSearch\showResults(), MediaWiki\SpecialPage\LoginSignupSpecialPage\showSuccessPage(), MediaWiki\EditPage\EditPage\spamPageWithContent(), MediaWiki\Parser\CoreParserFunctions\subjectpagename(), MediaWiki\Parser\CoreParserFunctions\subjectpagenamee(), MediaWiki\Parser\CoreParserFunctions\subpagename(), MediaWiki\Parser\CoreParserFunctions\subpagenamee(), MediaWiki\Parser\CoreParserFunctions\talkpagename(), MediaWiki\Parser\CoreParserFunctions\talkpagenamee(), DeleteAction\tempDelete(), MediaWiki\Api\ApiQueryBase\titlePartToKey(), MediaWiki\Api\ApiFileRevert\validateParameters(), and MediaWiki\Preferences\SignatureValidator\validateSignature().
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 625 of file GlobalFunctions.php.
References $url, wfDeprecated(), and wfGetUrlUtils().
wfExpandUrl | ( | $url, | |
$defaultProto = PROTO_CURRENT ) |
Expand a potentially local URL to a fully-qualified URL using $wgServer (or one of its alternatives).
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
If $url specifies a protocol, or $url is domain-relative and $wgServer specifies a protocol, PROTO_HTTP, PROTO_HTTPS, PROTO_RELATIVE and PROTO_CURRENT do not change that.
Parent references (/../) in the path are resolved (as in UrlUtils::removeDotSegments()).
string | $url | An URL; can be absolute (e.g. http://example.com/foo/bar), protocol-relative (//example.com/foo/bar) or domain-relative (/foo/bar). |
string | int | null | $defaultProto | One of the PROTO_* constants, as described above. |
Definition at line 525 of file GlobalFunctions.php.
References $url, MediaWiki\Utils\UrlUtils\expand(), and wfGetUrlUtils().
wfFormatStackFrame | ( | $frame | ) |
Return a string representation of frame.
Typically, the returned value will be in one of these formats:
array | $frame |
Definition at line 1037 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 | false | $limit | The maximum depth of the stack frame to return, or false for the entire stack. |
Definition at line 1016 of file GlobalFunctions.php.
References wfDebugBacktrace().
Referenced by MediaWiki\Session\SessionBackend\addData(), MediaWiki\Session\SessionBackend\dirty(), and MediaWiki\Session\SessionBackend\renew().
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.
The format will be the same as for {
int | $level |
Definition at line 1000 of file GlobalFunctions.php.
References wfDebugBacktrace(), and wfFormatStackFrame().
Referenced by MediaWiki\StubObject\StubGlobalUser\_unstub(), MediaWiki\StubObject\StubObject\_unstub(), MediaWiki\Deferred\DeferredUpdates\addCallableUpdate(), MediaWiki\Debug\MWDebug\log(), MediaWiki\Request\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_PRIMARY for the primary (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 | false | $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.
Note 3: When replacing calls to this with calls to methods on an injected LoadBalancer, LoadBalancer::getConnection is more commonly needed than LoadBalancer::getMaintenanceConnectionRef, which is needed for more advanced administrative tasks. See the IMaintainableDatabase and IDatabase interfaces for details.
… or, in rare circumstances, you may need to use:
$services->getDBLoadBalancer()->getConnection() / getMaintenanceConnectionRef()
Definition at line 1830 of file GlobalFunctions.php.
References wfDeprecated().
wfGetNull | ( | ) |
Get a platform-independent path to the null file, e.g.
/dev/null
Definition at line 1881 of file GlobalFunctions.php.
References wfIsWindows().
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 538 of file GlobalFunctions.php.
References wfDeprecated(), and wfGetUrlUtils().
wfGetUrlUtils | ( | ) |
Definition at line 473 of file GlobalFunctions.php.
Referenced by MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\generateIconFromFavicon(), MediaWiki\WikiMap\WikiMap\getCanonicalServerInfoForAllWikis(), MediaWiki\Parser\Parser\getExternalLinkRel(), MediaWiki\WikiMap\WikiMap\getWikiFromUrl(), ThumbnailRenderJob\hitThumbUrl(), UploadFromUrl\isAllowedHost(), MediaWiki\RCFeed\RedisPubSubFeedEngine\send(), wfExpandIRI(), wfExpandUrl(), wfGetServerUrl(), wfMatchesDomainList(), wfParseUrl(), wfUrlProtocols(), and wfUrlProtocolsWithoutProtRel().
wfHostname | ( | ) |
Get host name of the current machine, for use in error reporting.
This helps to know which machine in a data center generated the current page.
Definition at line 919 of file GlobalFunctions.php.
References $wgOverrideHostname.
Referenced by MediaWiki\Logger\Monolog\WikiProcessor\__invoke(), MediaWiki\Api\ApiMain\addRequestedFields(), DifferenceEngine\debug(), DjVuHandler\doTransform(), SvgHandler\doTransform(), TransformationalImageHandler\doTransform(), MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(), MediaWiki\Logger\LegacyLogger\formatAsWfLogDBError(), MediaWiki\Output\OutputPage\getBottomScripts(), MediaHandler\logErrorForExternalProcess(), MediaWiki\Parser\Parser\makeLimitReport(), and MediaWiki\FileRepo\ThumbnailEntryPoint\thumbError().
wfHttpError | ( | $code, | |
$label, | |||
$desc ) |
Provide a simple HTTP error.
int | string | $code | |
string | $label | |
string | $desc |
Definition at line 1235 of file GlobalFunctions.php.
References $wgOut.
Referenced by MediaWiki\Specials\SpecialJavaScriptTest\execute(), MediaWiki\Specials\SpecialRunJobs\execute(), and RawAction\getRawText().
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 1473 of file GlobalFunctions.php.
References wfStringToBool().
Referenced by MediaWiki\Http\HttpRequestFactory\canMakeRequests(), MWHttpRequest\canMakeRequests(), UploadBase\isEnabled(), and MediaWiki\Installer\WebInstaller\startSession().
wfIsDebugRawPage | ( | ) |
Returns true if debug logging should be suppressed if $wgDebugRawPage = false.
Definition at line 685 of file GlobalFunctions.php.
References MW_ENTRY_POINT.
Referenced by MediaWiki\Logger\LegacyLogger\__construct(), and wfDebug().
wfIsInfinity | ( | $str | ) |
Determine input string is represents as infinity.
string | $str | The string to determine |
Definition at line 1998 of file GlobalFunctions.php.
Referenced by MediaWiki\Api\ApiProtect\execute(), MediaWiki\Specials\SpecialUserRights\expiryToTimestamp(), MediaWiki\Api\ApiResult\formatExpiry(), BlockLogFormatter\getParametersForApi(), WatchAction\makeSuccessMessage(), MediaWiki\Specials\SpecialBlock\setParameter(), and MediaWiki\Language\Language\translateBlockExpiry().
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 53 of file GlobalFunctions.php.
References $path, and $wgExtensionDirectory.
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 74 of file GlobalFunctions.php.
References $wgExtensionDirectory.
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 90 of file GlobalFunctions.php.
References $path, and $wgStyleDirectory.
wfLoadSkins | ( | array | $skins | ) |
Load multiple skins at once.
string[] | $skins | Array of extension names to load |
Definition at line 105 of file GlobalFunctions.php.
References $wgStyleDirectory.
wfLogDBError | ( | $text, | |
array | $context = [] ) |
Log for database errors.
string | $text | Database error message. |
array | $context | Additional logging context data |
Definition at line 745 of file GlobalFunctions.php.
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 825 of file GlobalFunctions.php.
Referenced by MediaWiki\User\User\__get(), MediaWiki\User\User\__set(), MediaWiki\SpecialPage\ChangesListSpecialPage\areFiltersInConflict(), MediaWiki\Storage\SqlBlobStore\compressData(), MediaWiki\Language\Language\convertGrammar(), MediaWiki\Linker\Linker\emailLink(), FormatMetadata\flattenArrayReal(), LogFormatter\formatParametersForApi(), MediaWiki\SpecialPage\SpecialPageFactory\getPage(), MediaWiki\Html\Html\inlineScript(), and MediaWiki\Output\OutputPage\transformFilePath().
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 639 of file GlobalFunctions.php.
References $url, and wfGetUrlUtils().
wfMemoryLimit | ( | $newLimit | ) |
Raise PHP's memory limit (if needed).
int | $newLimit |
Definition at line 1912 of file GlobalFunctions.php.
References wfDebug(), and wfShorthandToInteger().
wfMerge | ( | string | $old, |
string | $mine, | ||
string | $yours, | ||
?string & | $simplisticMergeAttempt, | ||
?string & | $mergeLeftovers = null ) |
wfMerge attempts to merge differences between three texts.
string | $old | Common base revision |
string | $mine | The edit we wish to store but which potentially conflicts with another edit which happened since we started editing. |
string | $yours | The most recent stored revision of the article. Note that "mine" and "yours" might have another meaning depending on the specific use case. |
string | null | &$simplisticMergeAttempt | Automatically merged text, with overlapping edits falling back to "my" text. |
string | null | &$mergeLeftovers | Optional out parameter containing an "ed" script with the remaining bits of "your" text that could not be merged into $simplisticMergeAttempt. The "ed" file format is documented here: https://www.gnu.org/software/diffutils/manual/html_node/Detailed-ed.html |
Definition at line 1643 of file GlobalFunctions.php.
Referenced by MediaWiki\Content\TextContentHandler\merge3().
wfMergeErrorArrays | ( | $args | ) |
Merge arrays in the style of PermissionManager::getPermissionErrors, with duplicate removal e.g.
wfMergeErrorArrays( [ [ 'x' ] ], [ [ 'x', '2' ] ], [ [ 'x' ] ], [ [ 'y' ] ] ); returns: [ [ 'x', '2' ], [ 'x' ], [ 'y' ] ]
array[] | ...$args |
Definition at line 176 of file GlobalFunctions.php.
References $params, and wfDeprecated().
wfMessage | ( | $key, | |
$params ) |
This is the function for getting translated interface messages.
This function replaces all old wfMsg* functions.
When the MessageSpecifier object is an instance of Message, a clone of the object is returned. This is unlike the new Message( … )
constructor, which returns a new object constructed from scratch with the same key. This difference is mostly relevant when the passed object is an instance of a subclass like RawMessage or ApiMessage.
string | string[] | MessageSpecifier | $key | Message key, or array of keys, or a MessageSpecifier |
MessageParam|MessageSpecifier|string|int|float|list<MessageParam|MessageSpecifier|string|int|float> | ...$params See Message::params() |
Definition at line 851 of file GlobalFunctions.php.
References $params, and wfMessageFallback().
Referenced by MediaWiki\Title\MalformedTitleException\__construct(), MediaTransformError\__construct(), IncompatibleDiffTypesException\__construct(), MediaWiki\HTMLForm\Field\HTMLAutoCompleteSelectField\__construct(), MediaWiki\HTMLForm\Field\HTMLSelectOrOtherField\__construct(), TransformParameterError\__construct(), TransformTooBigImageAreaError\__construct(), UploadStashFile\__construct(), MediaWiki\HTMLForm\CollapsibleFieldsetLayout\__construct(), MediaWiki\Widget\DateInputWidget\__construct(), MediaWiki\Widget\SizeFilterWidget\__construct(), UploadChunkVerificationException\__construct(), LogPage\actionText(), MediaHandler\addMeta(), MediaWiki\Content\WikitextContent\addSectionHeader(), MediaWiki\Content\JsonContent\arrayTable(), MediaWiki\Specials\SpecialVersion\arrayToString(), MediaWiki\Auth\AuthManager\autoCreateUser(), MediaWiki\Auth\AuthManager\beginAccountCreation(), MediaWiki\Auth\AuthManager\beginAccountLink(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\beginLinkAttempt(), MediaWiki\Linker\Linker\blockLink(), MediaWiki\Parser\Parser\braceSubstitution(), MediaWiki\Output\OutputPage\buildBacklinkSubtitle(), MediaWiki\Xml\Xml\buildForm(), ChangesFeed\buildItems(), MediaWiki\Specials\SpecialEditWatchlist\buildTools(), MediaWiki\SpecialPage\SpecialPage\checkLoginSecurityLevel(), UploadStash\clear(), MediaWiki\Auth\AuthManager\continueAccountCreation(), MediaWiki\Auth\AuthManager\continueAccountLink(), MediaWiki\Auth\AuthManager\continueAuthentication(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProvider\continueLinkAttempt(), MediaWiki\Xml\Xml\dateMenu(), MediaWiki\Session\SessionProvider\describe(), MediaWiki\Auth\PasswordAuthenticationRequest\describeCredentials(), MediaWiki\Auth\PasswordDomainAuthenticationRequest\describeCredentials(), MediaWiki\Auth\TemporaryPasswordAuthenticationRequest\describeCredentials(), MediaWiki\Session\SessionProvider\describeMessage(), UploadBase\detectVirus(), MediaWiki\Content\ContentModelChange\doContentModelChange(), MediaWiki\Page\File\FileDeleteForm\doDelete(), DjVuHandler\doTransform(), SvgHandler\doTransform(), TransformationalImageHandler\doTransform(), WikiPage\doUpdateRestrictions(), MediaWiki\Linker\Linker\emailLink(), MediaWiki\Installer\WebInstallerPage\endForm(), MediaWiki\Installer\WebInstallerInstall\endStage(), MediaWiki\Installer\Installer\envCheckDB(), MediaWiki\Maintenance\Maintenance\error(), MediaWiki\Installer\WebInstallerComplete\execute(), MediaWiki\Installer\WebInstallerDBConnect\execute(), MediaWiki\Installer\WebInstallerExistingWiki\execute(), MediaWiki\Installer\WebInstallerInstall\execute(), MediaWiki\Installer\WebInstallerName\execute(), MediaWiki\Installer\WebInstallerRestart\execute(), MediaWiki\Installer\WebInstallerUpgrade\execute(), MediaWiki\Installer\WebInstallerWelcome\execute(), CleanupSpam\execute(), DumpIterator\execute(), DumpMessages\execute(), DumpRenderer\execute(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\failResponse(), MediaWiki\ResourceLoader\MessageBlobStore\fetchMessage(), DeleteEqualMessages\fetchMessageInfo(), MediaWiki\Content\FallbackContentHandler\fillParserOutput(), MediaWiki\Content\JsonContentHandler\fillParserOutput(), ChangesList\flag(), BlockLogFormatter\formatBlockFlag(), BlockLogFormatter\formatBlockFlags(), MediaWiki\Feed\FeedUtils\formatDiff(), MediaWiki\Feed\FeedUtils\formatDiffRow2(), LanguageZh_hans\formatDuration(), WikiPage\formatExpiry(), MediaWiki\Linker\Linker\formatHiddenCategories(), MediaWiki\Linker\Linker\formatRevisionSize(), File\generateAndSaveThumb(), MediaWiki\Content\ContentHandler\getAutoDeleteReason(), MediaWiki\Content\ContentHandler\getAutosummary(), MediaWiki\Installer\WebInstaller\getCheckBox(), MediaWiki\Specials\SpecialVersion\getCopyrightAndAuthorList(), MediaWiki\Installer\Task\Task\getDescription(), Interwiki\getDescription(), LogPage\getDescription(), MediaWiki\Config\ConfigRepository\getDescriptionOf(), MediaWiki\Feed\FeedUtils\getDiffLink(), ImageHandler\getDimensionsString(), MediaWiki\Title\Title\getEditNotices(), MediaWiki\Specials\SpecialUpload\getExistsWarning(), MediaWiki\Specials\SpecialVersion\getExtensionTypes(), MediaWiki\Auth\ConfirmLinkAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\CreationReasonAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\PasswordAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\PasswordDomainAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\RememberMeAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\TemporaryPasswordAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\UserDataAuthenticationRequest\getFieldInfo(), MediaWiki\Auth\UsernameAuthenticationRequest\getFieldInfo(), MediaWiki\Installer\WebInstallerPage\getFieldsetStart(), UploadStash\getFile(), MediaWiki\Installer\WebInstallerDocument\getFileContents(), UploadBase\getFilenamePrefixBlacklist(), IcuCollation\getFirstLetter(), NumericUppercaseCollation\getFirstLetter(), MediaHandler\getGeneralLongDesc(), MediaWiki\User\UserGroupMembership\getGroupPage(), MediaWiki\Installer\WebInstaller\getHelpBox(), MediaWiki\Installer\MysqlConnectForm\getHtml(), MediaWiki\Installer\PostgresConnectForm\getHtml(), MediaWiki\Installer\WebInstaller\getInfoBox(), MediaWiki\Specials\SpecialUpload\getInitialPageText(), MediaWiki\Installer\DatabaseConnectForm\getInstallUserBox(), LogFormatter\getIRCActionComment(), LogFormatter\getIRCActionText(), MediaWiki\Content\ContentHandler\getLocalizedName(), ImageHandler\getLongDesc(), SvgHandler\getLongDesc(), GIFHandler\getLongDesc(), PNGHandler\getLongDesc(), Licenses\getMessageFromParams(), ErrorPageError\getMessageObject(), MediaWiki\Title\MalformedTitleException\getMessageObject(), MediaWiki\Installer\CliInstaller\getMessageText(), Interwiki\getName(), LogPage\getName(), MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\getPasswordResetData(), MediaWiki\EditPage\EditPage\getPreviewLimitReport(), MediaWiki\Installer\WebInstaller\getRadioElements(), LogPage\getRcComment(), LogPage\getRcCommentIRC(), MediaWiki\Installer\DatabaseInstaller\getReadableName(), MediaWiki\Block\DatabaseBlock\getRedactedName(), MediaWiki\Utils\MWTimestamp\getRelativeTimestamp(), MediaWiki\User\User\getRightDescription(), MediaWiki\User\User\getRightDescriptionHtml(), ImageHandler\getShortDesc(), MediaWiki\Utils\MWTimestamp\getTimezoneMessage(), MediaWiki\Parser\Parser\getUserSig(), MediaWiki\Specials\SpecialVersion\getVersion(), FormatMetadata\getVisibleFields(), MediaWiki\Installer\DatabaseSettingsForm\getWebUserBox(), MediaWiki\LinkedData\PageDataRequestHandler\handleRequest(), MediaWiki\Title\Title\hasSourceText(), QuickTemplate\haveMsg(), MediaWiki\LinkedData\PageDataRequestHandler\httpContentNegotiation(), UploadStash\initFile(), WikiPage\insertNullProtectionRevision(), DifferenceEngine\intermediateEditsMsg(), MediaWiki\Parser\Parser\interwikiTransclude(), MediaWiki\Parser\CoreParserFunctions\intFunction(), MediaWiki\Page\MovePage\isValidMove(), MediaWiki\Installer\WebInstaller\label(), MediaWiki\Xml\Xml\languageSelector(), UploadStash\listFiles(), MediaWiki\User\BotPassword\login(), MediaWiki\Linker\LinkRenderer\makeBrokenLink(), MediaWiki\Installer\WebInstaller\makeDownloadLinkHtml(), MediaWiki\Linker\Linker\makeImageLink(), MediaWiki\Api\ApiBase\makeMessage(), MediaWiki\Linker\LinkRenderer\makeRedirectHeader(), MediaWiki\Linker\Linker\makeThumbLink2(), MediaWiki\Page\MergeHistory\merge(), MediaWiki\Xml\Xml\monthSelector(), MWException\msg(), MediaWiki\Context\DerivativeContext\msg(), MediaWiki\Context\RequestContext\msg(), MediaWiki\HTMLForm\HTMLFormField\msg(), QuickTemplate\msg(), SearchEngineConfig\namespacesAsText(), MediaWiki\Html\Html\namespaceSelectorOptions(), MediaWiki\Title\Title\newMainPage(), WikiImporter\notice(), MediaWiki\Content\JsonContent\objectTable(), RawAction\onView(), MediaWiki\Installer\WebInstallerOutput\outputFooter(), MediaWiki\Installer\WebInstallerOutput\outputTitle(), MediaWiki\Json\FormatJson\parse(), MediaWiki\Language\ConverterRule\parse(), SearchEngine\parseNamespacePrefixes(), WikiPage\protectDescription(), MediaWiki\Maintenance\TextPassDumper\readDump(), MediaWiki\Language\LanguageConverter\recursiveConvertRule(), UploadStash\removeFile(), MediaWiki\Content\WikitextContent\replaceSection(), MediaWiki\Linker\Linker\revDeleteLink(), MediaWiki\Linker\Linker\revDeleteLinkDisabled(), MediaWiki\Linker\Linker\revUserLink(), MediaWiki\Linker\Linker\revUserTools(), DoubleRedirectJob\run(), MediaWiki\Storage\PageUpdater\saveRevision(), MediaWiki\User\User\sendConfirmationMail(), MediaWiki\User\User\sendMail(), MediaWiki\User\User\setEmailWithConfirmation(), WikiImporter\setTargetRootPage(), MediaWiki\Installer\WebInstallerUpgrade\showDoneMessage(), MediaWiki\Installer\WebInstaller\showError(), MediaWiki\Installer\WebInstallerExistingWiki\showKeyForm(), MediaWiki\Installer\WebInstaller\showMessage(), MediaWiki\Linker\Linker\specialLink(), MediaWiki\Installer\WebInstallerInstall\startStage(), UploadStash\stashFile(), MediaWiki\Parser\Parser\statelessFetchTemplate(), MediaWiki\Installer\WebInstallerName\submit(), MediaWiki\Installer\WebInstallerOptions\submit(), MediaWiki\Auth\ThrottlePreAuthenticationProvider\testForAccountCreation(), MediaWiki\Auth\ThrottlePreAuthenticationProvider\testForAuthentication(), TraditionalImageGallery\toHTML(), File\transform(), File\transformErrorOutput(), BitmapHandler\transformGd(), MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProvider\tryReset(), MediaWiki\Storage\PageUpdater\updateRevision(), MediaWiki\Linker\Linker\userLink(), MediaWiki\Linker\Linker\userTalkLink(), MediaWiki\Linker\Linker\userToolLinks(), Article\view(), MediaWiki\Session\CookieSessionProvider\whyNoSession(), MediaWiki\Session\ImmutableSessionProviderWithCookie\whyNoSession(), and MediaWiki\CommentFormatter\CommentFormatter\wrapCommentWithBlock().
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 last message key is returned.
string | ...$keys Message keys |
Definition at line 879 of file GlobalFunctions.php.
Referenced by FileRepo\getDisplayName(), ImagePage\openShowImage(), SkinTemplate\tabAction(), and wfMessage().
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. Callers should make sure this is not a storage path. |
int | null | $mode | Chmod value to use, default is $wgDirectoryMode |
string | null | $caller | Optional caller param for debugging. |
Definition at line 1385 of file GlobalFunctions.php.
References $wgDirectoryMode, and wfDebug().
Referenced by MediaWiki\Cache\FileCacheBase\checkCacheDirs(), DjVuHandler\doTransform(), SvgHandler\doTransform(), TransformationalImageHandler\doTransform(), GenerateSitemap\execute(), MediaWiki\Utils\GitInfo\precomputeValues(), MediaWiki\ResourceLoader\ForeignResourceManager\run(), LCStoreCDB\startWrite(), and LCStoreStaticArray\startWrite().
wfMsgReplaceArgs | ( | $message, | |
$args ) |
Replace message parameter keys on the given formatted output.
string | $message | |
array | $args |
Definition at line 891 of file GlobalFunctions.php.
Referenced by MWException\msg().
wfObjectToArray | ( | $objOrArray, | |
$recursive = true ) |
Recursively converts the parameter (an object) to an array with the same data.
@phpcs:ignore MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam
object | array | $objOrArray | |
bool | $recursive |
Definition at line 230 of file GlobalFunctions.php.
References wfObjectToArray().
Referenced by wfObjectToArray().
wfParseUrl | ( | $url | ) |
parse_url() work-alike, but non-broken.
Differences:
1) Handles protocols that don't use :// (e.g., mailto: and news:, as well as protocol-relative URLs) correctly. 2) Adds a "delimiter" element to the array (see (2)). 3) Verifies that the protocol is on the $wgUrlProtocols allowed list. 4) 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 612 of file GlobalFunctions.php.
References $url, and wfGetUrlUtils().
wfPercent | ( | $nr, | |
int | $acc = 2, | ||
bool | $round = true ) |
float | 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 1444 of file GlobalFunctions.php.
wfRandom | ( | ) |
Get a random decimal value in the domain of [0, 1), in a way not likely to give duplicate values for any realistic number of articles.
Definition at line 256 of file GlobalFunctions.php.
Referenced by CompareParserCache\execute(), ResetPageRandom\execute(), MediaWiki\Specials\SpecialRandomInCategory\getRandomTitle(), MediaWiki\Specials\SpecialRandomPage\getRandomTitle(), WikiPage\insertOn(), MediaWiki\Title\Title\invalidateCache(), and MediaWiki\Api\ApiQueryRandom\run().
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 274 of file GlobalFunctions.php.
Referenced by JobQueueDB\doPop(), SvgHandler\doTransform(), BenchmarkLruHash\execute(), BenchmarkSanitizer\execute(), MakeTestEdits\execute(), MediaWiki\Http\Telemetry\getRequestId(), BenchmarkTitleValue\randomize(), and UploadSourceAdapter\registerSource().
wfRecursiveRemoveDir | ( | $dir | ) |
Remove a directory and all its content.
Does not hide error.
string | $dir |
Definition at line 1421 of file GlobalFunctions.php.
References wfRecursiveRemoveDir().
Referenced by MediaWiki\ResourceLoader\ForeignResourceManager\run(), and wfRecursiveRemoveDir().
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 1757 of file GlobalFunctions.php.
References $path, and wfBaseName().
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. 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.
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 1278 of file GlobalFunctions.php.
Referenced by MediaWiki\Api\ApiMain\checkConditionalRequestHeaders(), MediaWiki\Output\OutputPage\checkLastModified(), MediaWiki\Specials\SpecialExport\execute(), and MediaWiki\ResourceLoader\ResourceLoader\tryRespondNotModified().
wfScript | ( | $script = 'index' | ) |
Get the URL path to a MediaWiki entry point.
This is a wrapper to respect $wgScript and $wgLoadScript overrides.
string | $script | Name of entrypoint, without .php extension. |
Definition at line 1854 of file GlobalFunctions.php.
References $wgLoadScript, $wgScript, and $wgScriptPath.
Referenced by MediaWiki\SpecialPage\SpecialPage\addFeedLinks(), MediaWiki\Specials\SpecialRedirect\dispatchLog(), MediaWiki\Specials\SpecialRedirect\dispatchPage(), MediaWiki\Specials\SpecialRedirect\dispatchRevision(), MediaWiki\Specials\SpecialRecentChanges\doHeader(), MediaWiki\Specials\SpecialWatchlist\doHeader(), MediaWiki\SpecialPage\ContributionsSpecialPage\execute(), MediaWiki\Specials\SpecialApiHelp\execute(), MediaWiki\SpecialPage\RedirectSpecialPage\execute(), MediaWiki\Specials\SpecialRecentChanges\execute(), MediaWiki\Api\ApiEntryPoint\execute(), MediaWiki\Api\ApiHelp\fixHelpLinks(), MediaWiki\Specials\SpecialVersion\getEntryPointInfo(), MediaWiki\SpecialPage\ContributionsSpecialPage\getForm(), MediaWiki\Output\OutputPage\getHeadLinksArray(), MediaWiki\Pager\TablePager\getLimitForm(), MediaWiki\Api\ApiOpenSearch\getOpenSearchTemplate(), MediaWiki\Api\ApiRsd\getRsdApiList(), MediaWiki\Pager\HistoryPager\getStartBody(), HistoryAction\onView(), MediaWiki\Search\SearchWidgets\SearchFormWidget\render(), MediaWiki\Api\ApiMain\substituteResultWithError(), and MediaWiki\Specials\SpecialUserRights\switchForm().
wfSetBit | ( | & | $dest, |
$bit, | |||
$state = true ) |
As for wfSetVar except setting a bit.
int | &$dest | |
int | $bit | |
bool | $state |
Definition at line 1200 of file GlobalFunctions.php.
wfSetVar | ( | & | $dest, |
$source, | |||
$force = false ) |
Sets dest to source and returns the original value of dest If source is NULL, it just returns the value, it doesn't set the variable If force is true, it will set the value even if source is NULL.
mixed | &$dest | |
mixed | $source | |
bool | $force |
Definition at line 1183 of file GlobalFunctions.php.
References $source.
Referenced by MediaWiki\SpecialPage\SpecialPage\including(), MediaWiki\Block\DatabaseBlock\isAutoblocking(), MediaWiki\Block\AbstractBlock\isEmailBlocked(), MediaWiki\Block\AbstractBlock\isUsertalkEditAllowed(), MediaWiki\Parser\Parser\Options(), MediaWiki\Parser\Parser\OutputType(), MediaWiki\Parser\CacheTime\setCacheTime(), MediaWiki\Output\OutputPage\setFileVersion(), WikiImporter\setNoticeCallback(), MediaWiki\Parser\ParserOptions\setOptionLegacy(), MediaWiki\Output\OutputPage\setRevisionId(), MediaWiki\Output\OutputPage\setRevisionTimestamp(), MediaWiki\Parser\ParserOutput\setText(), MediaWiki\Parser\ParserOutput\setTimestamp(), MediaWiki\Parser\ParserOptions\setTimestamp(), and MediaWiki\Parser\ParserOutput\setTitleText().
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 1539 of file GlobalFunctions.php.
References wfGetCaller().
Referenced by DjVuHandler\doTransform(), DjVuImage\retrieveMetaData(), and wfShellExecWithStderr().
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 1592 of file GlobalFunctions.php.
References wfGetCaller(), and wfShellExec().
Referenced by UploadBase\detectVirus(), TransformationalImageHandler\getMagickVersion(), SvgHandler\rasterize(), BitmapHandler\rotate(), BitmapHandler\transformCustom(), and BitmapHandler\transformImageMagick().
wfShellWikiCmd | ( | $script, | |
array | $parameters = [], | ||
array | $options = [] ) |
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 1612 of file GlobalFunctions.php.
References $wgPhpCli.
Referenced by CleanupSpam\execute().
wfShorthandToInteger | ( | ?string | $string = '', |
int | $default = -1 ) |
Converts shorthand byte notation to integer form.
null | string | $string | |
int | $default | Returned if $string is empty |
Definition at line 1967 of file GlobalFunctions.php.
Referenced by MediaWiki\Installer\Installer\envCheckMemory(), UploadBase\getMaxPhpUploadSize(), MediaWiki\Api\ApiUpload\getMinUploadChunkSize(), MediaWiki\Request\WebRequestUpload\isIniSizeOverflow(), MediaWiki\Api\ApiMain\setupExternalResponse(), and wfMemoryLimit().
wfStringToBool | ( | $val | ) |
Convert string value to boolean, when the following are interpreted as true:
string | $val |
Definition at line 1489 of file GlobalFunctions.php.
Referenced by 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 1893 of file GlobalFunctions.php.
References $wgIllegalFileChars, and wfBaseName().
Referenced by UploadBase\getTitle(), and MediaWiki\Page\MovePage\isValidFileMove().
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 1367 of file GlobalFunctions.php.
References $wgTmpDirectory.
Referenced by SvgHandler\doTransform(), MWDocGen\execute(), MediaWikiShell\execute(), and MediaWiki\ResourceLoader\Image\rasterize().
wfThumbIsStandard | ( | File | $file, |
array | $params ) |
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 generous.
File | $file | |
array | $params |
Definition at line 2017 of file GlobalFunctions.php.
References $params, $wgImageLimits, $wgResponsiveImages, $wgThumbLimits, and File\getHandler().
wfTimestamp | ( | $outputtype = TS_UNIX, | |
$ts = 0 ) |
Get a timestamp string in one of various formats.
mixed | $outputtype | Output format, one of the TS_* constants. Defaults to Unix timestamp. |
mixed | $ts | A timestamp in any supported format. The function will autodetect which format is supplied and act accordingly. Use 0 or omit to use current time |
Definition at line 1323 of file GlobalFunctions.php.
References wfDebug().
Referenced by MediaWiki\Block\AbstractBlock\__construct(), MediaWiki\Output\OutputPage\adaptCdnTTL(), DumpCategoriesAsRdf\addDumpHeader(), MediaWiki\Api\ApiMain\addRequestedFields(), MediaWiki\Api\ApiQuerySiteinfo\appendExtensions(), MediaWiki\Api\ApiQuerySiteinfo\appendGeneralInfo(), MediaWiki\SpecialPage\ChangesListSpecialPage\buildQuery(), MediaWiki\Cache\FileCacheBase\cacheTimestamp(), MediaWiki\Storage\PageEditStash\checkCache(), MediaWiki\Api\ApiMain\checkConditionalRequestHeaders(), MediaWiki\Output\OutputPage\checkLastModified(), MediaWiki\User\User\confirmationToken(), MediaWiki\Language\Language\date(), LanguageWa\date(), DifferenceEngine\debug(), MediaWiki\Specials\SpecialExport\execute(), MediaWiki\Api\ApiEditPage\execute(), MediaWiki\Api\ApiFeedWatchlist\execute(), MediaWiki\Api\ApiMergeHistory\execute(), MediaWiki\Api\ApiProtect\execute(), MediaWiki\Api\ApiQueryAllUsers\execute(), MediaWiki\Api\ApiQueryBlocks\execute(), MediaWiki\Api\ApiQueryDeletedrevs\execute(), MediaWiki\Api\ApiQueryFilearchive\execute(), MediaWiki\Api\ApiQueryImageInfo\execute(), MediaWiki\Api\ApiSetNotificationTimestamp\execute(), MediaWiki\Api\ApiUndelete\execute(), LocalFileRestoreBatch\execute(), BenchmarkParse\execute(), CleanupUploadStash\execute(), ExpireTemporaryAccounts\execute(), FixTimestamps\execute(), GenerateSitemap\execute(), ImportTextFiles\execute(), RemoveUnusedAccounts\execute(), TestCompression\execute(), UpdateSearchIndex\execute(), MediaWiki\Specials\SpecialUserRights\expiryToTimestamp(), MediaWiki\Api\ApiQueryRevisionsBase\extractRevisionInfo(), MediaWiki\Api\ApiQueryRecentChanges\extractRowInfo(), RepoGroup\findFile(), MediaWiki\Logger\LegacyLogger\formatAsWfDebugLog(), MediaWiki\Feed\FeedUtils\formatDiff(), MediaWiki\Language\Language\formatExpiry(), MediaWiki\Api\ApiResult\formatExpiry(), LogFormatter\formatParameterValueForApi(), MediaWiki\Specials\SpecialUndelete\formatRevisionRow(), MediaWiki\Pager\MergeHistoryPager\formatRow(), MediaWiki\Pager\ImageListPager\formatValue(), RevDelArchivedFileItem\getApiData(), RevDelFileItem\getApiData(), RevDelRevisionItem\getApiData(), MediaWiki\Block\DatabaseBlockStore\getAutoblockExpiry(), NewUsersLogFormatter\getComment(), MediaWiki\Api\ApiQueryUserInfo\getCurrentUserInfo(), LocalFile\getDescriptionTouched(), MediaWiki\User\User\getExperienceLevel(), FormatMetadata\getExtendedMetadataFromFile(), MediaWiki\User\Registration\UserRegistrationLookup\getFirstRegistration(), MediaWiki\Api\ApiQueryImageInfo\getInfo(), MediaWiki\Specials\SpecialActiveUsers\getIntroText(), LogFormatter\getIRCActionText(), MediaWiki\Output\OutputPage\getJSVars(), MediaWiki\RCFeed\MachineReadableRCFeedFormatter\getLine(), BlockLogFormatter\getMessageParameters(), PNGMetadataExtractor\getMetadata(), MediaWiki\Specials\SpecialRandomInCategory\getMinAndMaxForCat(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProvider\getNewPasswordExpiry(), BlockLogFormatter\getParametersForApi(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(), MediaWiki\Pager\ActiveUsersPager\getQueryInfo(), RawAction\getRawText(), DifferenceEngine\getRevisionHeader(), ImageHistoryList\getThumbForLine(), ForeignAPIRepo\getThumbUrlFromCache(), ArchivedFile\getTimestamp(), ForeignAPIFile\getTimestamp(), DatabaseLogEntry\getTimestamp(), ManualLogEntry\getTimestamp(), RCDatabaseLogEntry\getTimestamp(), MediaWiki\RevisionList\RevisionItemBase\getTimestamp(), MediaWiki\User\User\getTouched(), ForeignAPIRepo\httpGet(), ImageHistoryList\imageHistoryLine(), MediaWiki\User\User\isEmailConfirmationPending(), RecentChange\isInRCLifespan(), MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\isTimestampValid(), MediaWiki\User\User\loadDefaults(), MediaWiki\User\User\loadFromCache(), RecentChange\loadFromRow(), MediaWiki\User\User\loadFromRow(), LocalFile\loadFromRow(), MediaWiki\Api\ApiMain\logRequest(), GenerateSitemap\main(), FormatMetadata\makeFormattedData(), MediaWiki\Session\Token\match(), MediaWiki\Specials\SpecialBlock\maybeAlterFormDefaults(), MediaWiki\Output\OutputPage\output(), MediaWiki\Specials\SpecialRecentChanges\outputChangesList(), MediaWiki\Storage\PageEditStash\parseAndCache(), TableCleanup\progress(), MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\providerAllowsAuthenticationDataChange(), LocalFile\publishTo(), MediaWiki\SpecialPage\QueryPage\recache(), MediaWiki\Api\ApiQueryQueryPage\run(), CategoryMembershipChangeJob\run(), MediaWiki\Api\ApiMain\sendCacheHeaders(), MediaWiki\Output\OutputPage\setLastModified(), WikiRevision\setTimestamp(), MediaWiki\Maintenance\BackupDumper\showReport(), MediaWiki\Maintenance\TextPassDumper\showReport(), MediaWiki\Language\Language\time(), MediaWiki\Language\Language\timeanddate(), MediaWiki\Session\Token\toString(), MediaWiki\Api\ApiUpload\transformWarnings(), RecentChangesUpdateJob\updateActiveUsers(), MediaWiki\Block\DatabaseBlockStore\updateTimestamp(), CategoryChangesAsRdf\updateTS(), wfTimestampOrNull(), and XmlDumpWriter\writeTimestamp().
wfTimestampNow | ( | ) |
Convenience function; returns MediaWiki timestamp for the present time.
Definition at line 1352 of file GlobalFunctions.php.
Referenced by MediaWiki\User\UserGroupMembership\__construct(), MediaWiki\Deferred\LinksUpdate\LinksDeletionUpdate\__construct(), CategoryMembershipChange\__construct(), MediaWiki\User\User\confirmEmail(), MediaWiki\Preferences\DefaultPreferencesFactory\datetimePreferences(), MediaWiki\Block\DatabaseBlockStore\doAutoblock(), MediaWiki\Specials\SpecialWatchlist\doHeader(), MediaWiki\PoolCounter\PoolWorkArticleViewOld\doWork(), MediaWiki\Specials\SpecialExport\execute(), MediaWiki\Api\ApiEditPage\execute(), MediaWiki\Api\ApiProtect\execute(), MediaWiki\Api\ApiPurge\execute(), MediaWiki\Api\ApiUserrights\execute(), GenerateSitemap\execute(), ImportTextFiles\execute(), MigrateFileRepoLayout\execute(), ResetUserEmail\execute(), UpdateSearchIndex\execute(), FormatMetadata\fetchExtendedMetadata(), MediaWiki\Session\PHPSessionHandler\gc(), MediaWiki\Preferences\DefaultPreferencesFactory\getDateOptions(), ManualLogEntry\getTimestamp(), MediaWiki\Parser\ParserOptions\getTimestamp(), MediaWiki\EditPage\EditPage\importFormData(), ManualLogEntry\insert(), MediaWiki\Block\DatabaseBlock\isExpired(), Job\newRootJobParams(), MediaWiki\Specials\SpecialLockdb\onSubmit(), MediaWiki\Feed\AtomFeed\outHeader(), MediaWiki\Feed\RSSFeed\outHeader(), MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\providerChangeAuthenticationData(), LogPage\saveContent(), HTMLFileCache\saveToFileCache(), and MediaWiki\Specials\SpecialUserRights\saveUserGroups().
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.
mixed | $outputtype | |
mixed | null | $ts |
Definition at line 1339 of file GlobalFunctions.php.
References wfTimestamp().
Referenced by MediaWiki\Api\ApiQueryUsers\execute(), ResetPageRandom\execute(), MediaWiki\Api\ApiQueryUserInfo\getCurrentUserInfo(), MediaWiki\Rest\Handler\PageHistoryCountHandler\getLastModifiedTimes(), MediaWiki\Watchlist\NoWriteWatchedItemStore\getLatestNotificationTimestamp(), MediaWiki\Watchlist\WatchedItemStore\getLatestNotificationTimestamp(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\getPasswordResetData(), Job\getQueuedTimestamp(), Job\getReleaseTimestamp(), JobSpecification\getReleaseTimestamp(), HTMLCacheUpdateJob\invalidateTitles(), MediaWiki\Auth\AbstractTemporaryPasswordPrimaryAuthenticationProvider\isTimestampValid(), and MediaWiki\User\User\loadFromRow().
wfTransactionalTimeLimit | ( | ) |
Raise the request time limit to $wgTransactionalTimeLimit.
Definition at line 1937 of file GlobalFunctions.php.
References $wgTransactionalTimeLimit.
Referenced by Action\useTransactionalTimeLimit(), MediaWiki\Api\ApiBase\useTransactionalTimeLimit(), and MediaWiki\SpecialPage\SpecialPage\useTransactionalTimeLimit().
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 309 of file GlobalFunctions.php.
Referenced by MediaWiki\Title\Title\__wakeup(), MediaWiki\Output\OutputPage\addHelpLink(), MediaWiki\Parser\CoreParserFunctions\basepagenamee(), FileRepo\getDescriptionRenderUrl(), FileRepo\getDescriptionUrl(), MediaWiki\Title\Title\getLocalURL(), MediaWiki\Site\MediaWikiSite\getPageUrl(), MediaWiki\Title\Title\getPrefixedURL(), MediaWiki\Title\Title\getSubpageUrlForm(), Interwiki\getURL(), MediaWiki\Api\ApiBase\logFeatureUsage(), MediaWiki\Api\ApiMain\logRequest(), MediaWiki\Title\Title\makeTitle(), MediaWiki\Parser\CoreParserFunctions\namespacee(), MediaWiki\Parser\CoreParserFunctions\nse(), MediaWiki\Parser\CoreParserFunctions\rootpagenamee(), MediaWiki\Parser\CoreParserFunctions\speciale(), MediaWiki\Parser\CoreParserFunctions\subjectspacee(), MediaWiki\Parser\CoreParserFunctions\talkspacee(), and MediaWiki\OutputTransform\Stages\DeduplicateStyles\transformText().
wfUrlProtocols | ( | $includeProtocolRelative = true | ) |
Returns a partial regular expression of recognized URL protocols, e.g.
"http:\\/\\/|https:\\/\\/"
bool | $includeProtocolRelative | If false, remove '//' from the returned protocol list. DO NOT USE this directly, use wfUrlProtocolsWithoutProtRel() instead |
Definition at line 568 of file GlobalFunctions.php.
References wfDeprecated(), and wfGetUrlUtils().
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 582 of file GlobalFunctions.php.
References wfGetUrlUtils().
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 1218 of file GlobalFunctions.php.
References $wgOut.
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 812 of file GlobalFunctions.php.
Referenced by Exif\__construct(), MediaWiki\Content\TextContent\__construct(), MediaWiki\Storage\SqlBlobStore\decompressData(), RecentChange\doMarkPatrolled(), MediaWiki\Api\ApiEditPage\execute(), ForeignAPIRepo\fileExistsBatch(), MediaWiki\Pager\ContribsPager\getExtraSortFields(), MediaWiki\Pager\ContribsPager\getIndexField(), MediaWiki\SpecialPage\SpecialPageFactory\getLocalNameFor(), MediaWiki\Language\Language\getMagic(), MediaWiki\Revision\SlotRoleRegistry\getRoleHandler(), MediaWiki\Actions\ActionEntryPoint\initializeArticle(), MediaWiki\Linker\Linker\link(), MediaWiki\Html\Html\linkedScript(), MediaWiki\Linker\Linker\makeBrokenImageLinkObj(), MediaWiki\Html\Html\openElement(), and BacklinkJobUtils\partitionBacklinkJob().