require_once 'PEAR/Common.php';
require_once 'PEAR/Registry.php';
require_once 'PEAR/Dependency.php';
+require_once 'System.php';
define('PEAR_INSTALLER_OK', 1);
define('PEAR_INSTALLER_FAILED', 0);
if ($need_download) {
$downloaddir = $this->config->get('download_dir');
if (empty($downloaddir)) {
- if (PEAR::isError($downloaddir = $this->mkTempDir())) {
+ if (PEAR::isError($downloaddir = System::mktemp('-d'))) {
return $downloaddir;
}
$this->log(2, '+ tmp dir created at ' . $downloaddir);
chdir($oldcwd);
}
- if (PEAR::isError($tmpdir = $this->mkTempDir())) {
+ if (PEAR::isError($tmpdir = System::mktemp('-d'))) {
return $tmpdir;
}
$this->log(2, '+ tmp dir created at ' . $tmpdir);
}
}
+ if (empty($options['force'])) {
+ // checks to do when not in "force" mode
+ $test = $this->registry->checkFileMap($pkginfo);
+ if (sizeof($test)) {
+ $tmp = $test;
+ foreach ($tmp as $file => $pkg) {
+ if ($pkg == $pkgname) {
+ unset($test[$file]);
+ }
+ }
+ if (sizeof($test)) {
+ $msg = "$pkgname: conflicting files found:\n";
+ $longest = max(array_map("strlen", array_keys($test)));
+ $fmt = "%${longest}s (%s)\n";
+ foreach ($test as $file => $pkg) {
+ $msg .= sprintf($fmt, $file, $pkg);
+ }
+ return $this->raiseError($msg);
+ }
+ }
+ }
+
if (empty($options['upgrade'])) {
// checks to do only when installing new packages
if (empty($options['force']) && $this->registry->packageExists($pkgname)) {