Back to index

php5  5.3.10
Functions | Variables
upgrade-pcre.php File Reference

Go to the source code of this file.

Functions

 recurse ($path)

Variables

 $pattern = 'pcre-*.tar.*'
 $newpcre = glob($pattern)
 $dirlen = strlen('pcrelib')
 $dirorig = scandir('pcrelib/testdata')
 $k = array_search('CVS', $dirorig)
 $dirnew = scandir("$newpcre/testdata")
 $diff = array_diff($dirorig, $dirnew)
foreach($diff as $file) $prepend_config_h

Function Documentation

recurse ( path)

Definition at line 32 of file upgrade-pcre.php.

{
       global $newpcre, $dirlen;

       foreach (scandir($path) as $file) {

              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";

              if (is_dir($file)) {
                     recurse($file);
                     continue;
              }

              echo "processing $file... ";

              $newfile = $newpcre . substr($file, $dirlen);

              if (is_file($tmp = $newfile . '.generic') || is_file($tmp = $newfile . '.dist')) {
                     $newfile = $tmp;
              }


              if (!is_file($newfile)) {
                     die("$newfile is not available any more\n");
              }

              // 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";
       }

}


recurse('pcrelib');

$dirorig = scandir('pcrelib/testdata');
$k = array_search('CVS', $dirorig);
if ($k !== false)
       unset($dirorig[$k]);

$k = array_search('.svn', $dirorig);
if ($k !== false)
       unset($dirorig[$k]);

$dirnew = scandir("$newpcre/testdata");
$diff   = array_diff($dirorig, $dirnew);

foreach ($diff as $file) {
       $file2 = 'pcrelib'.substr($file, strlen($newpcre));
       copy($file, $file2);
}

Here is the caller graph for this function:


Variable Documentation

$diff = array_diff($dirorig, $dirnew)

Definition at line 95 of file upgrade-pcre.php.

$dirlen = strlen('pcrelib')

Definition at line 30 of file upgrade-pcre.php.

$dirnew = scandir("$newpcre/testdata")

Definition at line 94 of file upgrade-pcre.php.

$dirorig = scandir('pcrelib/testdata')

Definition at line 85 of file upgrade-pcre.php.

$k = array_search('CVS', $dirorig)

Definition at line 86 of file upgrade-pcre.php.

if (count($newpcre) > 1) if (count($newpcre)==0) $newpcre = glob($pattern)

Definition at line 6 of file upgrade-pcre.php.

$pattern = 'pcre-*.tar.*'

Definition at line 5 of file upgrade-pcre.php.

foreach ($diff as $file) $prepend_config_h
Initial value:
 '
#include <php_compat.h>

#ifndef PHP_WIN32
# include <php_config.h>
#endif

#undef PACKAGE_NAME
#undef PACKAGE_VERSION
#undef PACKAGE_TARNAME
#undef PACKAGE_STRING

#define SUPPORT_UCP
#define SUPPORT_UTF8

#if defined(__GNUC__) && __GNUC__ >= 4
# ifdef __cplusplus
#  define PCRE_EXP_DECL            extern "C" __attribute__ ((visibility("default")))
# else
#  define PCRE_EXP_DECL            extern __attribute__ ((visibility("default")))
# endif
# define PCRE_EXP_DEFN             __attribute__ ((visibility("default")))
# define PCRE_EXP_DATA_DEFN __attribute__ ((visibility("default")))
#endif


'

Definition at line 104 of file upgrade-pcre.php.