diff options
author | Urban Müller | 2019-05-03 16:39:20 +0200 |
---|---|---|
committer | Urban Müller | 2019-05-10 16:49:57 +0200 |
commit | ac0de5daec59494c93dfcfa798b63b4da883d156 (patch) | |
tree | 2d2e4b74e6786b122cb3617359df6c14515c7cbe | |
parent | a721c5b74898df1de9757f455afd3fd7bf00732a (diff) | |
download | itools-ac0de5daec59494c93dfcfa798b63b4da883d156.tar.gz itools-ac0de5daec59494c93dfcfa798b63b4da883d156.tar.bz2 itools-ac0de5daec59494c93dfcfa798b63b4da883d156.zip |
cdist option for ::file_put
-rw-r--r-- | it.class | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1095,6 +1095,7 @@ static function file_get($filename, $p = array()) * @param $p['keyval'] $data must be an assoc array and is written as tab-separated lines * @param $p['lines'] write array of lines, appending newline * @param $p['mkdir'] create parent directory (one level) + * @param $p['cdist'] distribute saved file */ static function file_put($filename, $data, $p = array()) { @@ -1112,7 +1113,8 @@ static function file_put($filename, $data, $p = array()) $tmpdir = is_dir($tmp) && is_writable($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); + if (($result = rename($tmpfile, $filename)) && $p['cdist']) + $result = it::cdist($filename); return $result; } |