/** * 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. * * @return string */ function wfTempDir() { global $wgTmpDirectory; if ($wgTmpDirectory !== false) { return $wgTmpDirectory; } return TempFSFile::getUsableTempDirectory(); }