Install.php 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268
  1. <?php
  2. /**
  3. * PEAR_Command_Install (install, upgrade, upgrade-all, uninstall, bundle, run-scripts commands)
  4. *
  5. * PHP versions 4 and 5
  6. *
  7. * @category pear
  8. * @package PEAR
  9. * @author Stig Bakken <ssb@php.net>
  10. * @author Greg Beaver <cellog@php.net>
  11. * @copyright 1997-2009 The Authors
  12. * @license http://opensource.org/licenses/bsd-license.php New BSD License
  13. * @version CVS: $Id: Install.php 313023 2011-07-06 19:17:11Z dufuz $
  14. * @link http://pear.php.net/package/PEAR
  15. * @since File available since Release 0.1
  16. */
  17. /**
  18. * base class
  19. */
  20. require_once 'PEAR/Command/Common.php';
  21. /**
  22. * PEAR commands for installation or deinstallation/upgrading of
  23. * packages.
  24. *
  25. * @category pear
  26. * @package PEAR
  27. * @author Stig Bakken <ssb@php.net>
  28. * @author Greg Beaver <cellog@php.net>
  29. * @copyright 1997-2009 The Authors
  30. * @license http://opensource.org/licenses/bsd-license.php New BSD License
  31. * @version Release: 1.9.4
  32. * @link http://pear.php.net/package/PEAR
  33. * @since Class available since Release 0.1
  34. */
  35. class PEAR_Command_Install extends PEAR_Command_Common
  36. {
  37. // {{{ properties
  38. var $commands = array(
  39. 'install' => array(
  40. 'summary' => 'Install Package',
  41. 'function' => 'doInstall',
  42. 'shortcut' => 'i',
  43. 'options' => array(
  44. 'force' => array(
  45. 'shortopt' => 'f',
  46. 'doc' => 'will overwrite newer installed packages',
  47. ),
  48. 'loose' => array(
  49. 'shortopt' => 'l',
  50. 'doc' => 'do not check for recommended dependency version',
  51. ),
  52. 'nodeps' => array(
  53. 'shortopt' => 'n',
  54. 'doc' => 'ignore dependencies, install anyway',
  55. ),
  56. 'register-only' => array(
  57. 'shortopt' => 'r',
  58. 'doc' => 'do not install files, only register the package as installed',
  59. ),
  60. 'soft' => array(
  61. 'shortopt' => 's',
  62. 'doc' => 'soft install, fail silently, or upgrade if already installed',
  63. ),
  64. 'nobuild' => array(
  65. 'shortopt' => 'B',
  66. 'doc' => 'don\'t build C extensions',
  67. ),
  68. 'nocompress' => array(
  69. 'shortopt' => 'Z',
  70. 'doc' => 'request uncompressed files when downloading',
  71. ),
  72. 'installroot' => array(
  73. 'shortopt' => 'R',
  74. 'arg' => 'DIR',
  75. 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT), use packagingroot for RPM',
  76. ),
  77. 'packagingroot' => array(
  78. 'shortopt' => 'P',
  79. 'arg' => 'DIR',
  80. 'doc' => 'root directory used when packaging files, like RPM packaging',
  81. ),
  82. 'ignore-errors' => array(
  83. 'doc' => 'force install even if there were errors',
  84. ),
  85. 'alldeps' => array(
  86. 'shortopt' => 'a',
  87. 'doc' => 'install all required and optional dependencies',
  88. ),
  89. 'onlyreqdeps' => array(
  90. 'shortopt' => 'o',
  91. 'doc' => 'install all required dependencies',
  92. ),
  93. 'offline' => array(
  94. 'shortopt' => 'O',
  95. 'doc' => 'do not attempt to download any urls or contact channels',
  96. ),
  97. 'pretend' => array(
  98. 'shortopt' => 'p',
  99. 'doc' => 'Only list the packages that would be downloaded',
  100. ),
  101. ),
  102. 'doc' => '[channel/]<package> ...
  103. Installs one or more PEAR packages. You can specify a package to
  104. install in four ways:
  105. "Package-1.0.tgz" : installs from a local file
  106. "http://example.com/Package-1.0.tgz" : installs from
  107. anywhere on the net.
  108. "package.xml" : installs the package described in
  109. package.xml. Useful for testing, or for wrapping a PEAR package in
  110. another package manager such as RPM.
  111. "Package[-version/state][.tar]" : queries your default channel\'s server
  112. ({config master_server}) and downloads the newest package with
  113. the preferred quality/state ({config preferred_state}).
  114. To retrieve Package version 1.1, use "Package-1.1," to retrieve
  115. Package state beta, use "Package-beta." To retrieve an uncompressed
  116. file, append .tar (make sure there is no file by the same name first)
  117. To download a package from another channel, prefix with the channel name like
  118. "channel/Package"
  119. More than one package may be specified at once. It is ok to mix these
  120. four ways of specifying packages.
  121. '),
  122. 'upgrade' => array(
  123. 'summary' => 'Upgrade Package',
  124. 'function' => 'doInstall',
  125. 'shortcut' => 'up',
  126. 'options' => array(
  127. 'channel' => array(
  128. 'shortopt' => 'c',
  129. 'doc' => 'upgrade packages from a specific channel',
  130. 'arg' => 'CHAN',
  131. ),
  132. 'force' => array(
  133. 'shortopt' => 'f',
  134. 'doc' => 'overwrite newer installed packages',
  135. ),
  136. 'loose' => array(
  137. 'shortopt' => 'l',
  138. 'doc' => 'do not check for recommended dependency version',
  139. ),
  140. 'nodeps' => array(
  141. 'shortopt' => 'n',
  142. 'doc' => 'ignore dependencies, upgrade anyway',
  143. ),
  144. 'register-only' => array(
  145. 'shortopt' => 'r',
  146. 'doc' => 'do not install files, only register the package as upgraded',
  147. ),
  148. 'nobuild' => array(
  149. 'shortopt' => 'B',
  150. 'doc' => 'don\'t build C extensions',
  151. ),
  152. 'nocompress' => array(
  153. 'shortopt' => 'Z',
  154. 'doc' => 'request uncompressed files when downloading',
  155. ),
  156. 'installroot' => array(
  157. 'shortopt' => 'R',
  158. 'arg' => 'DIR',
  159. 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)',
  160. ),
  161. 'ignore-errors' => array(
  162. 'doc' => 'force install even if there were errors',
  163. ),
  164. 'alldeps' => array(
  165. 'shortopt' => 'a',
  166. 'doc' => 'install all required and optional dependencies',
  167. ),
  168. 'onlyreqdeps' => array(
  169. 'shortopt' => 'o',
  170. 'doc' => 'install all required dependencies',
  171. ),
  172. 'offline' => array(
  173. 'shortopt' => 'O',
  174. 'doc' => 'do not attempt to download any urls or contact channels',
  175. ),
  176. 'pretend' => array(
  177. 'shortopt' => 'p',
  178. 'doc' => 'Only list the packages that would be downloaded',
  179. ),
  180. ),
  181. 'doc' => '<package> ...
  182. Upgrades one or more PEAR packages. See documentation for the
  183. "install" command for ways to specify a package.
  184. When upgrading, your package will be updated if the provided new
  185. package has a higher version number (use the -f option if you need to
  186. upgrade anyway).
  187. More than one package may be specified at once.
  188. '),
  189. 'upgrade-all' => array(
  190. 'summary' => 'Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]',
  191. 'function' => 'doUpgradeAll',
  192. 'shortcut' => 'ua',
  193. 'options' => array(
  194. 'channel' => array(
  195. 'shortopt' => 'c',
  196. 'doc' => 'upgrade packages from a specific channel',
  197. 'arg' => 'CHAN',
  198. ),
  199. 'nodeps' => array(
  200. 'shortopt' => 'n',
  201. 'doc' => 'ignore dependencies, upgrade anyway',
  202. ),
  203. 'register-only' => array(
  204. 'shortopt' => 'r',
  205. 'doc' => 'do not install files, only register the package as upgraded',
  206. ),
  207. 'nobuild' => array(
  208. 'shortopt' => 'B',
  209. 'doc' => 'don\'t build C extensions',
  210. ),
  211. 'nocompress' => array(
  212. 'shortopt' => 'Z',
  213. 'doc' => 'request uncompressed files when downloading',
  214. ),
  215. 'installroot' => array(
  216. 'shortopt' => 'R',
  217. 'arg' => 'DIR',
  218. 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT), use packagingroot for RPM',
  219. ),
  220. 'ignore-errors' => array(
  221. 'doc' => 'force install even if there were errors',
  222. ),
  223. 'loose' => array(
  224. 'doc' => 'do not check for recommended dependency version',
  225. ),
  226. ),
  227. 'doc' => '
  228. WARNING: This function is deprecated in favor of using the upgrade command with no params
  229. Upgrades all packages that have a newer release available. Upgrades are
  230. done only if there is a release available of the state specified in
  231. "preferred_state" (currently {config preferred_state}), or a state considered
  232. more stable.
  233. '),
  234. 'uninstall' => array(
  235. 'summary' => 'Un-install Package',
  236. 'function' => 'doUninstall',
  237. 'shortcut' => 'un',
  238. 'options' => array(
  239. 'nodeps' => array(
  240. 'shortopt' => 'n',
  241. 'doc' => 'ignore dependencies, uninstall anyway',
  242. ),
  243. 'register-only' => array(
  244. 'shortopt' => 'r',
  245. 'doc' => 'do not remove files, only register the packages as not installed',
  246. ),
  247. 'installroot' => array(
  248. 'shortopt' => 'R',
  249. 'arg' => 'DIR',
  250. 'doc' => 'root directory used when installing files (ala PHP\'s INSTALL_ROOT)',
  251. ),
  252. 'ignore-errors' => array(
  253. 'doc' => 'force install even if there were errors',
  254. ),
  255. 'offline' => array(
  256. 'shortopt' => 'O',
  257. 'doc' => 'do not attempt to uninstall remotely',
  258. ),
  259. ),
  260. 'doc' => '[channel/]<package> ...
  261. Uninstalls one or more PEAR packages. More than one package may be
  262. specified at once. Prefix with channel name to uninstall from a
  263. channel not in your default channel ({config default_channel})
  264. '),
  265. 'bundle' => array(
  266. 'summary' => 'Unpacks a Pecl Package',
  267. 'function' => 'doBundle',
  268. 'shortcut' => 'bun',
  269. 'options' => array(
  270. 'destination' => array(
  271. 'shortopt' => 'd',
  272. 'arg' => 'DIR',
  273. 'doc' => 'Optional destination directory for unpacking (defaults to current path or "ext" if exists)',
  274. ),
  275. 'force' => array(
  276. 'shortopt' => 'f',
  277. 'doc' => 'Force the unpacking even if there were errors in the package',
  278. ),
  279. ),
  280. 'doc' => '<package>
  281. Unpacks a Pecl Package into the selected location. It will download the
  282. package if needed.
  283. '),
  284. 'run-scripts' => array(
  285. 'summary' => 'Run Post-Install Scripts bundled with a package',
  286. 'function' => 'doRunScripts',
  287. 'shortcut' => 'rs',
  288. 'options' => array(
  289. ),
  290. 'doc' => '<package>
  291. Run post-installation scripts in package <package>, if any exist.
  292. '),
  293. );
  294. // }}}
  295. // {{{ constructor
  296. /**
  297. * PEAR_Command_Install constructor.
  298. *
  299. * @access public
  300. */
  301. function PEAR_Command_Install(&$ui, &$config)
  302. {
  303. parent::PEAR_Command_Common($ui, $config);
  304. }
  305. // }}}
  306. /**
  307. * For unit testing purposes
  308. */
  309. function &getDownloader(&$ui, $options, &$config)
  310. {
  311. if (!class_exists('PEAR_Downloader')) {
  312. require_once 'PEAR/Downloader.php';
  313. }
  314. $a = &new PEAR_Downloader($ui, $options, $config);
  315. return $a;
  316. }
  317. /**
  318. * For unit testing purposes
  319. */
  320. function &getInstaller(&$ui)
  321. {
  322. if (!class_exists('PEAR_Installer')) {
  323. require_once 'PEAR/Installer.php';
  324. }
  325. $a = &new PEAR_Installer($ui);
  326. return $a;
  327. }
  328. function enableExtension($binaries, $type)
  329. {
  330. if (!($phpini = $this->config->get('php_ini', null, 'pear.php.net'))) {
  331. return PEAR::raiseError('configuration option "php_ini" is not set to php.ini location');
  332. }
  333. $ini = $this->_parseIni($phpini);
  334. if (PEAR::isError($ini)) {
  335. return $ini;
  336. }
  337. $line = 0;
  338. if ($type == 'extsrc' || $type == 'extbin') {
  339. $search = 'extensions';
  340. $enable = 'extension';
  341. } else {
  342. $search = 'zend_extensions';
  343. ob_start();
  344. phpinfo(INFO_GENERAL);
  345. $info = ob_get_contents();
  346. ob_end_clean();
  347. $debug = function_exists('leak') ? '_debug' : '';
  348. $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : '';
  349. $enable = 'zend_extension' . $debug . $ts;
  350. }
  351. foreach ($ini[$search] as $line => $extension) {
  352. if (in_array($extension, $binaries, true) || in_array(
  353. $ini['extension_dir'] . DIRECTORY_SEPARATOR . $extension, $binaries, true)) {
  354. // already enabled - assume if one is, all are
  355. return true;
  356. }
  357. }
  358. if ($line) {
  359. $newini = array_slice($ini['all'], 0, $line);
  360. } else {
  361. $newini = array();
  362. }
  363. foreach ($binaries as $binary) {
  364. if ($ini['extension_dir']) {
  365. $binary = basename($binary);
  366. }
  367. $newini[] = $enable . '="' . $binary . '"' . (OS_UNIX ? "\n" : "\r\n");
  368. }
  369. $newini = array_merge($newini, array_slice($ini['all'], $line));
  370. $fp = @fopen($phpini, 'wb');
  371. if (!$fp) {
  372. return PEAR::raiseError('cannot open php.ini "' . $phpini . '" for writing');
  373. }
  374. foreach ($newini as $line) {
  375. fwrite($fp, $line);
  376. }
  377. fclose($fp);
  378. return true;
  379. }
  380. function disableExtension($binaries, $type)
  381. {
  382. if (!($phpini = $this->config->get('php_ini', null, 'pear.php.net'))) {
  383. return PEAR::raiseError('configuration option "php_ini" is not set to php.ini location');
  384. }
  385. $ini = $this->_parseIni($phpini);
  386. if (PEAR::isError($ini)) {
  387. return $ini;
  388. }
  389. $line = 0;
  390. if ($type == 'extsrc' || $type == 'extbin') {
  391. $search = 'extensions';
  392. $enable = 'extension';
  393. } else {
  394. $search = 'zend_extensions';
  395. ob_start();
  396. phpinfo(INFO_GENERAL);
  397. $info = ob_get_contents();
  398. ob_end_clean();
  399. $debug = function_exists('leak') ? '_debug' : '';
  400. $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : '';
  401. $enable = 'zend_extension' . $debug . $ts;
  402. }
  403. $found = false;
  404. foreach ($ini[$search] as $line => $extension) {
  405. if (in_array($extension, $binaries, true) || in_array(
  406. $ini['extension_dir'] . DIRECTORY_SEPARATOR . $extension, $binaries, true)) {
  407. $found = true;
  408. break;
  409. }
  410. }
  411. if (!$found) {
  412. // not enabled
  413. return true;
  414. }
  415. $fp = @fopen($phpini, 'wb');
  416. if (!$fp) {
  417. return PEAR::raiseError('cannot open php.ini "' . $phpini . '" for writing');
  418. }
  419. if ($line) {
  420. $newini = array_slice($ini['all'], 0, $line);
  421. // delete the enable line
  422. $newini = array_merge($newini, array_slice($ini['all'], $line + 1));
  423. } else {
  424. $newini = array_slice($ini['all'], 1);
  425. }
  426. foreach ($newini as $line) {
  427. fwrite($fp, $line);
  428. }
  429. fclose($fp);
  430. return true;
  431. }
  432. function _parseIni($filename)
  433. {
  434. if (!file_exists($filename)) {
  435. return PEAR::raiseError('php.ini "' . $filename . '" does not exist');
  436. }
  437. if (filesize($filename) > 300000) {
  438. return PEAR::raiseError('php.ini "' . $filename . '" is too large, aborting');
  439. }
  440. ob_start();
  441. phpinfo(INFO_GENERAL);
  442. $info = ob_get_contents();
  443. ob_end_clean();
  444. $debug = function_exists('leak') ? '_debug' : '';
  445. $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : '';
  446. $zend_extension_line = 'zend_extension' . $debug . $ts;
  447. $all = @file($filename);
  448. if (!$all) {
  449. return PEAR::raiseError('php.ini "' . $filename .'" could not be read');
  450. }
  451. $zend_extensions = $extensions = array();
  452. // assume this is right, but pull from the php.ini if it is found
  453. $extension_dir = ini_get('extension_dir');
  454. foreach ($all as $linenum => $line) {
  455. $line = trim($line);
  456. if (!$line) {
  457. continue;
  458. }
  459. if ($line[0] == ';') {
  460. continue;
  461. }
  462. if (strtolower(substr($line, 0, 13)) == 'extension_dir') {
  463. $line = trim(substr($line, 13));
  464. if ($line[0] == '=') {
  465. $x = trim(substr($line, 1));
  466. $x = explode(';', $x);
  467. $extension_dir = str_replace('"', '', array_shift($x));
  468. continue;
  469. }
  470. }
  471. if (strtolower(substr($line, 0, 9)) == 'extension') {
  472. $line = trim(substr($line, 9));
  473. if ($line[0] == '=') {
  474. $x = trim(substr($line, 1));
  475. $x = explode(';', $x);
  476. $extensions[$linenum] = str_replace('"', '', array_shift($x));
  477. continue;
  478. }
  479. }
  480. if (strtolower(substr($line, 0, strlen($zend_extension_line))) ==
  481. $zend_extension_line) {
  482. $line = trim(substr($line, strlen($zend_extension_line)));
  483. if ($line[0] == '=') {
  484. $x = trim(substr($line, 1));
  485. $x = explode(';', $x);
  486. $zend_extensions[$linenum] = str_replace('"', '', array_shift($x));
  487. continue;
  488. }
  489. }
  490. }
  491. return array(
  492. 'extensions' => $extensions,
  493. 'zend_extensions' => $zend_extensions,
  494. 'extension_dir' => $extension_dir,
  495. 'all' => $all,
  496. );
  497. }
  498. // {{{ doInstall()
  499. function doInstall($command, $options, $params)
  500. {
  501. if (!class_exists('PEAR_PackageFile')) {
  502. require_once 'PEAR/PackageFile.php';
  503. }
  504. if (isset($options['installroot']) && isset($options['packagingroot'])) {
  505. return $this->raiseError('ERROR: cannot use both --installroot and --packagingroot');
  506. }
  507. $reg = &$this->config->getRegistry();
  508. $channel = isset($options['channel']) ? $options['channel'] : $this->config->get('default_channel');
  509. if (!$reg->channelExists($channel)) {
  510. return $this->raiseError('Channel "' . $channel . '" does not exist');
  511. }
  512. if (empty($this->installer)) {
  513. $this->installer = &$this->getInstaller($this->ui);
  514. }
  515. if ($command == 'upgrade' || $command == 'upgrade-all') {
  516. // If people run the upgrade command but pass nothing, emulate a upgrade-all
  517. if ($command == 'upgrade' && empty($params)) {
  518. return $this->doUpgradeAll($command, $options, $params);
  519. }
  520. $options['upgrade'] = true;
  521. } else {
  522. $packages = $params;
  523. }
  524. $instreg = &$reg; // instreg used to check if package is installed
  525. if (isset($options['packagingroot']) && !isset($options['upgrade'])) {
  526. $packrootphp_dir = $this->installer->_prependPath(
  527. $this->config->get('php_dir', null, 'pear.php.net'),
  528. $options['packagingroot']);
  529. $instreg = new PEAR_Registry($packrootphp_dir); // other instreg!
  530. if ($this->config->get('verbose') > 2) {
  531. $this->ui->outputData('using package root: ' . $options['packagingroot']);
  532. }
  533. }
  534. $abstractpackages = $otherpackages = array();
  535. // parse params
  536. PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
  537. foreach ($params as $param) {
  538. if (strpos($param, 'http://') === 0) {
  539. $otherpackages[] = $param;
  540. continue;
  541. }
  542. if (strpos($param, 'channel://') === false && @file_exists($param)) {
  543. if (isset($options['force'])) {
  544. $otherpackages[] = $param;
  545. continue;
  546. }
  547. $pkg = new PEAR_PackageFile($this->config);
  548. $pf = $pkg->fromAnyFile($param, PEAR_VALIDATE_DOWNLOADING);
  549. if (PEAR::isError($pf)) {
  550. $otherpackages[] = $param;
  551. continue;
  552. }
  553. $exists = $reg->packageExists($pf->getPackage(), $pf->getChannel());
  554. $pversion = $reg->packageInfo($pf->getPackage(), 'version', $pf->getChannel());
  555. $version_compare = version_compare($pf->getVersion(), $pversion, '<=');
  556. if ($exists && $version_compare) {
  557. if ($this->config->get('verbose')) {
  558. $this->ui->outputData('Ignoring installed package ' .
  559. $reg->parsedPackageNameToString(
  560. array('package' => $pf->getPackage(),
  561. 'channel' => $pf->getChannel()), true));
  562. }
  563. continue;
  564. }
  565. $otherpackages[] = $param;
  566. continue;
  567. }
  568. $e = $reg->parsePackageName($param, $channel);
  569. if (PEAR::isError($e)) {
  570. $otherpackages[] = $param;
  571. } else {
  572. $abstractpackages[] = $e;
  573. }
  574. }
  575. PEAR::staticPopErrorHandling();
  576. // if there are any local package .tgz or remote static url, we can't
  577. // filter. The filter only works for abstract packages
  578. if (count($abstractpackages) && !isset($options['force'])) {
  579. // when not being forced, only do necessary upgrades/installs
  580. if (isset($options['upgrade'])) {
  581. $abstractpackages = $this->_filterUptodatePackages($abstractpackages, $command);
  582. } else {
  583. $count = count($abstractpackages);
  584. foreach ($abstractpackages as $i => $package) {
  585. if (isset($package['group'])) {
  586. // do not filter out install groups
  587. continue;
  588. }
  589. if ($instreg->packageExists($package['package'], $package['channel'])) {
  590. if ($count > 1) {
  591. if ($this->config->get('verbose')) {
  592. $this->ui->outputData('Ignoring installed package ' .
  593. $reg->parsedPackageNameToString($package, true));
  594. }
  595. unset($abstractpackages[$i]);
  596. } elseif ($count === 1) {
  597. // Lets try to upgrade it since it's already installed
  598. $options['upgrade'] = true;
  599. }
  600. }
  601. }
  602. }
  603. $abstractpackages =
  604. array_map(array($reg, 'parsedPackageNameToString'), $abstractpackages);
  605. } elseif (count($abstractpackages)) {
  606. $abstractpackages =
  607. array_map(array($reg, 'parsedPackageNameToString'), $abstractpackages);
  608. }
  609. $packages = array_merge($abstractpackages, $otherpackages);
  610. if (!count($packages)) {
  611. $c = '';
  612. if (isset($options['channel'])){
  613. $c .= ' in channel "' . $options['channel'] . '"';
  614. }
  615. $this->ui->outputData('Nothing to ' . $command . $c);
  616. return true;
  617. }
  618. $this->downloader = &$this->getDownloader($this->ui, $options, $this->config);
  619. $errors = $downloaded = $binaries = array();
  620. $downloaded = &$this->downloader->download($packages);
  621. if (PEAR::isError($downloaded)) {
  622. return $this->raiseError($downloaded);
  623. }
  624. $errors = $this->downloader->getErrorMsgs();
  625. if (count($errors)) {
  626. $err = array();
  627. $err['data'] = array();
  628. foreach ($errors as $error) {
  629. if ($error !== null) {
  630. $err['data'][] = array($error);
  631. }
  632. }
  633. if (!empty($err['data'])) {
  634. $err['headline'] = 'Install Errors';
  635. $this->ui->outputData($err);
  636. }
  637. if (!count($downloaded)) {
  638. return $this->raiseError("$command failed");
  639. }
  640. }
  641. $data = array(
  642. 'headline' => 'Packages that would be Installed'
  643. );
  644. if (isset($options['pretend'])) {
  645. foreach ($downloaded as $package) {
  646. $data['data'][] = array($reg->parsedPackageNameToString($package->getParsedPackage()));
  647. }
  648. $this->ui->outputData($data, 'pretend');
  649. return true;
  650. }
  651. $this->installer->setOptions($options);
  652. $this->installer->sortPackagesForInstall($downloaded);
  653. if (PEAR::isError($err = $this->installer->setDownloadedPackages($downloaded))) {
  654. $this->raiseError($err->getMessage());
  655. return true;
  656. }
  657. $binaries = $extrainfo = array();
  658. foreach ($downloaded as $param) {
  659. PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
  660. $info = $this->installer->install($param, $options);
  661. PEAR::staticPopErrorHandling();
  662. if (PEAR::isError($info)) {
  663. $oldinfo = $info;
  664. $pkg = &$param->getPackageFile();
  665. if ($info->getCode() != PEAR_INSTALLER_NOBINARY) {
  666. if (!($info = $pkg->installBinary($this->installer))) {
  667. $this->ui->outputData('ERROR: ' .$oldinfo->getMessage());
  668. continue;
  669. }
  670. // we just installed a different package than requested,
  671. // let's change the param and info so that the rest of this works
  672. $param = $info[0];
  673. $info = $info[1];
  674. }
  675. }
  676. if (!is_array($info)) {
  677. return $this->raiseError("$command failed");
  678. }
  679. if ($param->getPackageType() == 'extsrc' ||
  680. $param->getPackageType() == 'extbin' ||
  681. $param->getPackageType() == 'zendextsrc' ||
  682. $param->getPackageType() == 'zendextbin'
  683. ) {
  684. $pkg = &$param->getPackageFile();
  685. if ($instbin = $pkg->getInstalledBinary()) {
  686. $instpkg = &$instreg->getPackage($instbin, $pkg->getChannel());
  687. } else {
  688. $instpkg = &$instreg->getPackage($pkg->getPackage(), $pkg->getChannel());
  689. }
  690. foreach ($instpkg->getFilelist() as $name => $atts) {
  691. $pinfo = pathinfo($atts['installed_as']);
  692. if (!isset($pinfo['extension']) ||
  693. in_array($pinfo['extension'], array('c', 'h'))
  694. ) {
  695. continue; // make sure we don't match php_blah.h
  696. }
  697. if ((strpos($pinfo['basename'], 'php_') === 0 &&
  698. $pinfo['extension'] == 'dll') ||
  699. // most unices
  700. $pinfo['extension'] == 'so' ||
  701. // hp-ux
  702. $pinfo['extension'] == 'sl') {
  703. $binaries[] = array($atts['installed_as'], $pinfo);
  704. break;
  705. }
  706. }
  707. if (count($binaries)) {
  708. foreach ($binaries as $pinfo) {
  709. PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
  710. $ret = $this->enableExtension(array($pinfo[0]), $param->getPackageType());
  711. PEAR::staticPopErrorHandling();
  712. if (PEAR::isError($ret)) {
  713. $extrainfo[] = $ret->getMessage();
  714. if ($param->getPackageType() == 'extsrc' ||
  715. $param->getPackageType() == 'extbin') {
  716. $exttype = 'extension';
  717. } else {
  718. ob_start();
  719. phpinfo(INFO_GENERAL);
  720. $info = ob_get_contents();
  721. ob_end_clean();
  722. $debug = function_exists('leak') ? '_debug' : '';
  723. $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : '';
  724. $exttype = 'zend_extension' . $debug . $ts;
  725. }
  726. $extrainfo[] = 'You should add "' . $exttype . '=' .
  727. $pinfo[1]['basename'] . '" to php.ini';
  728. } else {
  729. $extrainfo[] = 'Extension ' . $instpkg->getProvidesExtension() .
  730. ' enabled in php.ini';
  731. }
  732. }
  733. }
  734. }
  735. if ($this->config->get('verbose') > 0) {
  736. $chan = $param->getChannel();
  737. $label = $reg->parsedPackageNameToString(
  738. array(
  739. 'channel' => $chan,
  740. 'package' => $param->getPackage(),
  741. 'version' => $param->getVersion(),
  742. ));
  743. $out = array('data' => "$command ok: $label");
  744. if (isset($info['release_warnings'])) {
  745. $out['release_warnings'] = $info['release_warnings'];
  746. }
  747. $this->ui->outputData($out, $command);
  748. if (!isset($options['register-only']) && !isset($options['offline'])) {
  749. if ($this->config->isDefinedLayer('ftp')) {
  750. PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
  751. $info = $this->installer->ftpInstall($param);
  752. PEAR::staticPopErrorHandling();
  753. if (PEAR::isError($info)) {
  754. $this->ui->outputData($info->getMessage());
  755. $this->ui->outputData("remote install failed: $label");
  756. } else {
  757. $this->ui->outputData("remote install ok: $label");
  758. }
  759. }
  760. }
  761. }
  762. $deps = $param->getDeps();
  763. if ($deps) {
  764. if (isset($deps['group'])) {
  765. $groups = $deps['group'];
  766. if (!isset($groups[0])) {
  767. $groups = array($groups);
  768. }
  769. foreach ($groups as $group) {
  770. if ($group['attribs']['name'] == 'default') {
  771. // default group is always installed, unless the user
  772. // explicitly chooses to install another group
  773. continue;
  774. }
  775. $extrainfo[] = $param->getPackage() . ': Optional feature ' .
  776. $group['attribs']['name'] . ' available (' .
  777. $group['attribs']['hint'] . ')';
  778. }
  779. $extrainfo[] = $param->getPackage() .
  780. ': To install optional features use "pear install ' .
  781. $reg->parsedPackageNameToString(
  782. array('package' => $param->getPackage(),
  783. 'channel' => $param->getChannel()), true) .
  784. '#featurename"';
  785. }
  786. }
  787. $pkg = &$instreg->getPackage($param->getPackage(), $param->getChannel());
  788. // $pkg may be NULL if install is a 'fake' install via --packagingroot
  789. if (is_object($pkg)) {
  790. $pkg->setConfig($this->config);
  791. if ($list = $pkg->listPostinstallScripts()) {
  792. $pn = $reg->parsedPackageNameToString(array('channel' =>
  793. $param->getChannel(), 'package' => $param->getPackage()), true);
  794. $extrainfo[] = $pn . ' has post-install scripts:';
  795. foreach ($list as $file) {
  796. $extrainfo[] = $file;
  797. }
  798. $extrainfo[] = $param->getPackage() .
  799. ': Use "pear run-scripts ' . $pn . '" to finish setup.';
  800. $extrainfo[] = 'DO NOT RUN SCRIPTS FROM UNTRUSTED SOURCES';
  801. }
  802. }
  803. }
  804. if (count($extrainfo)) {
  805. foreach ($extrainfo as $info) {
  806. $this->ui->outputData($info);
  807. }
  808. }
  809. return true;
  810. }
  811. // }}}
  812. // {{{ doUpgradeAll()
  813. function doUpgradeAll($command, $options, $params)
  814. {
  815. $reg = &$this->config->getRegistry();
  816. $upgrade = array();
  817. if (isset($options['channel'])) {
  818. $channels = array($options['channel']);
  819. } else {
  820. $channels = $reg->listChannels();
  821. }
  822. foreach ($channels as $channel) {
  823. if ($channel == '__uri') {
  824. continue;
  825. }
  826. // parse name with channel
  827. foreach ($reg->listPackages($channel) as $name) {
  828. $upgrade[] = $reg->parsedPackageNameToString(array(
  829. 'channel' => $channel,
  830. 'package' => $name
  831. ));
  832. }
  833. }
  834. $err = $this->doInstall($command, $options, $upgrade);
  835. if (PEAR::isError($err)) {
  836. $this->ui->outputData($err->getMessage(), $command);
  837. }
  838. }
  839. // }}}
  840. // {{{ doUninstall()
  841. function doUninstall($command, $options, $params)
  842. {
  843. if (count($params) < 1) {
  844. return $this->raiseError("Please supply the package(s) you want to uninstall");
  845. }
  846. if (empty($this->installer)) {
  847. $this->installer = &$this->getInstaller($this->ui);
  848. }
  849. if (isset($options['remoteconfig'])) {
  850. $e = $this->config->readFTPConfigFile($options['remoteconfig']);
  851. if (!PEAR::isError($e)) {
  852. $this->installer->setConfig($this->config);
  853. }
  854. }
  855. $reg = &$this->config->getRegistry();
  856. $newparams = array();
  857. $binaries = array();
  858. $badparams = array();
  859. foreach ($params as $pkg) {
  860. $channel = $this->config->get('default_channel');
  861. PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
  862. $parsed = $reg->parsePackageName($pkg, $channel);
  863. PEAR::staticPopErrorHandling();
  864. if (!$parsed || PEAR::isError($parsed)) {
  865. $badparams[] = $pkg;
  866. continue;
  867. }
  868. $package = $parsed['package'];
  869. $channel = $parsed['channel'];
  870. $info = &$reg->getPackage($package, $channel);
  871. if ($info === null &&
  872. ($channel == 'pear.php.net' || $channel == 'pecl.php.net')) {
  873. // make sure this isn't a package that has flipped from pear to pecl but
  874. // used a package.xml 1.0
  875. $testc = ($channel == 'pear.php.net') ? 'pecl.php.net' : 'pear.php.net';
  876. $info = &$reg->getPackage($package, $testc);
  877. if ($info !== null) {
  878. $channel = $testc;
  879. }
  880. }
  881. if ($info === null) {
  882. $badparams[] = $pkg;
  883. } else {
  884. $newparams[] = &$info;
  885. // check for binary packages (this is an alias for those packages if so)
  886. if ($installedbinary = $info->getInstalledBinary()) {
  887. $this->ui->log('adding binary package ' .
  888. $reg->parsedPackageNameToString(array('channel' => $channel,
  889. 'package' => $installedbinary), true));
  890. $newparams[] = &$reg->getPackage($installedbinary, $channel);
  891. }
  892. // add the contents of a dependency group to the list of installed packages
  893. if (isset($parsed['group'])) {
  894. $group = $info->getDependencyGroup($parsed['group']);
  895. if ($group) {
  896. $installed = $reg->getInstalledGroup($group);
  897. if ($installed) {
  898. foreach ($installed as $i => $p) {
  899. $newparams[] = &$installed[$i];
  900. }
  901. }
  902. }
  903. }
  904. }
  905. }
  906. $err = $this->installer->sortPackagesForUninstall($newparams);
  907. if (PEAR::isError($err)) {
  908. $this->ui->outputData($err->getMessage(), $command);
  909. return true;
  910. }
  911. $params = $newparams;
  912. // twist this to use it to check on whether dependent packages are also being uninstalled
  913. // for circular dependencies like subpackages
  914. $this->installer->setUninstallPackages($newparams);
  915. $params = array_merge($params, $badparams);
  916. $binaries = array();
  917. foreach ($params as $pkg) {
  918. $this->installer->pushErrorHandling(PEAR_ERROR_RETURN);
  919. if ($err = $this->installer->uninstall($pkg, $options)) {
  920. $this->installer->popErrorHandling();
  921. if (PEAR::isError($err)) {
  922. $this->ui->outputData($err->getMessage(), $command);
  923. continue;
  924. }
  925. if ($pkg->getPackageType() == 'extsrc' ||
  926. $pkg->getPackageType() == 'extbin' ||
  927. $pkg->getPackageType() == 'zendextsrc' ||
  928. $pkg->getPackageType() == 'zendextbin') {
  929. if ($instbin = $pkg->getInstalledBinary()) {
  930. continue; // this will be uninstalled later
  931. }
  932. foreach ($pkg->getFilelist() as $name => $atts) {
  933. $pinfo = pathinfo($atts['installed_as']);
  934. if (!isset($pinfo['extension']) ||
  935. in_array($pinfo['extension'], array('c', 'h'))) {
  936. continue; // make sure we don't match php_blah.h
  937. }
  938. if ((strpos($pinfo['basename'], 'php_') === 0 &&
  939. $pinfo['extension'] == 'dll') ||
  940. // most unices
  941. $pinfo['extension'] == 'so' ||
  942. // hp-ux
  943. $pinfo['extension'] == 'sl') {
  944. $binaries[] = array($atts['installed_as'], $pinfo);
  945. break;
  946. }
  947. }
  948. if (count($binaries)) {
  949. foreach ($binaries as $pinfo) {
  950. PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
  951. $ret = $this->disableExtension(array($pinfo[0]), $pkg->getPackageType());
  952. PEAR::staticPopErrorHandling();
  953. if (PEAR::isError($ret)) {
  954. $extrainfo[] = $ret->getMessage();
  955. if ($pkg->getPackageType() == 'extsrc' ||
  956. $pkg->getPackageType() == 'extbin') {
  957. $exttype = 'extension';
  958. } else {
  959. ob_start();
  960. phpinfo(INFO_GENERAL);
  961. $info = ob_get_contents();
  962. ob_end_clean();
  963. $debug = function_exists('leak') ? '_debug' : '';
  964. $ts = preg_match('/Thread Safety.+enabled/', $info) ? '_ts' : '';
  965. $exttype = 'zend_extension' . $debug . $ts;
  966. }
  967. $this->ui->outputData('Unable to remove "' . $exttype . '=' .
  968. $pinfo[1]['basename'] . '" from php.ini', $command);
  969. } else {
  970. $this->ui->outputData('Extension ' . $pkg->getProvidesExtension() .
  971. ' disabled in php.ini', $command);
  972. }
  973. }
  974. }
  975. }
  976. $savepkg = $pkg;
  977. if ($this->config->get('verbose') > 0) {
  978. if (is_object($pkg)) {
  979. $pkg = $reg->parsedPackageNameToString($pkg);
  980. }
  981. $this->ui->outputData("uninstall ok: $pkg", $command);
  982. }
  983. if (!isset($options['offline']) && is_object($savepkg) &&
  984. defined('PEAR_REMOTEINSTALL_OK')) {
  985. if ($this->config->isDefinedLayer('ftp')) {
  986. $this->installer->pushErrorHandling(PEAR_ERROR_RETURN);
  987. $info = $this->installer->ftpUninstall($savepkg);
  988. $this->installer->popErrorHandling();
  989. if (PEAR::isError($info)) {
  990. $this->ui->outputData($info->getMessage());
  991. $this->ui->outputData("remote uninstall failed: $pkg");
  992. } else {
  993. $this->ui->outputData("remote uninstall ok: $pkg");
  994. }
  995. }
  996. }
  997. } else {
  998. $this->installer->popErrorHandling();
  999. if (!is_object($pkg)) {
  1000. return $this->raiseError("uninstall failed: $pkg");
  1001. }
  1002. $pkg = $reg->parsedPackageNameToString($pkg);
  1003. }
  1004. }
  1005. return true;
  1006. }
  1007. // }}}
  1008. // }}}
  1009. // {{{ doBundle()
  1010. /*
  1011. (cox) It just downloads and untars the package, does not do
  1012. any check that the PEAR_Installer::_installFile() does.
  1013. */
  1014. function doBundle($command, $options, $params)
  1015. {
  1016. $opts = array(
  1017. 'force' => true,
  1018. 'nodeps' => true,
  1019. 'soft' => true,
  1020. 'downloadonly' => true
  1021. );
  1022. $downloader = &$this->getDownloader($this->ui, $opts, $this->config);
  1023. $reg = &$this->config->getRegistry();
  1024. if (count($params) < 1) {
  1025. return $this->raiseError("Please supply the package you want to bundle");
  1026. }
  1027. if (isset($options['destination'])) {
  1028. if (!is_dir($options['destination'])) {
  1029. System::mkdir('-p ' . $options['destination']);
  1030. }
  1031. $dest = realpath($options['destination']);
  1032. } else {
  1033. $pwd = getcwd();
  1034. $dir = $pwd . DIRECTORY_SEPARATOR . 'ext';
  1035. $dest = is_dir($dir) ? $dir : $pwd;
  1036. }
  1037. PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
  1038. $err = $downloader->setDownloadDir($dest);
  1039. PEAR::staticPopErrorHandling();
  1040. if (PEAR::isError($err)) {
  1041. return PEAR::raiseError('download directory "' . $dest .
  1042. '" is not writeable.');
  1043. }
  1044. $result = &$downloader->download(array($params[0]));
  1045. if (PEAR::isError($result)) {
  1046. return $result;
  1047. }
  1048. if (!isset($result[0])) {
  1049. return $this->raiseError('unable to unpack ' . $params[0]);
  1050. }
  1051. $pkgfile = &$result[0]->getPackageFile();
  1052. $pkgname = $pkgfile->getName();
  1053. $pkgversion = $pkgfile->getVersion();
  1054. // Unpacking -------------------------------------------------
  1055. $dest .= DIRECTORY_SEPARATOR . $pkgname;
  1056. $orig = $pkgname . '-' . $pkgversion;
  1057. $tar = &new Archive_Tar($pkgfile->getArchiveFile());
  1058. if (!$tar->extractModify($dest, $orig)) {
  1059. return $this->raiseError('unable to unpack ' . $pkgfile->getArchiveFile());
  1060. }
  1061. $this->ui->outputData("Package ready at '$dest'");
  1062. // }}}
  1063. }
  1064. // }}}
  1065. function doRunScripts($command, $options, $params)
  1066. {
  1067. if (!isset($params[0])) {
  1068. return $this->raiseError('run-scripts expects 1 parameter: a package name');
  1069. }
  1070. $reg = &$this->config->getRegistry();
  1071. PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
  1072. $parsed = $reg->parsePackageName($params[0], $this->config->get('default_channel'));
  1073. PEAR::staticPopErrorHandling();
  1074. if (PEAR::isError($parsed)) {
  1075. return $this->raiseError($parsed);
  1076. }
  1077. $package = &$reg->getPackage($parsed['package'], $parsed['channel']);
  1078. if (!is_object($package)) {
  1079. return $this->raiseError('Could not retrieve package "' . $params[0] . '" from registry');
  1080. }
  1081. $package->setConfig($this->config);
  1082. $package->runPostinstallScripts();
  1083. $this->ui->outputData('Install scripts complete', $command);
  1084. return true;
  1085. }
  1086. /**
  1087. * Given a list of packages, filter out those ones that are already up to date
  1088. *
  1089. * @param $packages: packages, in parsed array format !
  1090. * @return list of packages that can be upgraded
  1091. */
  1092. function _filterUptodatePackages($packages, $command)
  1093. {
  1094. $reg = &$this->config->getRegistry();
  1095. $latestReleases = array();
  1096. $ret = array();
  1097. foreach ($packages as $package) {
  1098. if (isset($package['group'])) {
  1099. $ret[] = $package;
  1100. continue;
  1101. }
  1102. $channel = $package['channel'];
  1103. $name = $package['package'];
  1104. if (!$reg->packageExists($name, $channel)) {
  1105. $ret[] = $package;
  1106. continue;
  1107. }
  1108. if (!isset($latestReleases[$channel])) {
  1109. // fill in cache for this channel
  1110. $chan = &$reg->getChannel($channel);
  1111. if (PEAR::isError($chan)) {
  1112. return $this->raiseError($chan);
  1113. }
  1114. $base2 = false;
  1115. $preferred_mirror = $this->config->get('preferred_mirror', null, $channel);
  1116. if ($chan->supportsREST($preferred_mirror) &&
  1117. (
  1118. //($base2 = $chan->getBaseURL('REST1.4', $preferred_mirror)) ||
  1119. ($base = $chan->getBaseURL('REST1.0', $preferred_mirror))
  1120. )
  1121. ) {
  1122. $dorest = true;
  1123. }
  1124. PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
  1125. if (!isset($package['state'])) {
  1126. $state = $this->config->get('preferred_state', null, $channel);
  1127. } else {
  1128. $state = $package['state'];
  1129. }
  1130. if ($dorest) {
  1131. if ($base2) {
  1132. $rest = &$this->config->getREST('1.4', array());
  1133. $base = $base2;
  1134. } else {
  1135. $rest = &$this->config->getREST('1.0', array());
  1136. }
  1137. $installed = array_flip($reg->listPackages($channel));
  1138. $latest = $rest->listLatestUpgrades($base, $state, $installed, $channel, $reg);
  1139. }
  1140. PEAR::staticPopErrorHandling();
  1141. if (PEAR::isError($latest)) {
  1142. $this->ui->outputData('Error getting channel info from ' . $channel .
  1143. ': ' . $latest->getMessage());
  1144. continue;
  1145. }
  1146. $latestReleases[$channel] = array_change_key_case($latest);
  1147. }
  1148. // check package for latest release
  1149. $name_lower = strtolower($name);
  1150. if (isset($latestReleases[$channel][$name_lower])) {
  1151. // if not set, up to date
  1152. $inst_version = $reg->packageInfo($name, 'version', $channel);
  1153. $channel_version = $latestReleases[$channel][$name_lower]['version'];
  1154. if (version_compare($channel_version, $inst_version, 'le')) {
  1155. // installed version is up-to-date
  1156. continue;
  1157. }
  1158. // maintain BC
  1159. if ($command == 'upgrade-all') {
  1160. $this->ui->outputData(array('data' => 'Will upgrade ' .
  1161. $reg->parsedPackageNameToString($package)), $command);
  1162. }
  1163. $ret[] = $package;
  1164. }
  1165. }
  1166. return $ret;
  1167. }
  1168. }