Jump to navigation Jump to search
This page is a translated version of the page Manual:$wgTmpDirectory and the translation is 21% complete.

Other languages:
العربية • ‎English • ‎español • ‎فارسی • ‎français • ‎日本語 • ‎polski • ‎português do Brasil • ‎中文
Paths: $wgTmpDirectory
The path of the temporary directory.
導入されたバージョン: pre 1.1.0
除去されたバージョン: 使用中
可能な値: 絶対パス
既定値: The path to the directory for temporary files as determined by wfTempDir()[1]
"{$wgUploadDirectoryManual:$wgUploadDirectory}/tmp" 1.20 より前
(注: この変数の既定値は、他の変数に依存します。例えば、LocalSettings.phpManual:LocalSettings.php の実行後に Setup.phpManual:Setup.php 内で値が設定される変数です)
他の設定: アルファベット順 | 機能順


MediaWiki バージョン: 1.20

一時ディレクトリへのローカル ファイルシステムのパスです。このディレクトリには書き込める必要があります。このパスへ Web からアクセス可能である必要は ありません

$wgTmpDirectory is used by wfTempDir() to control where MediaWiki writes temporary files to, including:

  • Old and new tempfiles for external executable based external diff engines configured by $wgExternalDiffEngine
  • TempFSFile - used for chunked uploading, some transformations, and various parts of the file backend code
  • UID Generator node and lock files.
  • Upload from URL
  • The directory which a CACHE_DBA cache places it's DBA database file. Can be overridden using $wgObjectCachesManual:$wgObjectCaches[CACHE_DBA]['dir']. (1.23 で除去済)
  • Importing uploads from XML dumps
  • SvgHandler - used for SVG transformation
  • ...

Common pitfalls

If you are getting this error, an incorrect setting for $wgTmpDirectory often is the cause:

Warning: rename(/tmp/l10n_cache-en.cdb.tmp.335721450,/tmp/l10n_cache-en.cdb): Operation not permitted in /.../vendor/wikimedia/cdb/src/Writer/DBA.php on line 59

Fatal exception of type MWException: Warning: dba_close(): supplied resource is not a valid DBA identifier resource in /.../vendor/wikimedia/cdb/src/Writer/DBA.php on line 54

Fatal error: Uncaught Cdb\Exception: Unable to move the new CDB file into place. in /.../vendor/wikimedia/cdb/src/Writer/DBA.php:60 

The solution is to set $wgTmpDirectory to a folder, which actually is writable by the webserver user.

Sometimes it is useful to have separate directories for the web server and CLI user, if they require different permissions. For example:

$wgTmpDirectory = $IP . '/images/tmp-' . php_sapi_name();

See タスク T126736 for more information!

Usage in unsupported MediaWiki versions

MediaWiki バージョン: 1.19

The path to the temporary directory. When using CACHE_DBA as your $wgMainCacheTypeManual:$wgMainCacheType, this allows you to select which directory is used.