Changeset 1879
- Timestamp:
- 08/30/06 14:46:24 (2 years ago)
- Files:
-
- trunk/data/tasks/sfPakePlugins.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/data/tasks/sfPakePlugins.php
r1867 r1879 45 45 $packages = array($args[1]); 46 46 pake_echo_action('plugin', 'installing plugin "'.$args[1].'"'); 47 $ret= _pear_run_command($config, 'install', array(), $packages);48 49 _pear_restore_config($old_config); 50 51 if ($ ret&& !strpos($ret, 'not installed'))52 { 53 throw new Exception($ ret);47 list($ret, $error) = _pear_run_command($config, 'install', array(), $packages); 48 49 _pear_restore_config($old_config); 50 51 if ($error)// && !strpos($ret, 'not installed')) 52 { 53 throw new Exception($error); 54 54 } 55 55 } … … 69 69 $packages = array($args[1]); 70 70 pake_echo_action('plugin', 'upgrading plugin "'.$args[1].'"'); 71 $ret = _pear_run_command($config, 'upgrade', array(), $packages);72 73 _pear_restore_config($old_config); 74 75 if ($ ret && !strpos($ret, 'not installed'))76 { 77 throw new Exception($ ret);71 list($ret, $error) = _pear_run_command($config, 'upgrade', array('loose' => true), $packages); 72 73 _pear_restore_config($old_config); 74 75 if ($error) 76 { 77 throw new Exception($error); 78 78 } 79 79 } … … 90 90 list($old_config, $config) = _pear_init($method); 91 91 92 // install plugin92 // uninstall plugin 93 93 $packages = array($args[1]); 94 94 pake_echo_action('plugin', 'uninstalling plugin "'.$args[1].'"'); 95 $ret= _pear_run_command($config, 'uninstall', array(), $packages);96 97 _pear_restore_config($old_config); 98 99 if ($ ret)100 { 101 throw new Exception($ ret);95 list($ret, $error) = _pear_run_command($config, 'uninstall', array(), $packages); 96 97 _pear_restore_config($old_config); 98 99 if ($error) 100 { 101 throw new Exception($error); 102 102 } 103 103 } … … 118 118 function _pear_run_command($config, $command, $opts, $params) 119 119 { 120 ob_start( );120 ob_start('_pear_echo_message', 2); 121 121 $cmd = PEAR_Command::factory($command, $config); 122 122 $ret = ob_get_clean(); … … 126 126 } 127 127 128 ob_start( );128 ob_start('_pear_echo_message', 2); 129 129 $ok = $cmd->run($command, $opts, $params); 130 130 $ret .= ob_get_clean(); 131 131 132 return (PEAR::isError($ok) ? $ret.$ok->getMessage() : null); 132 $ret = trim($ret); 133 134 return PEAR::isError($ok) ? array($ret, $ok->getMessage()) : array($ret, null); 135 } 136 137 function _pear_echo_message($message) 138 { 139 $t = ''; 140 foreach (explode("\n", $message) as $line) 141 { 142 if ($line = trim($line)) 143 { 144 $t .= pake_format_action('pear', $line); 145 } 146 } 147 148 return $t; 133 149 } 134 150 … … 224 240 { 225 241 // register our channel 226 $ret= _pear_run_command($config, 'channel-discover', array(), array('pear.symfony-project.com'));227 if ($ ret && !strpos($ret, 'already initialized'))228 { 229 throw new Exception($ ret);242 list($ret, $error) = _pear_run_command($config, 'channel-discover', array(), array('pear.symfony-project.com')); 243 if ($error && !strpos($error, 'already initialized')) 244 { 245 throw new Exception($error); 230 246 } 231 247