summaryrefslogtreecommitdiffstats
path: root/application/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'application/libraries')
-rw-r--r--application/libraries/Tempfile.php31
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;
+ }
+}