Skip to content

Commit

Permalink
Use \Pyrus instead of \PEAR2\Pyrus as per latest Pyrus
Browse files Browse the repository at this point in the history
  • Loading branch information
helgi committed Jul 11, 2011
1 parent 36eabbf commit d00873a
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 59 deletions.
20 changes: 10 additions & 10 deletions src/PEAR2/SimpleChannelServer/CLI.php
Expand Up @@ -5,7 +5,7 @@ class CLI
/**
* Channel object
*
* @var \PEAR2\Pyrus\Channel
* @var \Pyrus\Channel
*/
protected $channel;

Expand Down Expand Up @@ -33,7 +33,7 @@ public function getSCS()
if (!file_exists($channel_file)) {
throw new Exception('No channel.xml file could be found! Create the channel, or change to the directory with the channel.xml.');
}
$this->channel = new \PEAR2\Pyrus\Channel(new \PEAR2\Pyrus\ChannelFile($channel_file));
$this->channel = new \Pyrus\Channel(new \Pyrus\ChannelFile($channel_file));
$this->scs = new Main($this->channel, $this->dir);
}
return $this->scs;
Expand Down Expand Up @@ -176,10 +176,10 @@ function pyrusUpdate($frontend, $args)
if (null === $frontend) {
$maintainer = $args;
} else {
$chan = \PEAR2\Pyrus\Config::current()->default_channel;
\PEAR2\Pyrus\Config::current()->default_channel = $this->channel->name;
$maintainer = \PEAR2\Pyrus\Config::current()->handle;
\PEAR2\Pyrus\Config::current()->default_channel = $chan;
$chan = \Pyrus\Config::current()->default_channel;
\Pyrus\Config::current()->default_channel = $this->channel->name;
$maintainer = \Pyrus\Config::current()->handle;
\Pyrus\Config::current()->default_channel = $chan;
}

