summaryrefslogtreecommitdiff
path: root/ext/pcre/upgrade-pcre.php
diff options
context:
space:
mode:
authorNuno Lopes <nlopess@php.net>2007-09-11 16:19:14 +0000
committerNuno Lopes <nlopess@php.net>2007-09-11 16:19:14 +0000
commitc6ba92b7ac8efda24b07de102641a79c820f0606 (patch)
tree238fa8535f399498ebeff42e6657afba51856383 /ext/pcre/upgrade-pcre.php
parent894f79596e79994c052b3776342935013bff994b (diff)
downloadphp-git-c6ba92b7ac8efda24b07de102641a79c820f0606.tar.gz
MFB: remove HAVE_CONFIG_H
Diffstat (limited to 'ext/pcre/upgrade-pcre.php')
-rw-r--r--ext/pcre/upgrade-pcre.php23
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";
}