cvs: php4 /pear/PEAR Common.php
| From: | Thomas V.V.Cox | Date: | Tue, 17 Jul 2001 19:13:41 +0000 |
| Subject: | cvs: php4 /pear/PEAR Common.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-284@lists.php.net to get a copy of this message | ||
cox Tue Jul 17 15:13:41 2001 EDT
Modified files:
/php4/pear/PEAR Common.php
Log:
moved methods log() and mkdirHier() from Packager/Installer to here
Index: php4/pear/PEAR/Common.php
diff -u php4/pear/PEAR/Common.php:1.3 php4/pear/PEAR/Common.php:1.4
--- php4/pear/PEAR/Common.php:1.3 Mon Jul 16 14:01:09 2001
+++ php4/pear/PEAR/Common.php Tue Jul 17 15:13:40 2001
@@ -18,7 +18,7 @@
// +----------------------------------------------------------------------+
//
-require_once "PEAR.php";
+require_once 'PEAR.php';
class PEAR_Common extends PEAR
{
@@ -74,6 +74,37 @@
}
// }}}
+ // {{{ 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)