projects
/
pharext
/
pharext
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
19ed5a5
)
private tempnames
author
Michael Wallner
<mike@php.net>
Sat, 28 Mar 2015 10:58:10 +0000
(11:58 +0100)
committer
Michael Wallner
<mike@php.net>
Sat, 28 Mar 2015 10:58:10 +0000
(11:58 +0100)
src/pharext/Tempname.php
patch
|
blob
|
history
diff --git
a/src/pharext/Tempname.php
b/src/pharext/Tempname.php
index b5e7520284f864a594937b7867104fb79c7716ce..d46250f7472b379e44ea17f98355af06d2f83eab 100644
(file)
--- a/
src/pharext/Tempname.php
+++ b/
src/pharext/Tempname.php
@@
-2,6
+2,8
@@
namespace pharext;
namespace pharext;
+use pharext\Exception;
+
/**
* A temporary file/directory name
*/
/**
* A temporary file/directory name
*/
@@
-17,7
+19,11
@@
class Tempname
* @param string $suffix e.g. file extension
*/
public function __construct($prefix, $suffix = null) {
* @param string $suffix e.g. file extension
*/
public function __construct($prefix, $suffix = null) {
- $this->name = sys_get_temp_dir() . "/" . uniqid($prefix) . $suffix;
+ $temp = sys_get_temp_dir() . "/pharext-" . posix_getlogin();
+ if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
+ throw new Exception;
+ }
+ $this->name = $temp ."/". uniqid($prefix) . $suffix;
}
/**
}
/**