From 0b81ee38e96bd00630a7530ac6adb0a8a73e96e8 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 8 Apr 2015 10:22:51 +0200 Subject: move from xmlrpc to rest for pecl parser --- class/Parser.php | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'class') 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, -- cgit