Manual:GlobalFunctions.php
| Arquivo do MediaWiki: GlobalFunctions.php | |
|---|---|
| Localização: | includes/ |
| Código-fonte: | master • 1.44.2 • 1.43.5 • 1.39.15 |
| Classes: | Encontrar código • Encontrar documentação |
GlobalFunctions.php é um arquivo que contém funções globais, incluindo funções importantes como wfMsgExt, o qual é utilizado para $i18n.
- $wfMessage (antes de wfMsg e wfMsgExt, agora obsoleto)
- $wfRunHooks, chama $run.
Funções
wfFindFile()
| Versão do MediaWiki: | ≤ 1.38 |
(obsoleto na versão 1.34)
(removido na 1.39)
Use MediaWikiServices::getInstance()->getRepoGroup()->findFile() instead.
Passing a string (with a file name) or a Title object, returns a File object, or false if the file does not exist.
It's a shortcut for RepoGroup::singleton()->findFile().
Use RepoGroup::singleton()->getLocalRepo()->findFile() if you need to get files only from the local repository.
wfRunHooks()
| Versão do MediaWiki: | ≤ 1.32 |
(removido na 1.32)
Exemplo de uso da função wfRunHooks(), a partir de WikiPage:doEditContent():
$hook_args = array( &$this, &$user, $content, $summary,
$flags & EDIT_MINOR, null, null, &$flags, $revision, &$status, $baseRevId );
ContentHandler::runLegacyHooks( 'ArticleSaveComplete', $hook_args );
wfRunHooks( 'PageContentSaveComplete', $hook_args );
wfRandom()
wfRandom() é utilizada para preencher page.page_random.
wfBaseConvert()
(obsoleto na versão 1.27)
(removido na 1.31)
Use Wikimedia\base_convert() directly.
A função utilizada para gerar o hash de conteúdo do texto de base-36 SHA-1 em revision.rev_sha1 é wfBaseConvert( sha1( $text ), 16, 36, 31 ).
Módulos API como ApiQueryRevisions usam wfBaseConvert( $revision->getSha1(), 36, 16, 40 ).
wfTempDir()
This function attempts to get the system directory for temporary files.
wfIsCLI()
| Versão do MediaWiki: | ≥ 1.31 Gerrit change 401682 |
Returns true if the code is being run from the command line.