diff options
author | Urban Müller | 2019-04-05 14:36:33 +0200 |
---|---|---|
committer | Urban Müller | 2019-04-05 14:36:33 +0200 |
commit | 5f503cf2949eca81810dcba0b9d5290913a5ce8a (patch) | |
tree | cf22444d5eea9d465a75a24d3d0400d74fa92f73 | |
parent | 7243fa31a6bb8ae20d444294bb5c7cf67ec99e3d (diff) | |
download | itools-5f503cf2949eca81810dcba0b9d5290913a5ce8a.tar.gz itools-5f503cf2949eca81810dcba0b9d5290913a5ce8a.tar.bz2 itools-5f503cf2949eca81810dcba0b9d5290913a5ce8a.zip |
avoid creating tmpfiles in dest dir
-rw-r--r-- | it.class | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1108,9 +1108,11 @@ static function file_put($filename, $data, $p = array()) if ($p['mkdir'] && $filename != "-") @mkdir(dirname($filename)); - $tmpfile = dirname($filename) . "/.it_put." . basename($filename) . "." . getmypid(); + $tmp = $GLOBALS['ULTRAHOME'] . "/tmp"; + $tmpdir = is_dir($tmp) && stat($tmp)[0] == stat(dirname($filename))[0] ? $tmp : dirname($filename); + $tmpfile = "$tmpdir/.it_put." . basename($filename) . "." . getmypid(); if (($result = it::file_put_contents($filename == "-" ? "php://stdout" : $tmpfile, $data)) !== false && $filename != "-") - $result = rename($tmpfile, $filename); + $result = rename($tmpfile, $filename); return $result; } |