| // +----------------------------------------------------------------------+ // // $Id$ require_once "PEAR/Command/Common.php"; require_once "PEAR/Installer.php"; /** * PEAR commands for installation or deinstallation/upgrading of * packages. * */ class PEAR_Command_Install extends PEAR_Command_Common { // {{{ properties /** Stack of executing commands, to make run() re-entrant * @var array */ var $command_stack; // XXX UNUSED to make run() re-entrant /** Currently executing command. * @var string */ var $command; // XXX UNUSED // }}} // {{{ constructor /** * PEAR_Command_Install constructor. * * @access public */ function PEAR_Command_Install($ui) { parent::PEAR_Command_Common($ui); } // }}} // {{{ getCommands() /** * Return a list of all the commands defined by this class. * @return array list of commands * @access public */ function getCommands() { return array('install', 'uninstall', 'upgrade'); } // }}} // {{{ run() function run($command, $options, $params) { $installer =& new PEAR_Installer($options['php_dir'], $options['ext_dir'], $options['doc_dir']); $installer->debug = @$options['verbose']; $failmsg = ''; switch ($command) { case 'install': case 'upgrade': { if ($command == 'upgrade') { $options['upgrade'] = true; } if ($installer->install($params[0], $options, $this->config)) { $this->ui->displayLine("install ok"); } else { $failmsg = "install failed"; } break; } case 'uninstall': { if ($installer->uninstall($params[0], $uninstall_options)) { $this->ui->displayLine("uninstall ok"); } else { $failmsg = "uninstall failed"; } break; } default: { return false; } } if ($failmsg) { return $this->raiseError($failmsg); } return true; } // }}} } ?>