cvs: php4 /pear/PEAR Installer.php

From: Date: Mon, 10 Dec 2001 17:00:33 +0000
Subject: cvs: php4 /pear/PEAR Installer.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1503@lists.php.net to get a copy of this message
ssb Mon Dec 10 12:00:33 2001 EDT Modified files: /php4/pear/PEAR Installer.php Log: * added fold marks, moved around some code and silenced some Archive_Tar notices Index: php4/pear/PEAR/Installer.php diff -u php4/pear/PEAR/Installer.php:1.27 php4/pear/PEAR/Installer.php:1.28 --- php4/pear/PEAR/Installer.php:1.27 Wed Nov 14 20:24:35 2001 +++ php4/pear/PEAR/Installer.php Mon Dec 10 12:00:32 2001 @@ -18,7 +18,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: Installer.php,v 1.27 2001/11/15 01:24:35 cox Exp $ +// $Id: Installer.php,v 1.28 2001/12/10 17:00:32 ssb Exp $ require_once 'PEAR/Common.php'; require_once 'PEAR/Registry.php'; @@ -80,6 +80,45 @@ } // }}} + + // {{{ _installFile() + + function _installFile($file, $dest_dir, $atts) + { + $type = strtolower($atts['role']); + switch ($type) { + case 'test': + // don't install test files for now + $this->log(2, "+ Test file $file won't be installed yet"); + return true; + break; + case 'doc': + case 'php': + default: + $dest_file = $dest_dir . basename($file); + break; + } + if (!@is_dir($dest_dir)) { + if (!$this->mkDirHier($dest_dir)) { + $this->log(0, "failed to mkdir $dest_dir"); + return false; + } + $this->log(2, "+ created dir $dest_dir"); + } + $orig_perms = fileperms($file); + if (!@copy($file, $dest_file)) { + $this->log(0, "failed to copy $file to $dest_file"); + return false; + } + chmod($dest_file, $orig_perms); + $this->log(2, "+ copy $file to $dest_file"); + // FIXME Update Package database here + //$this->updatePackageListFrom("$d/$file"); + $this->log(1, "installed file $dest_file"); + return true; + } + + // }}} // {{{ install() /** @@ -148,7 +187,7 @@ $this->log(2, '+ tmp dir created at ' . $tmpdir); $tar = new Archive_Tar($pkgfile, true); - if (!$tar->extract($tmpdir)) { + if (!@$tar->extract($tmpdir)) { chdir($oldcwd); return $this->raiseError("unable to unpack $pkgfile"); } @@ -201,45 +240,7 @@ } // }}} - - // {{{ _installFile() - - function _installFile($file, $dest_dir, $atts) - { - $type = strtolower($atts['role']); - switch ($type) { - case 'test': - // don't install test files for now - $this->log(2, "+ Test file $file won't be installed yet"); - return true; - break; - case 'doc': - case 'php': - default: - $dest_file = $dest_dir . basename($file); - break; - } - if (!@is_dir($dest_dir)) { - if (!$this->mkDirHier($dest_dir)) { - $this->log(0, "failed to mkdir $dest_dir"); - return false; - } - $this->log(2, "+ created dir $dest_dir"); - } - $orig_perms = fileperms($file); - if (!@copy($file, $dest_file)) { - $this->log(0, "failed to copy $file to $dest_file"); - return false; - } - chmod($dest_file, $orig_perms); - $this->log(2, "+ copy $file to $dest_file"); - // FIXME Update Package database here - //$this->updatePackageListFrom("$d/$file"); - $this->log(1, "installed file $dest_file"); - return true; - } - - // }}} + // {{{ uninstall() function uninstall($package) { @@ -263,6 +264,8 @@ $this->registry->deletePackage($package); return true; } + + // }}} } ?>

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