diff options
Diffstat (limited to 'extlib')
-rw-r--r-- | extlib/get_temp_dir.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/extlib/get_temp_dir.php b/extlib/get_temp_dir.php new file mode 100644 index 000000000..4ec96e522 --- /dev/null +++ b/extlib/get_temp_dir.php @@ -0,0 +1,14 @@ +<?php +if ( !function_exists('sys_get_temp_dir')) { + function sys_get_temp_dir() { + if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); } + if (!empty($_ENV['TMPDIR'])) { return realpath( $_ENV['TMPDIR']); } + if (!empty($_ENV['TEMP'])) { return realpath( $_ENV['TEMP']); } + $tempfile=tempnam(uniqid(rand(),TRUE),''); + if (file_exists($tempfile)) { + unlink($tempfile); + } + return realpath(dirname($tempfile)); + } +} +?> |