$dirname = $this->dir . '/get/';
Expand Down Expand Up @@ -218,10 +218,10 @@ function pyrusRelease($frontend, $args)
{
$this->getSCS();
if (null !== $frontend) {
$chan = \PEAR2\Pyrus\Config::current()->default_channel;
\PEAR2\Pyrus\Config::current()->default_channel = $this->channel->name;
$args['maintainer'] = \PEAR2\Pyrus\Config::current()->handle;
\PEAR2\Pyrus\Config::current()->default_channel = $chan;
$chan = \Pyrus\Config::current()->default_channel;
\Pyrus\Config::current()->default_channel = $this->channel->name;
$args['maintainer'] = \Pyrus\Config::current()->handle;
\Pyrus\Config::current()->default_channel = $chan;
}
$this->scs->saveRelease($args['path'], $args['maintainer']);
echo 'Release successfully saved.'.PHP_EOL;
Expand Down
6 changes: 3 additions & 3 deletions src/PEAR2/SimpleChannelServer/Categories.php
Expand Up @@ -37,7 +37,7 @@ class Categories

protected $channel;

public function __construct(\PEAR2\Pyrus\Channel $channel)
public function __construct(\Pyrus\Channel $channel)
{
$this->channel = $channel;
$rest = preg_replace('/https?:\/\/' . str_replace('/','\/', $channel->name) . '/',
Expand All @@ -54,7 +54,7 @@ public function __construct(\PEAR2\Pyrus\Channel $channel)
if (!$fileinfo->isDot()
&& $fileinfo->isDir()
&& substr($fileinfo->getFilename(), 0, 1) != '.') {
$parser = new \PEAR2\Pyrus\XMLParser;
$parser = new \Pyrus\XMLParser;
try {
$content = file_get_contents($fileinfo->getPathname().'/info.xml');
$content = $parser->parseString($content);
Expand Down Expand Up @@ -162,7 +162,7 @@ public function packagesInCategory($category)
$packages = array();
$file = $this->_restDir.'c/'.urlencode($category).'/packages.xml';
if (file_exists($file)) {
$parser = new \PEAR2\Pyrus\XMLParser;
$parser = new \Pyrus\XMLParser;
try {
$content = file_get_contents($file);
$content = $parser->parseString($content);
Expand Down
2 changes: 1 addition & 1 deletion src/PEAR2/SimpleChannelServer/Channel.php
Expand Up @@ -9,7 +9,7 @@
* @link http://svn.php.net/viewvc/pear2/sandbox/SimpleChannelServer/
*/
namespace PEAR2\SimpleChannelServer;
class Channel extends \PEAR2\Pyrus\ChannelFile
class Channel extends \Pyrus\ChannelFile
{

function __construct($name, $summary, $suggestedalias = null, $restpath = 'rest/')
Expand Down
4 changes: 2 additions & 2 deletions src/PEAR2/SimpleChannelServer/Get.php
Expand Up @@ -21,7 +21,7 @@ function __construct($savepath, $pyruspath)
function saveRelease($new, $releaser)
{
$parts = pathinfo($new);
$cloner = new \PEAR2\Pyrus\Package\Cloner($new, $this->get);
$cloner = new \Pyrus\Package\Cloner($new, $this->get);
if (!file_exists($this->get.$parts['filename'].'.tar')) {
$cloner->toTar();
}
Expand All @@ -37,7 +37,7 @@ function saveRelease($new, $releaser)
return true;
}

function deleteRelease(\PEAR2\Pyrus\Package $release)
function deleteRelease(\Pyrus\Package $release)
{

}
Expand Down
6 changes: 3 additions & 3 deletions src/PEAR2/SimpleChannelServer/Main.php
Expand Up @@ -80,7 +80,7 @@ function __construct($channel, $webpath, $pyruspath = null)
$restpath);
$this->get = new Get($webpath.'/get', $pyruspath);
try {
$a = \PEAR2\Pyrus\Config::singleton($pyruspath);
$a = \Pyrus\Config::singleton($pyruspath);
} catch (Exception $e) {
throw new Exception('Cannot initialize Pyrus Config',
$e);
Expand All @@ -101,7 +101,7 @@ function categorize($package, $category)

function saveRelease($package, $releaser)
{
$rest = $this->rest->saveRelease(new \PEAR2\Pyrus\Package($package), $releaser);
$rest = $this->rest->saveRelease(new \Pyrus\Package($package), $releaser);
$get = $this->get->saveRelease($package, $releaser);
return $rest && $get;
}
Expand Down Expand Up @@ -199,7 +199,7 @@ function listMaintainers($package = null)
$e);
}
}
$reader = new \PEAR2\Pyrus\XMLParser;
$reader = new \Pyrus\XMLParser;
$path = $this->rest->getRESTPath('r', strtolower($package) . '/maintainers2.xml');
if (!file_exists($path)) {
return array();
Expand Down
10 changes: 5 additions & 5 deletions src/PEAR2/SimpleChannelServer/REST/Category.php
Expand Up @@ -30,11 +30,11 @@ function __construct($savepath, $channel, $serverpath = 'rest/', Categories $cat
/**
* Save a package release's REST-related information
*
* @param \PEAR2\Pyrus\Package $new Package to save category for
* @param \Pyrus\Package $new Package to save category for
*
* @return void
*/
function save(\PEAR2\Pyrus\Package $new)
function save(\Pyrus\Package $new)
{
$category = $this->_categories->getPackageCategory($new->name);
$this->savePackages($category);
Expand All @@ -45,11 +45,11 @@ function save(\PEAR2\Pyrus\Package $new)
/**
* Delete a package release's REST-related information
*
* @param \PEAR2\Pyrus\Package $new Package to rease rest info for
* @param \Pyrus\Package $new Package to rease rest info for
*
* @return void
*/
function erase(\PEAR2\Pyrus\Package $new)
function erase(\Pyrus\Package $new)
{
$category = $this->_categories->getPackageCategory($new->name);
$this->savePackagesInfo($category);
Expand Down Expand Up @@ -138,7 +138,7 @@ function savePackagesInfo($category)
$pdir = $this->rest . DIRECTORY_SEPARATOR . 'p';
$rdir = $this->rest . DIRECTORY_SEPARATOR . 'r';
$packages = $this->_categories->packagesInCategory($category);
$reader = new \PEAR2\Pyrus\XMLParser;
$reader = new \Pyrus\XMLParser;
clearstatcache();
$xml['pi'] = array();
foreach ($packages as $package) {
Expand Down
4 changes: 2 additions & 2 deletions src/PEAR2/SimpleChannelServer/REST/Maintainer.php
Expand Up @@ -12,7 +12,7 @@
use PEAR2\SimpleChannelServer\Exception;
class Maintainer extends Manager
{
function save(\PEAR2\Pyrus\Package $new)
function save(\Pyrus\Package $new)
{
foreach ($new->allmaintainers as $role => $maintainers) {
foreach ($maintainers as $dev) {
Expand Down Expand Up @@ -50,7 +50,7 @@ function saveInfo($handle, $name, $uri = false)
function getInfo($handle)
{
$path = $this->getRESTPath('m', strtolower($handle) . '/info.xml');
$reader = new \PEAR2\Pyrus\XMLParser;
$reader = new \Pyrus\XMLParser;
if (!file_exists($path)) {
return false;
}
Expand Down
10 changes: 5 additions & 5 deletions src/PEAR2/SimpleChannelServer/REST/Manager.php
Expand Up @@ -53,10 +53,10 @@ function __construct($savepath, $channel, $serverpath = 'rest/')
/**
* Save release REST for a new package release.
*
* @param \PEAR2\Pyrus\Package $release
* @param \Pyrus\Package $release
* @param string $releaser handle of person who is uploading this release
*/
function saveRelease(\PEAR2\Pyrus\Package $new, $releaser)
function saveRelease(\Pyrus\Package $new, $releaser)
{
if ($new->channel !== $this->chan) {
throw new Exception('Cannot release ' .
Expand Down Expand Up @@ -85,11 +85,11 @@ function saveRelease(\PEAR2\Pyrus\Package $new, $releaser)
* Removes REST. If $deleteorphaned is true, then
* maintainers who no longer maintain a package will be
* deleted from package maintainer REST.
* @param \PEAR2\Pyrus\Package $release
* @param \Pyrus\Package $release
* @param string $deleter handle of maintainer deleting this release
* @param bool $deleteorphaned
*/
function deleteRelease(\PEAR2\Pyrus\Package $release, $deleter, $deleteorphaned = true)
function deleteRelease(\Pyrus\Package $release, $deleter, $deleteorphaned = true)
{
if ($new->channel !== $this->chan) {
throw new Exception('Cannot delete release ' .
Expand Down Expand Up @@ -175,7 +175,7 @@ private function _saveREST($path, $contents, $isxml, $type)
{
$this->_initDir($this->rest . '/' . $type . '/' . $path);
if ($isxml) {
$contents = (string) new \PEAR2\Pyrus\XMLWriter($contents);
$contents = (string) new \Pyrus\XMLWriter($contents);
}
file_put_contents($this->rest . '/' . $type . '/' . $path, $contents);
chmod($this->rest . '/' . $type . '/' . $path, 0666);
Expand Down
18 changes: 9 additions & 9 deletions src/PEAR2/SimpleChannelServer/REST/Package.php
Expand Up @@ -20,9 +20,9 @@ class Package extends Manager
/**
* Save package REST based on a release
*
* @param \PEAR2\Pyrus\package $new
* @param \Pyrus\package $new
*/
function save(\PEAR2\Pyrus\Package $new)
function save(\Pyrus\Package $new)
{
$this->_packages[$new->name] = true;
$this->saveInfo($new);
Expand All @@ -34,9 +34,9 @@ function save(\PEAR2\Pyrus\Package $new)
* Remove package REST based on a release
*
* This does nothing
* @param \PEAR2\Pyrus\package $new
* @param \Pyrus\package $new
*/
function erase(\PEAR2\Pyrus\Package $new)
function erase(\Pyrus\Package $new)
{
}

Expand Down Expand Up @@ -76,11 +76,11 @@ function deletePackage($name)
/**
* Save package REST based on a release
*
* @param \PEAR2\Pyrus\Package $new
* @param \Pyrus\Package $new
*/
function saveInfo(\PEAR2\Pyrus\Package $new)
function saveInfo(\Pyrus\Package $new)
{
$reader = new \PEAR2\Pyrus\XMLParser;
$reader = new \Pyrus\XMLParser;
$deprecated = false;
if (file_exists($this->rest . DIRECTORY_SEPARATOR . 'p' . DIRECTORY_SEPARATOR .
'info.xml')) {
Expand Down Expand Up @@ -140,11 +140,11 @@ function saveAllPackages()
/**
* Save package maintainers information for this release
*
* @param \PEAR2\Pyrus\Package $new package to be saved
* @param \Pyrus\Package $new package to be saved
*
* @return void
*/
function saveMaintainers(\PEAR2\Pyrus\Package $new)
function saveMaintainers(\Pyrus\Package $new)
{
$m = $this->_getProlog('m', 'packagemaintainers');
$m2 = $this->_getProlog('m', 'packagemaintainers2');
Expand Down

0 comments on commit d00873a

Please sign in to comment.