Manual:GlobalFunctions.php
| MediaWiki ファイル: GlobalFunctions.php | |
|---|---|
| 場所: | includes/ |
| ソース コード: | master • 1.45.1 • 1.44.3 • 1.43.6 |
| クラス: | コードを検索 • 説明文書を検索 |
GlobalFunctions.php はグローバル関数のファイルで、wfMessage に使用する internationalisation などの重要な関数を含みます。
- wfMessage (廃止予定になった wfMsg と wfMsgExt を置換)
- wfRunHooks() は、Hooks:run() を呼び出していましたが、のちに HookContainer に置き換えられました。
関数
wfFindFile()
| MediaWiki バージョン: | ≦ 1.38 |
(1.34 で廃止予定)
(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()
| MediaWiki バージョン: | ≦ 1.32 |
(1.32 で除去) wfRunHooks() の使用事例を 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() を使用して page.page_random を生成します。
wfBaseConvert()
(1.27 で廃止予定)
(1.31 で除去)
Use Wikimedia\base_convert() directly.
wfBaseConvert( sha1( $text ), 16, 36, 31 ) 関数は revision.rev_sha1 にbase-36 SHA-1文の記述のハッシュを生成します。
ApiQueryRevisions などAPIモジュールはwfBaseConvert( $revision->getSha1(), 36, 16, 40 )を使用します。
wfTempDir()
この関数はテンポラリファイルに対し、システムディレクトリを確保する働きをします。
wfIsCLI()
| MediaWiki バージョン: | ≧ 1.31 Gerrit change 401682 |
Returns true if the code is being run from the command line.