cvs: php4 /pear/PEAR Common.php

From: Date: Mon, 08 Oct 2001 06:10:54 +0000
Subject: cvs: php4 /pear/PEAR Common.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-955@lists.php.net to get a copy of this message
cox Mon Oct 8 02:10:54 2001 EDT Modified files: /php4/pear/PEAR Common.php Log: added mkTempDir to create temporal directories Index: php4/pear/PEAR/Common.php diff -u php4/pear/PEAR/Common.php:1.15 php4/pear/PEAR/Common.php:1.16 --- php4/pear/PEAR/Common.php:1.15 Sun Oct 7 23:31:14 2001 +++ php4/pear/PEAR/Common.php Mon Oct 8 02:10:54 2001 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.15 2001/10/08 03:31:14 cox Exp $ +// $Id: Common.php,v 1.16 2001/10/08 06:10:54 cox Exp $ require_once 'PEAR.php'; require_once 'Archive/Tar.php'; @@ -79,7 +79,7 @@ $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 @@ $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; @@ -125,6 +125,18 @@ } // }}} + + 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()

« previous php.pear.cvs (#955) next »