diff options
author | Florian Pritz <bluewind@xinu.at> | 2014-11-08 17:25:31 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-05-21 18:43:13 +0200 |
commit | 1172f71ca8cc22384ab4bf7242c7645d88e0f6c8 (patch) | |
tree | f303443429bb5ebaa480ec72b2d030238102ea6d /application/libraries | |
parent | e6e68d4417b3b33cfb16753340460f617b847361 (diff) |
Support multiple files with the same hash
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/libraries')
-rw-r--r-- | application/libraries/Tempfile.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/application/libraries/Tempfile.php b/application/libraries/Tempfile.php new file mode 100644 index 000000000..f42efbfdf --- /dev/null +++ b/application/libraries/Tempfile.php @@ -0,0 +1,31 @@ +<?php +/* + * Copyright 2015 Florian "Bluewind" Pritz <bluewind@server-speed.net> + * + * Licensed under AGPLv3 + * (see COPYING for full license text) + * + */ + +namespace libraries; + +class Tempfile { + private $file; + + public function __construct() + { + $this->file = tempnam(sys_get_temp_dir(), "tempfile"); + } + + public function __destruct() + { + if (file_exists($this->file)) { + unlink($this->file); + } + } + + public function get_file() + { + return $this->file; + } +} |