PageRenderTime 53ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/lib/php/PEAR/PackageFile/v2/rw.php

https://bitbucket.org/adarshj/convenient_website
PHP | 1604 lines | 1201 code | 70 blank | 333 comment | 227 complexity | 6cb5b523de08db7641d53fbd01161806 MD5 | raw file
Possible License(s): Apache-2.0, MPL-2.0-no-copyleft-exception, LGPL-2.1, BSD-2-Clause, GPL-2.0, LGPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /**
  3. * PEAR_PackageFile_v2, package.xml version 2.0, read/write version
  4. *
  5. * PHP versions 4 and 5
  6. *
  7. * @category pear
  8. * @package PEAR
  9. * @author Greg Beaver <cellog@php.net>
  10. * @copyright 1997-2009 The Authors
  11. * @license http://opensource.org/licenses/bsd-license.php New BSD License
  12. * @version CVS: $Id: rw.php 313023 2011-07-06 19:17:11Z dufuz $
  13. * @link http://pear.php.net/package/PEAR
  14. * @since File available since Release 1.4.0a8
  15. */
  16. /**
  17. * For base class
  18. */
  19. require_once 'PEAR/PackageFile/v2.php';
  20. /**
  21. * @category pear
  22. * @package PEAR
  23. * @author Greg Beaver <cellog@php.net>
  24. * @copyright 1997-2009 The Authors
  25. * @license http://opensource.org/licenses/bsd-license.php New BSD License
  26. * @version Release: 1.9.4
  27. * @link http://pear.php.net/package/PEAR
  28. * @since Class available since Release 1.4.0a8
  29. */
  30. class PEAR_PackageFile_v2_rw extends PEAR_PackageFile_v2
  31. {
  32. /**
  33. * @param string Extension name
  34. * @return bool success of operation
  35. */
  36. function setProvidesExtension($extension)
  37. {
  38. if (in_array($this->getPackageType(),
  39. array('extsrc', 'extbin', 'zendextsrc', 'zendextbin'))) {
  40. if (!isset($this->_packageInfo['providesextension'])) {
  41. // ensure that the channel tag is set up in the right location
  42. $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
  43. array('usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease',
  44. 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
  45. 'bundle', 'changelog'),
  46. $extension, 'providesextension');
  47. }
  48. $this->_packageInfo['providesextension'] = $extension;
  49. return true;
  50. }
  51. return false;
  52. }
  53. function setPackage($package)
  54. {
  55. $this->_isValid = 0;
  56. if (!isset($this->_packageInfo['attribs'])) {
  57. $this->_packageInfo = array_merge(array('attribs' => array(
  58. 'version' => '2.0',
  59. 'xmlns' => 'http://pear.php.net/dtd/package-2.0',
  60. 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0',
  61. 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
  62. 'xsi:schemaLocation' => 'http://pear.php.net/dtd/tasks-1.0
  63. http://pear.php.net/dtd/tasks-1.0.xsd
  64. http://pear.php.net/dtd/package-2.0
  65. http://pear.php.net/dtd/package-2.0.xsd',
  66. )), $this->_packageInfo);
  67. }
  68. if (!isset($this->_packageInfo['name'])) {
  69. return $this->_packageInfo = array_merge(array('name' => $package),
  70. $this->_packageInfo);
  71. }
  72. $this->_packageInfo['name'] = $package;
  73. }
  74. /**
  75. * set this as a package.xml version 2.1
  76. * @access private
  77. */
  78. function _setPackageVersion2_1()
  79. {
  80. $info = array(
  81. 'version' => '2.1',
  82. 'xmlns' => 'http://pear.php.net/dtd/package-2.1',
  83. 'xmlns:tasks' => 'http://pear.php.net/dtd/tasks-1.0',
  84. 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
  85. 'xsi:schemaLocation' => 'http://pear.php.net/dtd/tasks-1.0
  86. http://pear.php.net/dtd/tasks-1.0.xsd
  87. http://pear.php.net/dtd/package-2.1
  88. http://pear.php.net/dtd/package-2.1.xsd',
  89. );
  90. if (!isset($this->_packageInfo['attribs'])) {
  91. $this->_packageInfo = array_merge(array('attribs' => $info), $this->_packageInfo);
  92. } else {
  93. $this->_packageInfo['attribs'] = $info;
  94. }
  95. }
  96. function setUri($uri)
  97. {
  98. unset($this->_packageInfo['channel']);
  99. $this->_isValid = 0;
  100. if (!isset($this->_packageInfo['uri'])) {
  101. // ensure that the uri tag is set up in the right location
  102. $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
  103. array('extends', 'summary', 'description', 'lead',
  104. 'developer', 'contributor', 'helper', 'date', 'time', 'version',
  105. 'stability', 'license', 'notes', 'contents', 'compatible',
  106. 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
  107. 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
  108. 'extbinrelease', 'bundle', 'changelog'), $uri, 'uri');
  109. }
  110. $this->_packageInfo['uri'] = $uri;
  111. }
  112. function setChannel($channel)
  113. {
  114. unset($this->_packageInfo['uri']);
  115. $this->_isValid = 0;
  116. if (!isset($this->_packageInfo['channel'])) {
  117. // ensure that the channel tag is set up in the right location
  118. $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
  119. array('extends', 'summary', 'description', 'lead',
  120. 'developer', 'contributor', 'helper', 'date', 'time', 'version',
  121. 'stability', 'license', 'notes', 'contents', 'compatible',
  122. 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
  123. 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
  124. 'extbinrelease', 'bundle', 'changelog'), $channel, 'channel');
  125. }
  126. $this->_packageInfo['channel'] = $channel;
  127. }
  128. function setExtends($extends)
  129. {
  130. $this->_isValid = 0;
  131. if (!isset($this->_packageInfo['extends'])) {
  132. // ensure that the extends tag is set up in the right location
  133. $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
  134. array('summary', 'description', 'lead',
  135. 'developer', 'contributor', 'helper', 'date', 'time', 'version',
  136. 'stability', 'license', 'notes', 'contents', 'compatible',
  137. 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
  138. 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
  139. 'extbinrelease', 'bundle', 'changelog'), $extends, 'extends');
  140. }
  141. $this->_packageInfo['extends'] = $extends;
  142. }
  143. function setSummary($summary)
  144. {
  145. $this->_isValid = 0;
  146. if (!isset($this->_packageInfo['summary'])) {
  147. // ensure that the summary tag is set up in the right location
  148. $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
  149. array('description', 'lead',
  150. 'developer', 'contributor', 'helper', 'date', 'time', 'version',
  151. 'stability', 'license', 'notes', 'contents', 'compatible',
  152. 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
  153. 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
  154. 'extbinrelease', 'bundle', 'changelog'), $summary, 'summary');
  155. }
  156. $this->_packageInfo['summary'] = $summary;
  157. }
  158. function setDescription($desc)
  159. {
  160. $this->_isValid = 0;
  161. if (!isset($this->_packageInfo['description'])) {
  162. // ensure that the description tag is set up in the right location
  163. $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
  164. array('lead',
  165. 'developer', 'contributor', 'helper', 'date', 'time', 'version',
  166. 'stability', 'license', 'notes', 'contents', 'compatible',
  167. 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
  168. 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
  169. 'extbinrelease', 'bundle', 'changelog'), $desc, 'description');
  170. }
  171. $this->_packageInfo['description'] = $desc;
  172. }
  173. /**
  174. * Adds a new maintainer - no checking of duplicates is performed, use
  175. * updatemaintainer for that purpose.
  176. */
  177. function addMaintainer($role, $handle, $name, $email, $active = 'yes')
  178. {
  179. if (!in_array($role, array('lead', 'developer', 'contributor', 'helper'))) {
  180. return false;
  181. }
  182. if (isset($this->_packageInfo[$role])) {
  183. if (!isset($this->_packageInfo[$role][0])) {
  184. $this->_packageInfo[$role] = array($this->_packageInfo[$role]);
  185. }
  186. $this->_packageInfo[$role][] =
  187. array(
  188. 'name' => $name,
  189. 'user' => $handle,
  190. 'email' => $email,
  191. 'active' => $active,
  192. );
  193. } else {
  194. $testarr = array('lead',
  195. 'developer', 'contributor', 'helper', 'date', 'time', 'version',
  196. 'stability', 'license', 'notes', 'contents', 'compatible',
  197. 'dependencies', 'providesextension', 'usesrole', 'usestask',
  198. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',
  199. 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog');
  200. foreach (array('lead', 'developer', 'contributor', 'helper') as $testrole) {
  201. array_shift($testarr);
  202. if ($role == $testrole) {
  203. break;
  204. }
  205. }
  206. if (!isset($this->_packageInfo[$role])) {
  207. // ensure that the extends tag is set up in the right location
  208. $this->_packageInfo = $this->_insertBefore($this->_packageInfo, $testarr,
  209. array(), $role);
  210. }
  211. $this->_packageInfo[$role] =
  212. array(
  213. 'name' => $name,
  214. 'user' => $handle,
  215. 'email' => $email,
  216. 'active' => $active,
  217. );
  218. }
  219. $this->_isValid = 0;
  220. }
  221. function updateMaintainer($newrole, $handle, $name, $email, $active = 'yes')
  222. {
  223. $found = false;
  224. foreach (array('lead', 'developer', 'contributor', 'helper') as $role) {
  225. if (!isset($this->_packageInfo[$role])) {
  226. continue;
  227. }
  228. $info = $this->_packageInfo[$role];
  229. if (!isset($info[0])) {
  230. if ($info['user'] == $handle) {
  231. $found = true;
  232. break;
  233. }
  234. }
  235. foreach ($info as $i => $maintainer) {
  236. if ($maintainer['user'] == $handle) {
  237. $found = $i;
  238. break 2;
  239. }
  240. }
  241. }
  242. if ($found === false) {
  243. return $this->addMaintainer($newrole, $handle, $name, $email, $active);
  244. }
  245. if ($found !== false) {
  246. if ($found === true) {
  247. unset($this->_packageInfo[$role]);
  248. } else {
  249. unset($this->_packageInfo[$role][$found]);
  250. $this->_packageInfo[$role] = array_values($this->_packageInfo[$role]);
  251. }
  252. }
  253. $this->addMaintainer($newrole, $handle, $name, $email, $active);
  254. $this->_isValid = 0;
  255. }
  256. function deleteMaintainer($handle)
  257. {
  258. $found = false;
  259. foreach (array('lead', 'developer', 'contributor', 'helper') as $role) {
  260. if (!isset($this->_packageInfo[$role])) {
  261. continue;
  262. }
  263. if (!isset($this->_packageInfo[$role][0])) {
  264. $this->_packageInfo[$role] = array($this->_packageInfo[$role]);
  265. }
  266. foreach ($this->_packageInfo[$role] as $i => $maintainer) {
  267. if ($maintainer['user'] == $handle) {
  268. $found = $i;
  269. break;
  270. }
  271. }
  272. if ($found !== false) {
  273. unset($this->_packageInfo[$role][$found]);
  274. if (!count($this->_packageInfo[$role]) && $role == 'lead') {
  275. $this->_isValid = 0;
  276. }
  277. if (!count($this->_packageInfo[$role])) {
  278. unset($this->_packageInfo[$role]);
  279. return true;
  280. }
  281. $this->_packageInfo[$role] =
  282. array_values($this->_packageInfo[$role]);
  283. if (count($this->_packageInfo[$role]) == 1) {
  284. $this->_packageInfo[$role] = $this->_packageInfo[$role][0];
  285. }
  286. return true;
  287. }
  288. if (count($this->_packageInfo[$role]) == 1) {
  289. $this->_packageInfo[$role] = $this->_packageInfo[$role][0];
  290. }
  291. }
  292. return false;
  293. }
  294. function setReleaseVersion($version)
  295. {
  296. if (isset($this->_packageInfo['version']) &&
  297. isset($this->_packageInfo['version']['release'])) {
  298. unset($this->_packageInfo['version']['release']);
  299. }
  300. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $version, array(
  301. 'version' => array('stability', 'license', 'notes', 'contents', 'compatible',
  302. 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
  303. 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
  304. 'extbinrelease', 'bundle', 'changelog'),
  305. 'release' => array('api')));
  306. $this->_isValid = 0;
  307. }
  308. function setAPIVersion($version)
  309. {
  310. if (isset($this->_packageInfo['version']) &&
  311. isset($this->_packageInfo['version']['api'])) {
  312. unset($this->_packageInfo['version']['api']);
  313. }
  314. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $version, array(
  315. 'version' => array('stability', 'license', 'notes', 'contents', 'compatible',
  316. 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
  317. 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
  318. 'extbinrelease', 'bundle', 'changelog'),
  319. 'api' => array()));
  320. $this->_isValid = 0;
  321. }
  322. /**
  323. * snapshot|devel|alpha|beta|stable
  324. */
  325. function setReleaseStability($state)
  326. {
  327. if (isset($this->_packageInfo['stability']) &&
  328. isset($this->_packageInfo['stability']['release'])) {
  329. unset($this->_packageInfo['stability']['release']);
  330. }
  331. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $state, array(
  332. 'stability' => array('license', 'notes', 'contents', 'compatible',
  333. 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
  334. 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
  335. 'extbinrelease', 'bundle', 'changelog'),
  336. 'release' => array('api')));
  337. $this->_isValid = 0;
  338. }
  339. /**
  340. * @param devel|alpha|beta|stable
  341. */
  342. function setAPIStability($state)
  343. {
  344. if (isset($this->_packageInfo['stability']) &&
  345. isset($this->_packageInfo['stability']['api'])) {
  346. unset($this->_packageInfo['stability']['api']);
  347. }
  348. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $state, array(
  349. 'stability' => array('license', 'notes', 'contents', 'compatible',
  350. 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
  351. 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
  352. 'extbinrelease', 'bundle', 'changelog'),
  353. 'api' => array()));
  354. $this->_isValid = 0;
  355. }
  356. function setLicense($license, $uri = false, $filesource = false)
  357. {
  358. if (!isset($this->_packageInfo['license'])) {
  359. // ensure that the license tag is set up in the right location
  360. $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
  361. array('notes', 'contents', 'compatible',
  362. 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
  363. 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
  364. 'extbinrelease', 'bundle', 'changelog'), 0, 'license');
  365. }
  366. if ($uri || $filesource) {
  367. $attribs = array();
  368. if ($uri) {
  369. $attribs['uri'] = $uri;
  370. }
  371. $uri = true; // for test below
  372. if ($filesource) {
  373. $attribs['filesource'] = $filesource;
  374. }
  375. }
  376. $license = $uri ? array('attribs' => $attribs, '_content' => $license) : $license;
  377. $this->_packageInfo['license'] = $license;
  378. $this->_isValid = 0;
  379. }
  380. function setNotes($notes)
  381. {
  382. $this->_isValid = 0;
  383. if (!isset($this->_packageInfo['notes'])) {
  384. // ensure that the notes tag is set up in the right location
  385. $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
  386. array('contents', 'compatible',
  387. 'dependencies', 'providesextension', 'usesrole', 'usestask', 'srcpackage', 'srcuri',
  388. 'phprelease', 'extsrcrelease', 'zendextsrcrelease', 'zendextbinrelease',
  389. 'extbinrelease', 'bundle', 'changelog'), $notes, 'notes');
  390. }
  391. $this->_packageInfo['notes'] = $notes;
  392. }
  393. /**
  394. * This is only used at install-time, after all serialization
  395. * is over.
  396. * @param string file name
  397. * @param string installed path
  398. */
  399. function setInstalledAs($file, $path)
  400. {
  401. if ($path) {
  402. return $this->_packageInfo['filelist'][$file]['installed_as'] = $path;
  403. }
  404. unset($this->_packageInfo['filelist'][$file]['installed_as']);
  405. }
  406. /**
  407. * This is only used at install-time, after all serialization
  408. * is over.
  409. */
  410. function installedFile($file, $atts)
  411. {
  412. if (isset($this->_packageInfo['filelist'][$file])) {
  413. $this->_packageInfo['filelist'][$file] =
  414. array_merge($this->_packageInfo['filelist'][$file], $atts['attribs']);
  415. } else {
  416. $this->_packageInfo['filelist'][$file] = $atts['attribs'];
  417. }
  418. }
  419. /**
  420. * Reset the listing of package contents
  421. * @param string base installation dir for the whole package, if any
  422. */
  423. function clearContents($baseinstall = false)
  424. {
  425. $this->_filesValid = false;
  426. $this->_isValid = 0;
  427. if (!isset($this->_packageInfo['contents'])) {
  428. $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
  429. array('compatible',
  430. 'dependencies', 'providesextension', 'usesrole', 'usestask',
  431. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',
  432. 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
  433. 'bundle', 'changelog'), array(), 'contents');
  434. }
  435. if ($this->getPackageType() != 'bundle') {
  436. $this->_packageInfo['contents'] =
  437. array('dir' => array('attribs' => array('name' => '/')));
  438. if ($baseinstall) {
  439. $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'] = $baseinstall;
  440. }
  441. } else {
  442. $this->_packageInfo['contents'] = array('bundledpackage' => array());
  443. }
  444. }
  445. /**
  446. * @param string relative path of the bundled package.
  447. */
  448. function addBundledPackage($path)
  449. {
  450. if ($this->getPackageType() != 'bundle') {
  451. return false;
  452. }
  453. $this->_filesValid = false;
  454. $this->_isValid = 0;
  455. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $path, array(
  456. 'contents' => array('compatible', 'dependencies', 'providesextension',
  457. 'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease',
  458. 'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
  459. 'bundle', 'changelog'),
  460. 'bundledpackage' => array()));
  461. }
  462. /**
  463. * @param string file name
  464. * @param PEAR_Task_Common a read/write task
  465. */
  466. function addTaskToFile($filename, $task)
  467. {
  468. if (!method_exists($task, 'getXml')) {
  469. return false;
  470. }
  471. if (!method_exists($task, 'getName')) {
  472. return false;
  473. }
  474. if (!method_exists($task, 'validate')) {
  475. return false;
  476. }
  477. if (!$task->validate()) {
  478. return false;
  479. }
  480. if (!isset($this->_packageInfo['contents']['dir']['file'])) {
  481. return false;
  482. }
  483. $this->getTasksNs(); // discover the tasks namespace if not done already
  484. $files = $this->_packageInfo['contents']['dir']['file'];
  485. if (!isset($files[0])) {
  486. $files = array($files);
  487. $ind = false;
  488. } else {
  489. $ind = true;
  490. }
  491. foreach ($files as $i => $file) {
  492. if (isset($file['attribs'])) {
  493. if ($file['attribs']['name'] == $filename) {
  494. if ($ind) {
  495. $t = isset($this->_packageInfo['contents']['dir']['file'][$i]
  496. ['attribs'][$this->_tasksNs .
  497. ':' . $task->getName()]) ?
  498. $this->_packageInfo['contents']['dir']['file'][$i]
  499. ['attribs'][$this->_tasksNs .
  500. ':' . $task->getName()] : false;
  501. if ($t && !isset($t[0])) {
  502. $this->_packageInfo['contents']['dir']['file'][$i]
  503. [$this->_tasksNs . ':' . $task->getName()] = array($t);
  504. }
  505. $this->_packageInfo['contents']['dir']['file'][$i][$this->_tasksNs .
  506. ':' . $task->getName()][] = $task->getXml();
  507. } else {
  508. $t = isset($this->_packageInfo['contents']['dir']['file']
  509. ['attribs'][$this->_tasksNs .
  510. ':' . $task->getName()]) ? $this->_packageInfo['contents']['dir']['file']
  511. ['attribs'][$this->_tasksNs .
  512. ':' . $task->getName()] : false;
  513. if ($t && !isset($t[0])) {
  514. $this->_packageInfo['contents']['dir']['file']
  515. [$this->_tasksNs . ':' . $task->getName()] = array($t);
  516. }
  517. $this->_packageInfo['contents']['dir']['file'][$this->_tasksNs .
  518. ':' . $task->getName()][] = $task->getXml();
  519. }
  520. return true;
  521. }
  522. }
  523. }
  524. return false;
  525. }
  526. /**
  527. * @param string path to the file
  528. * @param string filename
  529. * @param array extra attributes
  530. */
  531. function addFile($dir, $file, $attrs)
  532. {
  533. if ($this->getPackageType() == 'bundle') {
  534. return false;
  535. }
  536. $this->_filesValid = false;
  537. $this->_isValid = 0;
  538. $dir = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $dir);
  539. if ($dir == '/' || $dir == '') {
  540. $dir = '';
  541. } else {
  542. $dir .= '/';
  543. }
  544. $attrs['name'] = $dir . $file;
  545. if (!isset($this->_packageInfo['contents'])) {
  546. // ensure that the contents tag is set up
  547. $this->_packageInfo = $this->_insertBefore($this->_packageInfo,
  548. array('compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask',
  549. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',
  550. 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',
  551. 'bundle', 'changelog'), array(), 'contents');
  552. }
  553. if (isset($this->_packageInfo['contents']['dir']['file'])) {
  554. if (!isset($this->_packageInfo['contents']['dir']['file'][0])) {
  555. $this->_packageInfo['contents']['dir']['file'] =
  556. array($this->_packageInfo['contents']['dir']['file']);
  557. }
  558. $this->_packageInfo['contents']['dir']['file'][]['attribs'] = $attrs;
  559. } else {
  560. $this->_packageInfo['contents']['dir']['file']['attribs'] = $attrs;
  561. }
  562. }
  563. /**
  564. * @param string Dependent package name
  565. * @param string Dependent package's channel name
  566. * @param string minimum version of specified package that this release is guaranteed to be
  567. * compatible with
  568. * @param string maximum version of specified package that this release is guaranteed to be
  569. * compatible with
  570. * @param string versions of specified package that this release is not compatible with
  571. */
  572. function addCompatiblePackage($name, $channel, $min, $max, $exclude = false)
  573. {
  574. $this->_isValid = 0;
  575. $set = array(
  576. 'name' => $name,
  577. 'channel' => $channel,
  578. 'min' => $min,
  579. 'max' => $max,
  580. );
  581. if ($exclude) {
  582. $set['exclude'] = $exclude;
  583. }
  584. $this->_isValid = 0;
  585. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(
  586. 'compatible' => array('dependencies', 'providesextension', 'usesrole', 'usestask',
  587. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  588. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')
  589. ));
  590. }
  591. /**
  592. * Removes the <usesrole> tag entirely
  593. */
  594. function resetUsesrole()
  595. {
  596. if (isset($this->_packageInfo['usesrole'])) {
  597. unset($this->_packageInfo['usesrole']);
  598. }
  599. }
  600. /**
  601. * @param string
  602. * @param string package name or uri
  603. * @param string channel name if non-uri
  604. */
  605. function addUsesrole($role, $packageOrUri, $channel = false) {
  606. $set = array('role' => $role);
  607. if ($channel) {
  608. $set['package'] = $packageOrUri;
  609. $set['channel'] = $channel;
  610. } else {
  611. $set['uri'] = $packageOrUri;
  612. }
  613. $this->_isValid = 0;
  614. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(
  615. 'usesrole' => array('usestask', 'srcpackage', 'srcuri',
  616. 'phprelease', 'extsrcrelease', 'extbinrelease',
  617. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')
  618. ));
  619. }
  620. /**
  621. * Removes the <usestask> tag entirely
  622. */
  623. function resetUsestask()
  624. {
  625. if (isset($this->_packageInfo['usestask'])) {
  626. unset($this->_packageInfo['usestask']);
  627. }
  628. }
  629. /**
  630. * @param string
  631. * @param string package name or uri
  632. * @param string channel name if non-uri
  633. */
  634. function addUsestask($task, $packageOrUri, $channel = false) {
  635. $set = array('task' => $task);
  636. if ($channel) {
  637. $set['package'] = $packageOrUri;
  638. $set['channel'] = $channel;
  639. } else {
  640. $set['uri'] = $packageOrUri;
  641. }
  642. $this->_isValid = 0;
  643. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(
  644. 'usestask' => array('srcpackage', 'srcuri',
  645. 'phprelease', 'extsrcrelease', 'extbinrelease',
  646. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')
  647. ));
  648. }
  649. /**
  650. * Remove all compatible tags
  651. */
  652. function clearCompatible()
  653. {
  654. unset($this->_packageInfo['compatible']);
  655. }
  656. /**
  657. * Reset dependencies prior to adding new ones
  658. */
  659. function clearDeps()
  660. {
  661. if (!isset($this->_packageInfo['dependencies'])) {
  662. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, array(),
  663. array(
  664. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  665. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  666. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog')));
  667. }
  668. $this->_packageInfo['dependencies'] = array();
  669. }
  670. /**
  671. * @param string minimum PHP version allowed
  672. * @param string maximum PHP version allowed
  673. * @param array $exclude incompatible PHP versions
  674. */
  675. function setPhpDep($min, $max = false, $exclude = false)
  676. {
  677. $this->_isValid = 0;
  678. $dep =
  679. array(
  680. 'min' => $min,
  681. );
  682. if ($max) {
  683. $dep['max'] = $max;
  684. }
  685. if ($exclude) {
  686. if (count($exclude) == 1) {
  687. $exclude = $exclude[0];
  688. }
  689. $dep['exclude'] = $exclude;
  690. }
  691. if (isset($this->_packageInfo['dependencies']['required']['php'])) {
  692. $this->_stack->push(__FUNCTION__, 'warning', array('dep' =>
  693. $this->_packageInfo['dependencies']['required']['php']),
  694. 'warning: PHP dependency already exists, overwriting');
  695. unset($this->_packageInfo['dependencies']['required']['php']);
  696. }
  697. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
  698. array(
  699. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  700. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  701. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
  702. 'required' => array('optional', 'group'),
  703. 'php' => array('pearinstaller', 'package', 'subpackage', 'extension', 'os', 'arch')
  704. ));
  705. return true;
  706. }
  707. /**
  708. * @param string minimum allowed PEAR installer version
  709. * @param string maximum allowed PEAR installer version
  710. * @param string recommended PEAR installer version
  711. * @param array incompatible version of the PEAR installer
  712. */
  713. function setPearinstallerDep($min, $max = false, $recommended = false, $exclude = false)
  714. {
  715. $this->_isValid = 0;
  716. $dep =
  717. array(
  718. 'min' => $min,
  719. );
  720. if ($max) {
  721. $dep['max'] = $max;
  722. }
  723. if ($recommended) {
  724. $dep['recommended'] = $recommended;
  725. }
  726. if ($exclude) {
  727. if (count($exclude) == 1) {
  728. $exclude = $exclude[0];
  729. }
  730. $dep['exclude'] = $exclude;
  731. }
  732. if (isset($this->_packageInfo['dependencies']['required']['pearinstaller'])) {
  733. $this->_stack->push(__FUNCTION__, 'warning', array('dep' =>
  734. $this->_packageInfo['dependencies']['required']['pearinstaller']),
  735. 'warning: PEAR Installer dependency already exists, overwriting');
  736. unset($this->_packageInfo['dependencies']['required']['pearinstaller']);
  737. }
  738. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
  739. array(
  740. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  741. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  742. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
  743. 'required' => array('optional', 'group'),
  744. 'pearinstaller' => array('package', 'subpackage', 'extension', 'os', 'arch')
  745. ));
  746. }
  747. /**
  748. * Mark a package as conflicting with this package
  749. * @param string package name
  750. * @param string package channel
  751. * @param string extension this package provides, if any
  752. * @param string|false minimum version required
  753. * @param string|false maximum version allowed
  754. * @param array|false versions to exclude from installation
  755. */
  756. function addConflictingPackageDepWithChannel($name, $channel,
  757. $providesextension = false, $min = false, $max = false, $exclude = false)
  758. {
  759. $this->_isValid = 0;
  760. $dep = $this->_constructDep($name, $channel, false, $min, $max, false,
  761. $exclude, $providesextension, false, true);
  762. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
  763. array(
  764. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  765. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  766. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
  767. 'required' => array('optional', 'group'),
  768. 'package' => array('subpackage', 'extension', 'os', 'arch')
  769. ));
  770. }
  771. /**
  772. * Mark a package as conflicting with this package
  773. * @param string package name
  774. * @param string package channel
  775. * @param string extension this package provides, if any
  776. */
  777. function addConflictingPackageDepWithUri($name, $uri, $providesextension = false)
  778. {
  779. $this->_isValid = 0;
  780. $dep =
  781. array(
  782. 'name' => $name,
  783. 'uri' => $uri,
  784. 'conflicts' => '',
  785. );
  786. if ($providesextension) {
  787. $dep['providesextension'] = $providesextension;
  788. }
  789. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
  790. array(
  791. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  792. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  793. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
  794. 'required' => array('optional', 'group'),
  795. 'package' => array('subpackage', 'extension', 'os', 'arch')
  796. ));
  797. }
  798. function addDependencyGroup($name, $hint)
  799. {
  800. $this->_isValid = 0;
  801. $this->_packageInfo = $this->_mergeTag($this->_packageInfo,
  802. array('attribs' => array('name' => $name, 'hint' => $hint)),
  803. array(
  804. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  805. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  806. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
  807. 'group' => array(),
  808. ));
  809. }
  810. /**
  811. * @param string package name
  812. * @param string|false channel name, false if this is a uri
  813. * @param string|false uri name, false if this is a channel
  814. * @param string|false minimum version required
  815. * @param string|false maximum version allowed
  816. * @param string|false recommended installation version
  817. * @param array|false versions to exclude from installation
  818. * @param string extension this package provides, if any
  819. * @param bool if true, tells the installer to ignore the default optional dependency group
  820. * when installing this package
  821. * @param bool if true, tells the installer to negate this dependency (conflicts)
  822. * @return array
  823. * @access private
  824. */
  825. function _constructDep($name, $channel, $uri, $min, $max, $recommended, $exclude,
  826. $providesextension = false, $nodefault = false,
  827. $conflicts = false)
  828. {
  829. $dep =
  830. array(
  831. 'name' => $name,
  832. );
  833. if ($channel) {
  834. $dep['channel'] = $channel;
  835. } elseif ($uri) {
  836. $dep['uri'] = $uri;
  837. }
  838. if ($min) {
  839. $dep['min'] = $min;
  840. }
  841. if ($max) {
  842. $dep['max'] = $max;
  843. }
  844. if ($recommended) {
  845. $dep['recommended'] = $recommended;
  846. }
  847. if ($exclude) {
  848. if (is_array($exclude) && count($exclude) == 1) {
  849. $exclude = $exclude[0];
  850. }
  851. $dep['exclude'] = $exclude;
  852. }
  853. if ($conflicts) {
  854. $dep['conflicts'] = '';
  855. }
  856. if ($nodefault) {
  857. $dep['nodefault'] = '';
  858. }
  859. if ($providesextension) {
  860. $dep['providesextension'] = $providesextension;
  861. }
  862. return $dep;
  863. }
  864. /**
  865. * @param package|subpackage
  866. * @param string group name
  867. * @param string package name
  868. * @param string package channel
  869. * @param string minimum version
  870. * @param string maximum version
  871. * @param string recommended version
  872. * @param array|false optional excluded versions
  873. * @param string extension this package provides, if any
  874. * @param bool if true, tells the installer to ignore the default optional dependency group
  875. * when installing this package
  876. * @return bool false if the dependency group has not been initialized with
  877. * {@link addDependencyGroup()}, or a subpackage is added with
  878. * a providesextension
  879. */
  880. function addGroupPackageDepWithChannel($type, $groupname, $name, $channel, $min = false,
  881. $max = false, $recommended = false, $exclude = false,
  882. $providesextension = false, $nodefault = false)
  883. {
  884. if ($type == 'subpackage' && $providesextension) {
  885. return false; // subpackages must be php packages
  886. }
  887. $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude,
  888. $providesextension, $nodefault);
  889. return $this->_addGroupDependency($type, $dep, $groupname);
  890. }
  891. /**
  892. * @param package|subpackage
  893. * @param string group name
  894. * @param string package name
  895. * @param string package uri
  896. * @param string extension this package provides, if any
  897. * @param bool if true, tells the installer to ignore the default optional dependency group
  898. * when installing this package
  899. * @return bool false if the dependency group has not been initialized with
  900. * {@link addDependencyGroup()}
  901. */
  902. function addGroupPackageDepWithURI($type, $groupname, $name, $uri, $providesextension = false,
  903. $nodefault = false)
  904. {
  905. if ($type == 'subpackage' && $providesextension) {
  906. return false; // subpackages must be php packages
  907. }
  908. $dep = $this->_constructDep($name, false, $uri, false, false, false, false,
  909. $providesextension, $nodefault);
  910. return $this->_addGroupDependency($type, $dep, $groupname);
  911. }
  912. /**
  913. * @param string group name (must be pre-existing)
  914. * @param string extension name
  915. * @param string minimum version allowed
  916. * @param string maximum version allowed
  917. * @param string recommended version
  918. * @param array incompatible versions
  919. */
  920. function addGroupExtensionDep($groupname, $name, $min = false, $max = false,
  921. $recommended = false, $exclude = false)
  922. {
  923. $this->_isValid = 0;
  924. $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude);
  925. return $this->_addGroupDependency('extension', $dep, $groupname);
  926. }
  927. /**
  928. * @param package|subpackage|extension
  929. * @param array dependency contents
  930. * @param string name of the dependency group to add this to
  931. * @return boolean
  932. * @access private
  933. */
  934. function _addGroupDependency($type, $dep, $groupname)
  935. {
  936. $arr = array('subpackage', 'extension');
  937. if ($type != 'package') {
  938. array_shift($arr);
  939. }
  940. if ($type == 'extension') {
  941. array_shift($arr);
  942. }
  943. if (!isset($this->_packageInfo['dependencies']['group'])) {
  944. return false;
  945. } else {
  946. if (!isset($this->_packageInfo['dependencies']['group'][0])) {
  947. if ($this->_packageInfo['dependencies']['group']['attribs']['name'] == $groupname) {
  948. $this->_packageInfo['dependencies']['group'] = $this->_mergeTag(
  949. $this->_packageInfo['dependencies']['group'], $dep,
  950. array(
  951. $type => $arr
  952. ));
  953. $this->_isValid = 0;
  954. return true;
  955. } else {
  956. return false;
  957. }
  958. } else {
  959. foreach ($this->_packageInfo['dependencies']['group'] as $i => $group) {
  960. if ($group['attribs']['name'] == $groupname) {
  961. $this->_packageInfo['dependencies']['group'][$i] = $this->_mergeTag(
  962. $this->_packageInfo['dependencies']['group'][$i], $dep,
  963. array(
  964. $type => $arr
  965. ));
  966. $this->_isValid = 0;
  967. return true;
  968. }
  969. }
  970. return false;
  971. }
  972. }
  973. }
  974. /**
  975. * @param optional|required
  976. * @param string package name
  977. * @param string package channel
  978. * @param string minimum version
  979. * @param string maximum version
  980. * @param string recommended version
  981. * @param string extension this package provides, if any
  982. * @param bool if true, tells the installer to ignore the default optional dependency group
  983. * when installing this package
  984. * @param array|false optional excluded versions
  985. */
  986. function addPackageDepWithChannel($type, $name, $channel, $min = false, $max = false,
  987. $recommended = false, $exclude = false,
  988. $providesextension = false, $nodefault = false)
  989. {
  990. if (!in_array($type, array('optional', 'required'), true)) {
  991. $type = 'required';
  992. }
  993. $this->_isValid = 0;
  994. $arr = array('optional', 'group');
  995. if ($type != 'required') {
  996. array_shift($arr);
  997. }
  998. $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude,
  999. $providesextension, $nodefault);
  1000. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
  1001. array(
  1002. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  1003. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  1004. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
  1005. $type => $arr,
  1006. 'package' => array('subpackage', 'extension', 'os', 'arch')
  1007. ));
  1008. }
  1009. /**
  1010. * @param optional|required
  1011. * @param string name of the package
  1012. * @param string uri of the package
  1013. * @param string extension this package provides, if any
  1014. * @param bool if true, tells the installer to ignore the default optional dependency group
  1015. * when installing this package
  1016. */
  1017. function addPackageDepWithUri($type, $name, $uri, $providesextension = false,
  1018. $nodefault = false)
  1019. {
  1020. $this->_isValid = 0;
  1021. $arr = array('optional', 'group');
  1022. if ($type != 'required') {
  1023. array_shift($arr);
  1024. }
  1025. $dep = $this->_constructDep($name, false, $uri, false, false, false, false,
  1026. $providesextension, $nodefault);
  1027. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
  1028. array(
  1029. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  1030. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  1031. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
  1032. $type => $arr,
  1033. 'package' => array('subpackage', 'extension', 'os', 'arch')
  1034. ));
  1035. }
  1036. /**
  1037. * @param optional|required optional, required
  1038. * @param string package name
  1039. * @param string package channel
  1040. * @param string minimum version
  1041. * @param string maximum version
  1042. * @param string recommended version
  1043. * @param array incompatible versions
  1044. * @param bool if true, tells the installer to ignore the default optional dependency group
  1045. * when installing this package
  1046. */
  1047. function addSubpackageDepWithChannel($type, $name, $channel, $min = false, $max = false,
  1048. $recommended = false, $exclude = false,
  1049. $nodefault = false)
  1050. {
  1051. $this->_isValid = 0;
  1052. $arr = array('optional', 'group');
  1053. if ($type != 'required') {
  1054. array_shift($arr);
  1055. }
  1056. $dep = $this->_constructDep($name, $channel, false, $min, $max, $recommended, $exclude,
  1057. $nodefault);
  1058. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
  1059. array(
  1060. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  1061. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  1062. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
  1063. $type => $arr,
  1064. 'subpackage' => array('extension', 'os', 'arch')
  1065. ));
  1066. }
  1067. /**
  1068. * @param optional|required optional, required
  1069. * @param string package name
  1070. * @param string package uri for download
  1071. * @param bool if true, tells the installer to ignore the default optional dependency group
  1072. * when installing this package
  1073. */
  1074. function addSubpackageDepWithUri($type, $name, $uri, $nodefault = false)
  1075. {
  1076. $this->_isValid = 0;
  1077. $arr = array('optional', 'group');
  1078. if ($type != 'required') {
  1079. array_shift($arr);
  1080. }
  1081. $dep = $this->_constructDep($name, false, $uri, false, false, false, false, $nodefault);
  1082. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
  1083. array(
  1084. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  1085. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  1086. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
  1087. $type => $arr,
  1088. 'subpackage' => array('extension', 'os', 'arch')
  1089. ));
  1090. }
  1091. /**
  1092. * @param optional|required optional, required
  1093. * @param string extension name
  1094. * @param string minimum version
  1095. * @param string maximum version
  1096. * @param string recommended version
  1097. * @param array incompatible versions
  1098. */
  1099. function addExtensionDep($type, $name, $min = false, $max = false, $recommended = false,
  1100. $exclude = false)
  1101. {
  1102. $this->_isValid = 0;
  1103. $arr = array('optional', 'group');
  1104. if ($type != 'required') {
  1105. array_shift($arr);
  1106. }
  1107. $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude);
  1108. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
  1109. array(
  1110. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  1111. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  1112. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
  1113. $type => $arr,
  1114. 'extension' => array('os', 'arch')
  1115. ));
  1116. }
  1117. /**
  1118. * @param string Operating system name
  1119. * @param boolean true if this package cannot be installed on this OS
  1120. */
  1121. function addOsDep($name, $conflicts = false)
  1122. {
  1123. $this->_isValid = 0;
  1124. $dep = array('name' => $name);
  1125. if ($conflicts) {
  1126. $dep['conflicts'] = '';
  1127. }
  1128. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
  1129. array(
  1130. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  1131. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  1132. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
  1133. 'required' => array('optional', 'group'),
  1134. 'os' => array('arch')
  1135. ));
  1136. }
  1137. /**
  1138. * @param string Architecture matching pattern
  1139. * @param boolean true if this package cannot be installed on this architecture
  1140. */
  1141. function addArchDep($pattern, $conflicts = false)
  1142. {
  1143. $this->_isValid = 0;
  1144. $dep = array('pattern' => $pattern);
  1145. if ($conflicts) {
  1146. $dep['conflicts'] = '';
  1147. }
  1148. $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,
  1149. array(
  1150. 'dependencies' => array('providesextension', 'usesrole', 'usestask',
  1151. 'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',
  1152. 'zendextsrcrelease', 'zendextbinrelease', 'bundle', 'changelog'),
  1153. 'required' => array('optional', 'group'),
  1154. 'arch' => array()
  1155. ));
  1156. }
  1157. /**
  1158. * Set the kind of package, and erase all release tags
  1159. *
  1160. * - a php package is a PEAR-style package
  1161. * - an extbin package is a PECL-style extension binary
  1162. * - an extsrc package is a PECL-style source for a binary
  1163. * - an zendextbin package is a PECL-style zend extension binary
  1164. * - an zendextsrc package is a PECL-style source for a zend extension binary
  1165. * - a bundle package is a collection of other pre-packaged packages
  1166. * @param php|extbin|extsrc|zendextsrc|zendextbin|bundle
  1167. * @return bool success
  1168. */
  1169. function setPackageType($type

Large files files are truncated, but you can click here to view the full file