1
0
mirror of https://github.com/php/php-src.git synced 2026-04-10 01:23:53 +02:00

added mkTempDir to create temporal directories

This commit is contained in:
Tomas V.V.Cox
2001-10-08 06:10:54 +00:00
parent fb487bc38d
commit 5f5bbfd3f3

View File

@@ -79,7 +79,7 @@ class PEAR_Common extends PEAR
$file = array_shift($this->_tempfiles))
{
if (@is_dir($file)) {
System::rm("-rf $file"); // XXX FIXME Windows
System::rm("-rf $file");
} elseif (file_exists($file)) {
unlink($file);
}
@@ -105,7 +105,7 @@ class PEAR_Common extends PEAR
$dir = dirname($dir);
}
while ($newdir = array_shift($dirstack)) {
if (mkdir($newdir, 0777)) {
if (mkdir($newdir, 0755)) {
$this->log(2, "+ created dir $newdir");
} else {
return false;
@@ -126,6 +126,18 @@ class PEAR_Common extends PEAR
// }}}
function mkTempDir()
{
$dir = (OS_WINDOWS) ? 'c:\\windows\\temp' : '/tmp';
$tmpdir = tempnam($tmpdir, 'pear');
unlink($tmpdir);
if (!mkdir($tmpdir, 0700)) {
return $this->raiseError("Unable to create temporary directory $tmpdir");
}
$this->addTempFile($tmpdir);
return $tmpdir;
}
// {{{ _element_start()
function _element_start($xp, $name, $attribs)