本文整理匯總了PHP中PEAR_REST::retrieveCacheFirst方法的典型用法代碼示例。如果您正苦於以下問題:PHP PEAR_REST::retrieveCacheFirst方法的具體用法?PHP PEAR_REST::retrieveCacheFirst怎麽用?PHP PEAR_REST::retrieveCacheFirst使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PEAR_REST
的用法示例。
在下文中一共展示了PEAR_REST::retrieveCacheFirst方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: packageInfo
function packageInfo($base, $package, $channel = false)
{
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$pinfo = $this->_rest->retrieveData($base . 'p/' . strtolower($package) . '/info.xml', false, false, $channel);
if (PEAR::isError($pinfo)) {
PEAR::popErrorHandling();
return PEAR::raiseError('Unknown package: "' . $package . '" in channel "' . $channel . '"' . "\n" . 'Debug: ' . $pinfo->getMessage());
}
$releases = array();
$allreleases = $this->_rest->retrieveData($base . 'r/' . strtolower($package) . '/allreleases.xml', false, false, $channel);
if (!PEAR::isError($allreleases)) {
if (!class_exists('PEAR_PackageFile_v2')) {
require_once 'PEAR/PackageFile/v2.php';
}
if (!is_array($allreleases['r']) || !isset($allreleases['r'][0])) {
$allreleases['r'] = array($allreleases['r']);
}
$pf = new PEAR_PackageFile_v2();
foreach ($allreleases['r'] as $release) {
$ds = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/deps.' . $release['v'] . '.txt', false, false, $channel);
if (PEAR::isError($ds)) {
continue;
}
if (!isset($latest)) {
$latest = $release['v'];
}
$pf->setDeps(unserialize($ds));
$ds = $pf->getDeps();
$info = $this->_rest->retrieveCacheFirst($base . 'r/' . strtolower($package) . '/' . $release['v'] . '.xml', false, false, $channel);
if (PEAR::isError($info)) {
continue;
}
$releases[$release['v']] = array('doneby' => $info['m'], 'license' => $info['l'], 'summary' => $info['s'], 'description' => $info['d'], 'releasedate' => $info['da'], 'releasenotes' => $info['n'], 'state' => $release['s'], 'deps' => $ds ? $ds : array());
}
} else {
$latest = '';
}
PEAR::popErrorHandling();
if (isset($pinfo['dc']) && isset($pinfo['dp'])) {
if (is_array($pinfo['dp'])) {
$deprecated = array('channel' => (string) $pinfo['dc'], 'package' => trim($pinfo['dp']['_content']));
} else {
$deprecated = array('channel' => (string) $pinfo['dc'], 'package' => trim($pinfo['dp']));
}
} else {
$deprecated = false;
}
if (!isset($latest)) {
$latest = '';
}
return array('name' => $pinfo['n'], 'channel' => $pinfo['c'], 'category' => $pinfo['ca']['_content'], 'stable' => $latest, 'license' => $pinfo['l'], 'summary' => $pinfo['s'], 'description' => $pinfo['d'], 'releases' => $releases, 'deprecated' => $deprecated);
}