diff options
author | Marcus Boerger <helly@php.net> | 2007-02-08 16:55:34 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2007-02-08 16:55:34 +0000 |
commit | 38201d8d12628ac8825af230a6366f9310f0170e (patch) | |
tree | 9985c815a5fb18cebdd14fdfd34dc401d8cec175 /sapi/cli/php_cli.c | |
parent | a875e10909049fd617ff97e13f564c8b197ae508 (diff) | |
download | php-git-38201d8d12628ac8825af230a6366f9310f0170e.tar.gz |
- MFH php --ri <extension>
Diffstat (limited to 'sapi/cli/php_cli.c')
-rw-r--r-- | sapi/cli/php_cli.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 5b7c185c7b..d48617ae46 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -105,16 +105,16 @@ #define PHP_MODE_REFLECTION_FUNCTION 8 #define PHP_MODE_REFLECTION_CLASS 9 #define PHP_MODE_REFLECTION_EXTENSION 10 +#define PHP_MODE_REFLECTION_EXT_INFO 11 #define HARDCODED_INI \ "html_errors=0\n" \ "register_argc_argv=1\n" \ "implicit_flush=1\n" \ "output_buffering=0\n" \ - "max_execution_time=0\n" \ + "max_execution_time=0\n" \ "max_input_time=-1\n" - static char *php_optarg = NULL; static int php_optind = 1; #if (HAVE_LIBREADLINE || HAVE_LIBEDIT) && !defined(COMPILE_DL_READLINE) @@ -153,6 +153,8 @@ static const opt_struct OPTIONS[] = { {11, 1, "rclass"}, {12, 1, "re"}, {12, 1, "rextension"}, + {13, 1, "ri"}, + {13, 1, "rextinfo"}, #endif {'-', 0, NULL} /* end of args */ }; @@ -450,6 +452,7 @@ static void php_cli_usage(char *argv0) " --rf <name> Show information about function <name>.\n" " --rc <name> Show information about class <name>.\n" " --re <name> Show information about extension <name>.\n" + " --ri <name> Show configuration for extension <name>.\n" "\n" #endif , prog, prog, prog, prog, prog, prog); @@ -623,8 +626,8 @@ int main(int argc, char *argv[]) tsrm_startup(1, 1, 0, NULL); #endif - cli_sapi_module.php_ini_path_override = NULL; cli_sapi_module.ini_defaults = sapi_cli_ini_defaults; + cli_sapi_module.php_ini_path_override = NULL; cli_sapi_module.phpinfo_as_text = 1; sapi_startup(&cli_sapi_module); @@ -642,13 +645,13 @@ int main(int argc, char *argv[]) while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0))!=-1) { switch (c) { - case 'c': - cli_sapi_module.php_ini_path_override = strdup(php_optarg); - break; - case 'n': - cli_sapi_module.php_ini_ignore = 1; - break; - case 'd': { + case 'c': + cli_sapi_module.php_ini_path_override = strdup(php_optarg); + break; + case 'n': + cli_sapi_module.php_ini_ignore = 1; + break; + case 'd': { /* define ini entries on command line */ int len = strlen(php_optarg); char *val; @@ -947,6 +950,10 @@ int main(int argc, char *argv[]) behavior=PHP_MODE_REFLECTION_EXTENSION; reflection_what = php_optarg; break; + case 13: + behavior=PHP_MODE_REFLECTION_EXT_INFO; + reflection_what = php_optarg; + break; #endif default: break; @@ -1254,6 +1261,22 @@ int main(int argc, char *argv[]) break; } + case PHP_MODE_REFLECTION_EXT_INFO: + { + int len = strlen(reflection_what); + char *lcname = zend_str_tolower_dup(reflection_what, len); + zend_module_entry *module; + + if (zend_hash_find(&module_registry, lcname, len+1, (void**)&module) == FAILURE) { + zend_printf("Extension '%s' not present.\n", reflection_what); + exit_status = 1; + } else { + php_info_print_module(module TSRMLS_CC); + } + + efree(lcname); + break; + } #endif /* reflection */ } } |