diff options
author | Tomas V.V.Cox <cox@php.net> | 2001-07-17 19:13:40 +0000 |
---|---|---|
committer | Tomas V.V.Cox <cox@php.net> | 2001-07-17 19:13:40 +0000 |
commit | 5cb96db14385f5fadac29415b402afb8d943a65b (patch) | |
tree | a5e0668bb7729aed84ced1ae3dbe0bb8340eaa35 | |
parent | 55c6e3795655ce443641e03fe92a4899cfe4a1b9 (diff) | |
download | php-git-5cb96db14385f5fadac29415b402afb8d943a65b.tar.gz |
moved methods log() and mkdirHier() from Packager/Installer to here
-rw-r--r-- | pear/PEAR/Common.php | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/pear/PEAR/Common.php b/pear/PEAR/Common.php index bc50e3523c..f8fbfde2d1 100644 --- a/pear/PEAR/Common.php +++ b/pear/PEAR/Common.php @@ -18,7 +18,7 @@ // +----------------------------------------------------------------------+ // -require_once "PEAR.php"; +require_once 'PEAR.php'; class PEAR_Common extends PEAR { @@ -74,6 +74,37 @@ class PEAR_Common extends PEAR } // }}} + // {{{ mkDirHier() + + function mkDirHier($dir) + { + $dirstack = array(); + while (!@is_dir($dir) && $dir != DIRECTORY_SEPARATOR) { + array_unshift($dirstack, $dir); + $dir = dirname($dir); + } + while ($newdir = array_shift($dirstack)) { + if (mkdir($newdir, 0777)) { + $this->log(2, "created dir $newdir"); + } else { + return false; + } + } + return true; + } + + // }}} + // {{{ log() + + function log($level, $msg) + { + if ($this->debug >= $level) { + print "$msg\n"; + } + } + + // }}} + // {{{ _element_start() function _element_start($xp, $name, $attribs) |