Exemplo n.º 1
0
 public function process()
 {
     if ($_SERVER['argc'] < 2) {
         $this->printUsage();
         return false;
     }
     switch ($_SERVER['argv'][1]) {
         case 'update':
             $this->handleUpdate();
             break;
         case 'create':
             return $this->handleCreate();
         case 'add-maintainer':
             $scs = new PEAR2_SimpleChannelServer($this->channel, $this->dir);
             // is this even needed?
             break;
         case 'add-category':
             PEAR2_SimpleChannelServer_Categories::create($category, $description);
             break;
         case 'release':
             $this->handleRelease();
             break;
         default:
             echo 'Please use one of the following commands:' . PHP_EOL;
             $this->printUsage();
             break;
     }
 }
Exemplo n.º 2
0
 /**
  * Save package REST based on a release
  * 
  * @param \PEAR2\Pyrus\Package $new
  */
 function saveInfo(\PEAR2\Pyrus\Package $new)
 {
     $reader = new \PEAR2\Pyrus\XMLParser;
     $deprecated = false;
     if (file_exists($this->rest . DIRECTORY_SEPARATOR . 'p' . DIRECTORY_SEPARATOR .
           'info.xml')) {
         $oldinfo = $reader->parse($this->rest . DIRECTORY_SEPARATOR . 'p' .
             DIRECTORY_SEPARATOR . 'info.xml');
         if (isset($oldinfo['p']['dp'])) {
             $deprecated = array('dp' => $oldinfo['p']['dp'], 'dc' => $oldinfo['p']['dc']);
         }
     }
     $xml = array();
     $xml['n'] = $new->name;
     $xml['c'] = $this->channel;
     try {
         $category = PEAR2_SimpleChannelServer_Categories::getPackageCategory($new->name);
     } catch (PEAR2_SimpleChannelServer_Categories_Exception $e) {
         $categories = PEAR2_SimpleChannelServer_Categories::create('Default', 'This is the default category');
         $categories->linkPackageToCategory($new->name,'Default');
         $category = PEAR2_SimpleChannelServer_Categories::getPackageCategory($new->name);
     }
     $xml['ca'] = array(
         'attribs' => array('xlink:href' => $this->getCategoryRESTLink($category)),
         '_content' => $category,
         );
     $xml['l'] = $new->license['name'];
     $xml['s'] = $new->summary;
     $xml['d'] = $new->description;
     $xml['r'] = array('attribs' => 
         $this->getReleaseRESTLink(strtolower($new->name)));
     if ($a = $new->extends) {
         $xml['pa'] = array('attribs' =>
             array('xlink:href' => $this->getPackageRESTLink(strtolower($a) . '/info.xml')),
             '_content' => $a);
     }
     $xmlinf = $this->_getProlog('p', 'package');
     $xml['attribs'] = $xmlinf['p']['attribs'];
     $xml = array('p' => $xml);
     $this->savePackageREST(strtolower($new->name) . '/info.xml', $xml);
 }
Exemplo n.º 3
0
 /**
  * Save information on a category
  * 
  * This is not release-dependent
  *
  * @param string $category The name of the category eg:Services
  * @param string $desc     Basic description for the category
  * @param string $alias    Optional alias category name
  * 
  * @return void
  */
 function saveInfo($category, $desc, $alias = false)
 {
     PEAR2_SimpleChannelServer_Categories::create($category, $desc, $alias);
     $xml           = $this->_getProlog('c', 'category');
     $xml['c']['n'] = $category;
     $xml['c']['a'] = $alias ? $category : $alias;
     $xml['c']['c'] = $this->channel;
     $xml['c']['d'] = $desc;
     $this->saveCategoryREST($category . '/info.xml', $xml);
 }