diff options
Diffstat (limited to 'pear/PEAR/Common.php')
-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) |