1
0
Fork 0

Fixes in PEAR support

pull/90/merge
Jordi Boggiano 2011-11-06 20:24:52 +01:00
parent f572bbb0bf
commit 4b5abaf44f
2 changed files with 25 additions and 4 deletions

View File

@ -21,7 +21,10 @@ class PearDownloader extends FileDownloader
{
protected function extract($file, $path)
{
system(sprintf('tar -zxf %s', escapeshellarg($file)));
$oldDir = getcwd();
chdir(dirname($file));
system(sprintf('tar -zxf %s', escapeshellarg(basename($file))));
chdir($oldDir);
@unlink($path . '/package.sig');
@unlink($path . '/package.xml');
}

View File

@ -64,7 +64,14 @@ class PearRepository extends ArrayRepository
$packageLink = $package->getAttribute('xlink:href');
$releaseLink = $this->url . str_replace("/rest/p/", "/rest/r/", $packageLink);
$allReleasesLink = $releaseLink . "/allreleases2.xml";
$releasesXML = $this->requestXml($allReleasesLink);
try {
$releasesXML = $this->requestXml($allReleasesLink);
} catch (\ErrorException $e) {
if (strpos($e->getMessage(), '404')) {
continue;
}
}
$releases = $releasesXML->getElementsByTagName('r');
@ -79,7 +86,14 @@ class PearRepository extends ArrayRepository
'version' => $pearVersion,
);
$deps = file_get_contents($releaseLink . "/deps.".$pearVersion.".txt");
try {
$deps = file_get_contents($releaseLink . "/deps.".$pearVersion.".txt");
} catch (\ErrorException $e) {
if (strpos($e->getMessage(), '404')) {
continue;
}
}
if (preg_match('((O:([0-9])+:"([^"]+)"))', $deps, $matches)) {
if (strlen($matches[3]) == $matches[2]) {
throw new \InvalidArgumentException("Invalid dependency data, it contains serialized objects.");
@ -102,7 +116,11 @@ class PearRepository extends ArrayRepository
}
}
$this->addPackage($loader->load($packageData));
try {
$this->addPackage($loader->load($packageData));
} catch (\UnexpectedValueException $e) {
continue;
}
}
}
}