/** * save rest.release2 release REST * * @param \Pyrus\Package $new package to be saved * @param string $releaser releasing maintainer's handle * * @return void */ function saveInfo2(\Pyrus\Package $new, $releaser) { $xml = $this->_getProlog('r', 'release2'); $xml['r']['p'] = array('attribs' => array('xlink:href' => $this->getPackageRESTLink(strtolower($new->name))), '_content' => $new->name); $xml['r']['c'] = $this->channel->name; $categories = new Categories($this->channel); $category = $categories->getPackageCategory($new->name); $xml['r']['v'] = $new->version['release']; $xml['r']['a'] = $new->version['api']; $xml['r']['mp'] = $new->dependencies['required']->php->min; $xml['r']['st'] = $new->stability['release']; $xml['r']['l'] = $new->license['name']; $xml['r']['m'] = $releaser; $xml['r']['s'] = $new->summary; $xml['r']['d'] = $new->description; $xml['r']['da'] = $new->date . ' ' . $new->time; $xml['r']['n'] = $new->notes; $xml['r']['f'] = filesize($new->archivefile); $xml['r']['g'] = 'http://' . $this->channel->name . '/get/' . $new->name . '-' . $new->version['release']; $xml['r']['x'] = array('attribs' => array('xlink:href' => 'package.' . $new->version['release'] . '.xml')); $this->saveReleaseREST(strtolower($new->name) . '/v2.' . $new->version['release'] . '.xml', $xml); }
/** * Save package REST based on a release * * @param \Pyrus\Package $new */ function saveInfo(\Pyrus\Package $new) { $reader = new \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->name; $categories = new Categories($this->channel); $category = $categories->getPackageCategory($new->name); $xml['ca'] = array('attribs' => array('xlink:href' => $this->getCategoryRESTLink(urlencode($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); }