cvs: phpdoc /scripts/iniupdate generate_changelog.php pecl.php
| From: | Nuno Lopes | Date: | Fri, 21 Sep 2007 15:44:27 +0000 |
| Subject: | cvs: phpdoc /scripts/iniupdate generate_changelog.php pecl.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-52@lists.php.net to get a copy of this message | ||
nlopess Fri Sep 21 15:44:27 2007 UTC
Modified files:
/phpdoc/scripts/iniupdate generate_changelog.php pecl.php
Log:
add cache to get_pecl_packages()
make pkg_name() return the packag name in its original cAsE
http://cvs.php.net/viewvc.cgi/phpdoc/scripts/iniupdate/generate_changelog.php?r1=1.10&r2=1.11&diff_format=u
Index: phpdoc/scripts/iniupdate/generate_changelog.php
diff -u phpdoc/scripts/iniupdate/generate_changelog.php:1.10
phpdoc/scripts/iniupdate/generate_changelog.php:1.11
--- phpdoc/scripts/iniupdate/generate_changelog.php:1.10 Fri Sep 21 15:35:49 2007
+++ phpdoc/scripts/iniupdate/generate_changelog.php Fri Sep 21 15:44:27 2007
@@ -24,6 +24,7 @@
}
require_once './cvs-versions.php';
+require_once './pecl.php';
/** converts a tag like php_5_0_0 into a version like 5.0.0 */
@@ -50,7 +51,13 @@
{
$input = is_array($array) ? key($array) : $array;
preg_match('/(.+)-(\d+\.\d+(?:\.\d+)?)/S', $input, $m);
- return $m[1];
+ $lowered = $m[1];
+
+ foreach (get_pecl_packages() as $pkg) {
+ if (strcasecmp($pkg, $lowered) === 0) {
+ return $pkg;
+ }
+ }
}
@@ -68,7 +75,7 @@
$pkg_strlen = strlen($pkg);
foreach ($pecl_releases as $release) {
- if (substr_compare($pkg, $release, 0, $pkg_strlen) == 0) {
+ if (substr_compare($pkg, $release, 0, $pkg_strlen, true) == 0) {
$cache[$pkg][] = $release;
}
}
http://cvs.php.net/viewvc.cgi/phpdoc/scripts/iniupdate/pecl.php?r1=1.8&r2=1.9&diff_format=u
Index: phpdoc/scripts/iniupdate/pecl.php
diff -u phpdoc/scripts/iniupdate/pecl.php:1.8 phpdoc/scripts/iniupdate/pecl.php:1.9
--- phpdoc/scripts/iniupdate/pecl.php:1.8 Thu Sep 6 19:29:58 2007
+++ phpdoc/scripts/iniupdate/pecl.php Fri Sep 21 15:44:27 2007
@@ -21,16 +21,19 @@
/** returns an array with the PECL packages */
function get_pecl_packages()
{
+ static $cache = null;
+ if ($cache) return $cache;
+
$packages = array();
$XE = @new SimpleXMLElement('http://pecl.php.net/rest/p/packages.xml',
NULL, true);
foreach ($XE as $Element) {
if ($Element->getName() == 'p') {
- $packages[] = strtolower((string) $Element);
+ $packages[] = (string) $Element;
}
}
- return $packages;
+ return $cache = $packages;
}
@@ -39,6 +42,7 @@
{
try {
$releases = array();
+ $package = strtolower($package);
$url = "http://pecl.php.net/rest/r/$package/allreleases.xml";
// simplexml doesnt seem to be able to handle the 404 errors as I would like..