Manual:GlobalFunctions.php
Arquivo MediaWiki: GlobalFunctions.php | |
---|---|
Local: | includes/ |
Código fonte: | master • 1.39.3 • 1.38.6 • 1.35.10 |
Classes: | Encontre o código • Encontre a documentação |
GlobalFunctions.php é um arquivo que contém funções globais, incluindo funções importantes como wfMsgExt, o qual é utilizado para internationalisation .
- wfMessage (antes de wfMsg e wfMsgExt, agora obsoleto)
- wfRunHooks() , chama Hooks:run() .
Funções
wfFindFile()
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.
This function has been deprecated. Use MediaWikiServices::getInstance()->getRepoGroup()->findFile()
instead.
wfRunHooks()
Versão 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 MediaWiki: | ≤ 1.31 Gerrit change 401682 |
Returns true if the code is being run from the command line.