Source for file configure.php
Documentation is available at configure.php
* The Predefined Classes/Constants array script generator.
* @package PHP_CompatInfo
* @author Laurent Laville <pear@laurent-laville.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version CVS: $Id: configure.php,v 1.2 2008/11/30 21:05:43 farell Exp $
* @link http://pear.php.net/package/PHP_CompatInfo
* @since File available since Release 1.9.0b1
require_once 'Console/Getargs.php';
$ds = DIRECTORY_SEPARATOR;
$opts = array ('enable' =>
'desc' => 'A comma separated list of extensions '
'min' => 0 , 'max' => 1 ),
'desc' => 'A comma separated list of extensions '
'min' => 0 , 'max' => 1 ),
'desc' => 'File that provides exceptions results',
'default' => 'exceptions.conf.php',
'min' => 0 , 'max' => 1 ),
'desc' => 'Target directory where to write results',
'min' => 0 , 'max' => 1 ),
'desc' => 'Set the verbose level',
'min' => 0 , 'max' => 1 ),
'desc' => 'Print version information',
'desc' => 'Show this help',
$args = Console_Getargs ::factory ($opts);
if (PEAR ::isError ($args)) {
$header = "PHP_CompatInfo build system \n".
'Usage: '. basename($_SERVER['SCRIPT_NAME']). " [options]\n\n";
if ($args->getCode () === CONSOLE_GETARGS_ERROR_USER ) {
echo Console_Getargs ::getHelp ($opts, $header, $args->getMessage ()). "\n";
} else if ($args->getCode () === CONSOLE_GETARGS_HELP ) {
echo Console_Getargs ::getHelp ($opts, $header). "\n";
if ($args->isDefined ('V')) {
echo 'PHP_CompatInfo build system version 1.9.0b1';
if ($args->isDefined ('v')) {
$verbose = $args->getValue ('v');
if ($args->isDefined ('o')) {
$o = $args->getValue ('o');
/* Directory where to write
all "*_const_array.php" and "*_class_array.php" files
Must ended with a trailing directory separator */
if (substr($o, -1 , 1 ) !== $ds) {
echo 'Invalid (or not writable) target directory';
$target_directory = dirname(__FILE__ ) . $ds;
if ($args->isDefined ('e')) {
$extensions = explode(',', $args->getValue ('e'));
if ($args->isDefined ('d')) {
$d = explode(',', $args->getValue ('d'));
if ($args->isDefined ('x')) {
$x = $args->getValue ('x');
echo 'getExceptions() function does not exists';
echo 'Exceptions file does not exists';
include_once dirname (__FILE__ ) . $ds . 'scripts' . $ds . 'exceptions.conf.php';
$const_glob_list = array ();
$class_glob_list = array ();
foreach ($extensions as $extension) {
continue; // skip this extension if not loaded : prevent error
$ext = new ReflectionExtension ($extension);
// name of the current Extension
$extName = $ext->getName ();
// version of the current Extension
$extVers = $ext->getVersion ();
print 'Found '. $extName;
print ' version '. $extVers;
// default version to apply to each constant and class predefined
// constants described by the Extension interface
$extConstants = $ext->getConstants ();
if (count($extConstants) > 0 ) {
$const_glob_list[] = $extName;
foreach ($extConstants as $cst => $val) {
$constants[$cst]['init'] = $ver;
$constants[$cst]['name'] = $cst;
if ($exceptions === false ) {
// no constant exceptions for this extension
// apply exceptions to give final constant results
* $extName extension Constant dictionary for PHP_CompatInfo 1.9.0a1 or better
* @package PHP_CompatInfo
* @author Davey Shafik <davey@php.net>
* @author Laurent Laville <pear@laurent-laville.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version CVS: \$Id: configure.php,v 1.2 2008/11/30 21:05:43 farell Exp $
* @link http://pear.php.net/package/PHP_CompatInfo
* @since version 1.9.0a1 (2008-11-23)
\$GLOBALS['_PHP_COMPATINFO_CONST_" . strtoupper($extName) . "'] = " .
// classes described by the Extension interface
$extClasses = $ext->getClassNames ();
if (count($extClasses) > 0 ) {
$class_glob_list[] = $extName;
foreach ($extClasses as $i => $cls) {
$classes[$cls]['init'] = $ver;
$classes[$cls]['name'] = $cls;
$classes[$cls]['ext'] = $extName;
$classes[$cls]['pecl'] = false;
if ($exceptions === false ) {
// no class exceptions for this extension
// apply exceptions to give final class results
* $extName extension Class dictionary for PHP_CompatInfo 1.9.0a1 or better
* @package PHP_CompatInfo
* @author Davey Shafik <davey@php.net>
* @author Laurent Laville <pear@laurent-laville.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version CVS: \$Id: configure.php,v 1.2 2008/11/30 21:05:43 farell Exp $
* @link http://pear.php.net/package/PHP_CompatInfo
* @since version 1.9.0a1 (2008-11-23)
\$GLOBALS['_PHP_COMPATINFO_CLASS_" . strtoupper($extName) . "'] = " .
foreach ($const_glob_list as $cstExt) {
$requires .= "require_once 'PHP/CompatInfo/" . $cstExt . "_const_array.php';"
$globals .= " \$GLOBALS['_PHP_COMPATINFO_CONST_" . strtoupper($cstExt)
$globals = rtrim($globals, ", ".PHP_EOL );
* Constant dictionary for PHP_CompatInfo 1.1.1 or better
* @package PHP_CompatInfo
* @author Davey Shafik <davey@php.net>
* @author Laurent Laville <pear@laurent-laville.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version CVS: \$Id: configure.php,v 1.2 2008/11/30 21:05:43 farell Exp $
* @link http://pear.php.net/package/PHP_CompatInfo
* @since version 1.1.1 (2006-07-27)
* @link http://www.php.net/manual/en/reserved.constants.php
* @global array \$GLOBALS['_PHP_COMPATINFO_CONST']
\$GLOBALS['_PHP_COMPATINFO_CONST'] = array_merge(
foreach ($class_glob_list as $clsExt) {
$requires .= "require_once 'PHP/CompatInfo/" . $clsExt . "_class_array.php';"
$globals .= " \$GLOBALS['_PHP_COMPATINFO_CLASS_" . strtoupper($clsExt)
$globals = rtrim($globals, ", ".PHP_EOL );
* Class dictionary for PHP_CompatInfo 1.9.0a1 or better
* @package PHP_CompatInfo
* @author Davey Shafik <davey@php.net>
* @author Laurent Laville <pear@laurent-laville.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version CVS: \$Id: configure.php,v 1.2 2008/11/30 21:05:43 farell Exp $
* @link http://pear.php.net/package/PHP_CompatInfo
* @since version 1.9.0a1 (2008-11-23)
* > Standard Defined Classes
* These classes are defined in the standard set of functions included in
* - __PHP_Incomplete_Class
* > Predefined classes as of PHP 5
* These additional predefined classes were introduced in PHP 5.0.0
* > Miscellaneous extensions
* define other classes which are described in their reference.
* @link http://www.php.net/manual/en/function.get-declared-classes.php
* @link http://www.php.net/manual/en/reserved.classes.php
* @global array \$GLOBALS['_PHP_COMPATINFO_CLASS']
\$GLOBALS['_PHP_COMPATINFO_CLASS'] = array_merge(
Documentation generated on Sun, 30 Nov 2008 16:30:26 -0500 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.
|