Add a sys_get_temp_dir substitute to extlib for easier installation on versions that lack it
darcs-hash:20080924150828-f6e2c-4c592c60b7ff6b0cae5a222a5d871fc875217e13.gz
This commit is contained in:
parent
ca4f358362
commit
537819ba8a
14
extlib/get_temp_dir.php
Normal file
14
extlib/get_temp_dir.php
Normal file
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user