diff options
author | Nuno Lopes <nlopess@php.net> | 2007-09-11 16:19:14 +0000 |
---|---|---|
committer | Nuno Lopes <nlopess@php.net> | 2007-09-11 16:19:14 +0000 |
commit | c6ba92b7ac8efda24b07de102641a79c820f0606 (patch) | |
tree | 238fa8535f399498ebeff42e6657afba51856383 /ext/pcre/upgrade-pcre.php | |
parent | 894f79596e79994c052b3776342935013bff994b (diff) | |
download | php-git-c6ba92b7ac8efda24b07de102641a79c820f0606.tar.gz |
MFB: remove HAVE_CONFIG_H
Diffstat (limited to 'ext/pcre/upgrade-pcre.php')
-rw-r--r-- | ext/pcre/upgrade-pcre.php | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/ext/pcre/upgrade-pcre.php b/ext/pcre/upgrade-pcre.php index 2f7202e0fb..dd0a8a783a 100644 --- a/ext/pcre/upgrade-pcre.php +++ b/ext/pcre/upgrade-pcre.php @@ -33,10 +33,13 @@ function recurse($path) { global $newpcre, $dirlen; - foreach(scandir($path) as $file) { + foreach (scandir($path) as $file) { - if ($file[0] === '.' || $file === 'CVS') continue; - if (substr_compare($file, '.lo', -3, 3) == 0 || substr_compare($file, '.o', -2, 2) == 0) continue; + if ($file[0] === '.' || + $file === 'CVS' || + substr_compare($file, '.lo', -3, 3) == 0 || + substr_compare($file, '.loT', -4, 4) == 0 || + substr_compare($file, '.o', -2, 2) == 0) continue; $file = "$path/$file"; @@ -58,7 +61,19 @@ function recurse($path) die("$newfile is not available any more\n"); } - copy($newfile, $file); + // maintain file mtimes so that cvs doesnt get crazy + if (file_get_contents($newfile) !== file_get_contents($file)) { + copy($newfile, $file); + } + + // always include the config.h file + $content = file_get_contents($newfile); + $newcontent = preg_replace('/#\s*ifdef HAVE_CONFIG_H\s*(.+)\s*#\s*endif/', '$1', $content); + + if ($content !== $newcontent) { + file_put_contents($file, $newcontent); + } + echo "OK\n"; } |