summaryrefslogtreecommitdiffstats
path: root/class
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-04-08 10:22:51 +0200
committerRemi Collet <fedora@famillecollet.com>2015-04-08 10:22:51 +0200
commit0b81ee38e96bd00630a7530ac6adb0a8a73e96e8 (patch)
treecb7af8593c8f5a306d3576c0e944e5e42848b68d /class
parent5dc8fd70803afa8b6fb42c02122651f4d9e76d84 (diff)
move from xmlrpc to rest for pecl parser
Diffstat (limited to 'class')
-rw-r--r--class/Parser.php30
1 files changed, 18 insertions, 12 deletions
diff --git a/class/Parser.php b/class/Parser.php
index 016664f..be278ec 100644
--- a/class/Parser.php
+++ b/class/Parser.php
@@ -380,6 +380,8 @@ class Parser
*/
static public function readPecl(TableUpstream $uptable, $url)
{
+ return self::readOnePear($uptable, 'pecl', $url);
+ /*
self::log("PECL listLatestReleases - stable");
$request = xmlrpc_encode_request("package.listLatestReleases", "stable");
@@ -464,6 +466,7 @@ class Parser
self::log("Write $nb packages");
}
return $nb;
+ */
}
/**
@@ -537,6 +540,8 @@ class Parser
*/
static public function readOnePear(TableUpstream $uptable, $channelname, $channelurl)
{
+ $type = ($channelname=='pecl' ? 'pecl' : 'pear');
+
$channel = @simplexml_load_file("http://$channelurl/channel.xml");
if (!$channel) {
self::log("can't read PEAR site (channel of $channelname)");
@@ -552,7 +557,7 @@ class Parser
return 0;
}
- $crit = array('type'=>'pear', 'channel'=>$channelname);
+ $crit = array('type' => $type, 'channel' => $channelname);
$nb = $uptable->delete($crit);
self::log("Delete $nb packages");
@@ -583,7 +588,7 @@ class Parser
$rpmname2="php-".$channelname."-".$name;
$uptable->record(
- "pear",
+ $type,
$channelname,
$rpmname1,
(string)$pi->r[0]->v,
@@ -591,7 +596,7 @@ class Parser
(string)$pi->r[0]->s
);
$uptable->record(
- "pear",
+ $type,
$channelname,
$rpmname2,
(string)$pi->r[0]->v,
@@ -601,14 +606,14 @@ class Parser
foreach ($pi->r as $rev) {
if ($rev->s=='stable') {
$uptable->record(
- "pear",
+ $type,
$channelname,
$rpmname1,
(string)$rev->v,
true
);
$uptable->record(
- "pear",
+ $type,
$channelname,
$rpmname2,
(string)$rev->v,
@@ -639,6 +644,7 @@ class Parser
"",
str_replace("\r\n", "\n", substr($pitxt, 2))
);
+ $pitxt = str_replace("\xA0","", $pitxt);
$pi = @simplexml_load_string($pitxt);
if (!$pi) {
@@ -651,10 +657,10 @@ class Parser
if ($channelname=='phing' && $name=='phing') {
$rpmname1="php-pear-phing";
- } else if ($channelname=='phpunit'
- && $name=='PHPUnit'
- ) {
+ } else if ($channelname=='phpunit' && $name=='PHPUnit') {
$rpmname1="php-pear-PHPUnit";
+ } else if ($channelname=='pecl' && $name=='pecl_http') {
+ $rpmname1="php-pecl-http";
} else {
$rpmname1="php-".$channelname."-".
str_replace("_", "-", $name);
@@ -662,7 +668,7 @@ class Parser
$rpmname2="php-".$channelname."-".$name;
$uptable->record(
- "pear",
+ $type,
$channelname,
$rpmname1,
(string)$ps->a->r[0]->v,
@@ -670,7 +676,7 @@ class Parser
(string)$ps->a->r[0]->s
);
$uptable->record(
- "pear",
+ $type,
$channelname,
$rpmname2,
(string)$ps->a->r[0]->v,
@@ -680,14 +686,14 @@ class Parser
foreach ($ps->a->r as $rev) {
if ($rev->s=='stable') {
$uptable->record(
- "pear",
+ $type,
$channelname,
$rpmname1,
(string)$rev->v,
true
);
$uptable->record(
- "pear",
+ $type,
$channelname,
$rpmname2,
(string)$rev->v,