Re: cvs: pear-core /PEAR Installer.php
| From: | Greg Beaver | Date: | Fri, 19 Aug 2005 19:37:02 +0000 |
| Subject: | Re: cvs: pear-core /PEAR Installer.php | ||
| References: | 1 | Groups: | php.pear.cvs php.pear.core |
| Request: | Send a blank email to pear-core+get-3655@lists.php.net to get a copy of this message | ||
This should also read "take out remote FTP functionality that is in
PEAR_RemoteInstaller"
Greg Beaver wrote:
>cellog Fri Aug 19 14:59:29 2005 EDT
>
> Modified files:
> /pear-core/PEAR Installer.php
> Log:
> || should be && in check for is_dir() near checkFileMap()
>
>
>------------------------------------------------------------------------
>
>http://cvs.php.net/diff.php/pear-core/PEAR/Installer.php?r1=1.212&r2=1.213&ty=u
>Index: pear-core/PEAR/Installer.php
>diff -u pear-core/PEAR/Installer.php:1.212 pear-core/PEAR/Installer.php:1.213
>--- pear-core/PEAR/Installer.php:1.212 Thu Aug 18 08:52:09 2005
>+++ pear-core/PEAR/Installer.php Fri Aug 19 14:59:26 2005
>@@ -18,7 +18,7 @@
> * @author Greg Beaver <cellog@php.net>
> * @copyright 1997-2005 The PHP Group
> * @license http://www.php.net/license/3_0.txt PHP License
> 3.0
>- * @version CVS: $Id: Installer.php,v 1.212 2005/08/18 12:52:09 cellog Exp $
>+ * @version CVS: $Id: Installer.php,v 1.213 2005/08/19 18:59:26 cellog Exp $
> * @link http://pear.php.net/package/PEAR
> * @since File available since Release 0.1
> */
>@@ -158,7 +158,7 @@
> * @param string channel name
> * @param bool if true, then files are backed up first
> * @return bool TRUE on success, or a PEAR error on failure
>- * @access private
>+ * @access protected
> */
> function _deletePackageFiles($package, $channel = false, $backup = false)
> {
>@@ -184,10 +184,6 @@
> return $this->raiseError("$channel/$package not installed");
> }
> $ret = array();
>- if ($this->config->isDefinedLayer('ftp') &&
>isset($this->_options['upgrade'])) {
>- $pkg = $this->_registry->getPackage($package, $channel);
>- $this->ftpUninstall($pkg); // no error checking
>- }
> foreach ($filelist as $file => $props) {
> if (empty($props['installed_as'])) {
> continue;
>@@ -988,7 +984,7 @@
> $php_dir = $this->config->get('php_dir', null, $channel);
>
> // {{{ checks to do when not in "force" mode
>- if (empty($options['force']) ||
>@is_dir($this->config->get('php_dir'))) {
>+ if (empty($options['force']) &&
>@is_dir($this->config->get('php_dir'))) {
> $testp = $channel == 'pear.php.net' ? $pkgname : array($channel,
> $pkgname);
> $test =
> $this->_registry->checkFileMap($pkg->getInstallationFileList(true), $testp,
> '1.1');
> if (PEAR::isError($test)) {
>@@ -1259,153 +1255,6 @@
>
> // }}}
>
>- /**
>- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
>- */
>- function ftpUninstall($pkg)
>- {
>- $ftp = &$this->config->getFTP();
>- if (!$ftp) {
>- return $this->raiseError('FTP client not initialized');
>- }
>- $this->log(2, 'Connect to FTP server');
>- $e = $ftp->init();
>- if (PEAR::isError($e)) {
>- return $e;
>- }
>- PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
>- foreach ($pkg->getFilelist() as $file => $atts) {
>- if ($pkg->getPackagexmlVersion() == '1.0') {
>- $channel = 'pear.php.net';
>- switch ($atts['role']) {
>- case 'doc':
>- case 'data':
>- case 'test':
>- $dest_dir = $this->config->get($atts['role'] .
>'_dir', 'ftp', $channel) .
>- DIRECTORY_SEPARATOR . $pkg->getPackage();
>- unset($atts['baseinstalldir']);
>- break;
>- case 'ext':
>- case 'php':
>- $dest_dir = $this->config->get($atts['role'] .
>'_dir', 'ftp', $channel);
>- break;
>- case 'script':
>- $dest_dir = $this->config->get('bin_dir',
>'ftp', $channel);
>- break;
>- default:
>- continue 2;
>- }
>- $save_destdir = $dest_dir;
>- if (!empty($atts['baseinstalldir'])) {
>- $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
>- }
>- if (dirname($file) != '.' &&
>empty($atts['install-as'])) {
>- $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
>- }
>- if (empty($atts['install-as'])) {
>- $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
>- } else {
>- $dest_file = $dest_dir . DIRECTORY_SEPARATOR .
>$atts['install-as'];
>- }
>-
>- // Clean up the DIRECTORY_SEPARATOR mess
>- $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
>- $dest_file = preg_replace(array('!\\\\+!', '!/!',
>"!$ds2+!"),
>- array('/', '/', '/'),
>- $dest_file);
>- } else {
>- $role = &PEAR_Installer_Role::factory($pkg, $atts['role'],
>$this->config);
>- $role->setup($this, $pkg, $atts, $file);
>- if (!$role->isInstallable()) {
>- continue; // this shouldn't happen
>- }
>- list($save_destdir, $dest_dir, $dest_file, $orig_file) =
>- $role->processInstallation($pkg, $atts['attribs'], $file,
>$tmp_path, 'ftp');
>- $dest_file = str_replace(DIRECTORY_SEPARATOR, '/', $dest_file);
>- }
>- $this->log(2, 'Deleting "' . $dest_file . '"');
>- $ftp->rm($dest_file);
>- }
>- PEAR::staticPopErrorHandling();
>- $this->log(2, 'Disconnect from FTP server');
>- return $ftp->disconnect();
>- }
>-
>- /**
>- * Upload an installed package - does not work with register-only packages!
>- * @param PEAR_PackageFile_v1|PEAR_PackageFile_v2
>- */
>- function ftpInstall($pkg)
>- {
>- $ftp = &$this->config->getFTP();
>- if (!$ftp) {
>- return PEAR::raiseError('FTP client not initialized');
>- }
>- $this->log(2, 'Connect to FTP server');
>- $e = $ftp->init();
>- if (PEAR::isError($e)) {
>- return $e;
>- }
>- $pf = &$this->_registry->getPackage($pkg->getPackage(),
>$pkg->getChannel());
>- foreach ($pf->getFilelist() as $file => $atts) {
>- if ($pf->getPackagexmlVersion() == '1.0') {
>- $channel = 'pear.php.net';
>- switch ($atts['role']) {
>- case 'doc':
>- case 'data':
>- case 'test':
>- $dest_dir = $this->config->get($atts['role'] .
>'_dir', 'ftp', $channel) .
>- DIRECTORY_SEPARATOR . $pf->getPackage();
>- unset($atts['baseinstalldir']);
>- break;
>- case 'ext':
>- case 'php':
>- $dest_dir = $this->config->get($atts['role'] .
>'_dir', 'ftp', $channel);
>- break;
>- case 'script':
>- $dest_dir = $this->config->get('bin_dir',
>'ftp', $channel);
>- break;
>- default:
>- continue 2;
>- }
>- $save_destdir = $dest_dir;
>- if (!empty($atts['baseinstalldir'])) {
>- $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
>- }
>- if (dirname($file) != '.' &&
>empty($atts['install-as'])) {
>- $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
>- }
>- if (empty($atts['install-as'])) {
>- $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
>- } else {
>- $dest_file = $dest_dir . DIRECTORY_SEPARATOR .
>$atts['install-as'];
>- }
>-
>- // Clean up the DIRECTORY_SEPARATOR mess
>- $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
>- $dest_file = preg_replace(array('!\\+!', '!/!',
>"!$ds2+!"),
>- array('/', '/', '/'),
>- $dest_file);
>- } else {
>- $role = &PEAR_Installer_Role::factory($pf, $atts['role'],
>$this->config);
>- $role->setup($this, $pf, $atts, $file);
>- if (!$role->isInstallable()) {
>- continue; // this shouldn't happen
>- }
>- list($save_destdir, $dest_dir, $dest_file, $orig_file) =
>- $role->processInstallation($pkg, $atts, $file, $file /* not used */,
>'ftp');
>- $dest_file = str_replace(DIRECTORY_SEPARATOR, '/', $dest_file);
>- }
>- $installedas = $atts['installed_as'];
>- $this->log(2, 'Uploading "' . $installedas . '" to
>"' . $dest_file . '"');
>- if (PEAR::isError($e = $ftp->installFile($installedas, $dest_file))) {
>- return $e;
>- }
>- }
>- $this->log(2, 'Disconnect from FTP server');
>- return $ftp->disconnect();
>- }
>-
> // {{{ _compileSourceFiles()
> /**
> * @param string
>
>
>