cvs: phpdoc /scripts/iniupdate generate_changelog.php
| From: | Nuno Lopes | Date: | Fri, 21 Sep 2007 15:35:49 +0000 |
| Subject: | cvs: phpdoc /scripts/iniupdate generate_changelog.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-51@lists.php.net to get a copy of this message | ||
nlopess Fri Sep 21 15:35:49 2007 UTC
Modified files:
/phpdoc/scripts/iniupdate generate_changelog.php
Log:
make the available_since and removed_in work with PECL packages :)
removed the permission changelog function, as it needs a full rewrite to work with PECL packages
http://cvs.php.net/viewvc.cgi/phpdoc/scripts/iniupdate/generate_changelog.php?r1=1.9&r2=1.10&diff_format=u
Index: phpdoc/scripts/iniupdate/generate_changelog.php
diff -u phpdoc/scripts/iniupdate/generate_changelog.php:1.9
phpdoc/scripts/iniupdate/generate_changelog.php:1.10
--- phpdoc/scripts/iniupdate/generate_changelog.php:1.9 Fri Sep 21 14:47:12 2007
+++ phpdoc/scripts/iniupdate/generate_changelog.php Fri Sep 21 15:35:49 2007
@@ -25,6 +25,7 @@
require_once './cvs-versions.php';
+
/** converts a tag like php_5_0_0 into a version like 5.0.0 */
function tag2version($tag)
{
@@ -44,28 +45,35 @@
}
-/** checks if an ini setting has changed its value in PHP 5 */
-function check_php4($array)
+/** returns the package name of the given array/string */
+function pkg_name($array)
{
- foreach ($array as $key => $val) {
- if (substr($key, 0, 5) != 'php_4') {
- continue;
- }
+ $input = is_array($array) ? key($array) : $array;
+ preg_match('/(.+)-(\d+\.\d+(?:\.\d+)?)/S', $input, $m);
+ return $m[1];
+}
- if ($val) {
- if (isset($old)) {
- if ($val != $old) {
- return '';
- }
- } else {
- $old = $val;
- }
+
+/** fetch the local PECL releases of the given pkg name */
+function get_local_pecl_releases($array)
+{
+ static $cache = array();
+
+ $pecl_releases = get_pecl_releases_local();
+
+ $pkg = pkg_name($array);
+
+ if (isset($cache[$pkg])) return $cache[$pkg];
+
+ $pkg_strlen = strlen($pkg);
+
+ foreach ($pecl_releases as $release) {
+ if (substr_compare($pkg, $release, 0, $pkg_strlen) == 0) {
+ $cache[$pkg][] = $release;
}
}
- if (isset($old) && !empty($array['php_5_0_0']) && $old !==
$array['php_5_0_0']) {
- return "$old in PHP 4.";
- }
+ return $cache[$pkg];
}
@@ -86,7 +94,16 @@
// PECL only
} else {
- // TODO
+ $releases = get_local_pecl_releases($array);
+
+ if (key($array) !== current($releases)) {
+ foreach ($releases as $rel) {
+ if ($rel === key($array)) {
+ $ver = pkg_name($array) .' '. tag2version($rel);
+ break;
+ }
+ }
+ }
}
return $ver ? "Available since $ver." : '';
@@ -96,31 +113,7 @@
/** check for changes between versions */
function last_version($array)
{
- $php4 = check_php4($array);
- $str = '';
-
- foreach ($array as $key => $val) {
- if ($php4 && substr($key, 0, 5) == 'php_4') {
- continue;
- }
-
- if ($val) {
- if (isset($old)) {
- if ($val != $old) {
- if ($old_tag == 'php_4_cvs') {
- $str .= " $old in PHP < 5.";
- } else {
- $str .= " $old in PHP <= " . tag2version($old_tag) .
'.';
- }
- }
- }
-
- $old = $val;
- $old_tag = $key;
- }
- }
-
- return $php4 . $str;
+ // TODO again
}
@@ -144,7 +137,22 @@
// PECL only
} else {
- // TODO
+ $releases = get_local_pecl_releases($array);
+
+ $on = false;
+ end($array);
+
+ if (end($releases) !== key($array)) {
+ foreach ($releases as $release) {
+ if ($release === key($array)) {
+ $on = true;
+
+ } else if ($on) {
+ $ver = pkg_name($array) .' '. tag2version($release);
+ break;
+ }
+ }
+ }
}
@@ -194,6 +202,7 @@
while ($row = sqlite_fetch_array($q, SQLITE_ASSOC)) {
$info[$row['name']][$row['package'].'-'.$row['version']] =
$row['value'];
+ uksort($info[$row['name']], 'strnatcasecmp');
}