PEAR logo

PEAR_PackageFileManager : The Definitive Guide



Remove a user on maintainers list

If you think this function is useless, you may consider that the package script generator could use data coming from another source (such as a database, a flat file, ...) rather than just hard-coded.

[Important] Important
This feature is only available for PEAR_PackageFileManager 1.6.0 or better. To do the same thing, by programming, with package.xml version 1.0, you should set options with an empty "maintainers" array first, before apply the addMaintainer() method.

To produce a package.xml version 1.0

  1. <?php
  2. require_once 'PEAR/PackageFileManager.php';
  3. require_once 'MDB2.php';
  4.  
  5. PEAR::setErrorHandling(PEAR_ERROR_DIE);
  6.  
  7. // ...
  8.  
  9. $p1 = new PEAR_PackageFileManager();
  10. $p1->setOptions(array(
  11.     'maintainers' => array(),
  12.     // any other option ...
  13. ));
  14. //...
  15. $res =& $mdb2->query('SELECT * FROM maintainers');
  16.  
  17. while (($m = $res->fetchRow())) {
  18.  
  19.     if ($m->active) {
  20.         $p1->addMaintainer($m->handle, $m->role, $m->name, $m->email);
  21.     }
  22. }
  23. ?>

To produce a package.xml version 2.0

  1. <?php
  2. require_once 'PEAR/PackageFileManager2.php';
  3. require_once 'MDB2.php';
  4.  
  5. PEAR::setErrorHandling(PEAR_ERROR_DIE);
  6.  
  7. // ...
  8.  
  9. $packagefile = 'c:/php/pear/HTML_AJAX/package2.xml';
  10. // $options = array();
  11.  
  12. $p2 = &PEAR_PackageFileManager2::importOptions($packagefile, $options);
  13. //...
  14. $res =& $mdb2->query('SELECT * FROM maintainers');
  15.  
  16. while (($m = $res->fetchRow())) {
  17.  
  18.     if ($m->exists) {
  19.         $p2->addMaintainer($m->role, $m->handle, $m->name, $m->email, $m->active);
  20.     } else {
  21.         $p2->deleteMaintainer($m->handle);
  22.     }
  23. }
  24. ?>
PEAR_PackageFileManager : The Definitive Guide v 1.6.0 : November 17, 2006