cvs: phpdoc /scripts/iniupdate ini-update.php ini_search_lib.php insert_db.php

From: Date: Sat, 29 Sep 2007 22:51:29 +0000
Subject: cvs: phpdoc /scripts/iniupdate ini-update.php ini_search_lib.php insert_db.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-106@lists.php.net to get a copy of this message
nlopess Sat Sep 29 22:51:29 2007 UTC Modified files: /phpdoc/scripts/iniupdate ini-update.php ini_search_lib.php insert_db.php Log: enable macro expansion for already removed opts, so that their real value is stored in the DB, instead of the macro's name http://cvs.php.net/viewvc.cgi/phpdoc/scripts/iniupdate/ini-update.php?r1=1.14&r2=1.15&diff_format=u Index: phpdoc/scripts/iniupdate/ini-update.php diff -u phpdoc/scripts/iniupdate/ini-update.php:1.14 phpdoc/scripts/iniupdate/ini-update.php:1.15 --- phpdoc/scripts/iniupdate/ini-update.php:1.14 Sat Sep 29 22:27:58 2007 +++ phpdoc/scripts/iniupdate/ini-update.php Sat Sep 29 22:51:29 2007 @@ -25,8 +25,6 @@ $pecl_dir = 'sources/pecl'; //pecl path $phpdoc_dir = '../..'; //phpdoc path -define('MAX_MACRO_EXPAND_DEPTH', 10); - /******* END of configurations *****/ require_once './ini_search_lib.php'; @@ -162,18 +160,7 @@ unset($link_files[$oldentry]); } - - /* replace macros and make the $default var */ - $new = $arr[0]; - $old = null; - $i = 0; - - while ($new[0] !== '"' && $new !== $old && ++$i < MAX_MACRO_EXPAND_DEPTH) { - $old = $new; - $new = strtr($new,$replace); - } - - $default = $new; + $default = expand_macros($arr[0]); if(preg_match_all('/"([^"]+)"/S', $default, $match) > 1) { $default = '"'; http://cvs.php.net/viewvc.cgi/phpdoc/scripts/iniupdate/ini_search_lib.php?r1=1.9&r2=1.10&diff_format=u Index: phpdoc/scripts/iniupdate/ini_search_lib.php diff -u phpdoc/scripts/iniupdate/ini_search_lib.php:1.9 phpdoc/scripts/iniupdate/ini_search_lib.php:1.10 --- phpdoc/scripts/iniupdate/ini_search_lib.php:1.9 Thu Sep 6 18:13:35 2007 +++ phpdoc/scripts/iniupdate/ini_search_lib.php Sat Sep 29 22:51:29 2007 @@ -3,7 +3,7 @@ +----------------------------------------------------------------------+ | ini doc settings updater | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2005 The PHP Group | + | Copyright (c) 1997-2007 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,6 +17,11 @@ +----------------------------------------------------------------------+ */ +// limit the macro expansion to avoid possible infinite loops +define('MAX_MACRO_EXPAND_DEPTH', 10); + + + function recurse($dirs, $search_macros = false) { global $array; @@ -116,4 +121,21 @@ } //!is_dir() } //while() loop } -?> + + +/** expand macros on the given string */ +function expand_macros($str) +{ + global $replace; + + $new = $str; + $old = null; + $i = 0; + + while ($new[0] !== '"' && $new !== $old && ++$i < MAX_MACRO_EXPAND_DEPTH) { + $old = $new; + $new = strtr($new,$replace); + } + + return $new; +} http://cvs.php.net/viewvc.cgi/phpdoc/scripts/iniupdate/insert_db.php?r1=1.12&r2=1.13&diff_format=u Index: phpdoc/scripts/iniupdate/insert_db.php diff -u phpdoc/scripts/iniupdate/insert_db.php:1.12 phpdoc/scripts/iniupdate/insert_db.php:1.13 --- phpdoc/scripts/iniupdate/insert_db.php:1.12 Sat Sep 29 21:54:29 2007 +++ phpdoc/scripts/iniupdate/insert_db.php Sat Sep 29 22:51:29 2007 @@ -33,7 +33,7 @@ $sql .= "INSERT INTO changelog (name, $tag) VALUES ('$key', '{$data[1]}');"; } - $sql .= "REPLACE INTO last_seen_values (name, defaultval, permissions) VALUES ('$key', '".sqlite_escape_string($data[0])."', '$data[1]');"; + $sql .= "REPLACE INTO last_seen_values (name, defaultval, permissions) VALUES ('$key', '".sqlite_escape_string(expand_macros($data[0]))."', '$data[1]');"; } @@ -50,8 +50,8 @@ // process PHP sources foreach ($tags as $tag) { - $array = array(); - recurse("./sources/$tag"); + $array = $replace = array(); + recurse("./sources/$tag", true); insert_in_db($tag); echo "$tag\n"; @@ -69,8 +69,8 @@ continue; } - $array = array(); - recurse("./sources/$release"); + $array = $replace = array(); + recurse("./sources/$release", true); $sql = ''; @@ -79,7 +79,7 @@ // prefer information from PHP sources if (!sqlite_single_query($idx, "SELECT name FROM changelog WHERE name='$key'")) { - $sql .= "REPLACE INTO last_seen_values (name, defaultval, permissions) VALUES ('$key', '".sqlite_escape_string($data[0])."', '$data[1]');"; + $sql .= "REPLACE INTO last_seen_values (name, defaultval, permissions) VALUES ('$key', '".sqlite_escape_string(expand_macros($data[0]))."', '$data[1]');"; } }

« previous php.doc.cvs (#106) next »