From: Marcus Boerger Date: Tue, 23 Jan 2007 20:02:29 +0000 (+0000) Subject: - Add --ri/--rextinfo X-Git-Tag: RELEASE_1_0_0RC1~142 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94292d3e0128d86a763553e855051e84155fa616;p=php - Add --ri/--rextinfo --- diff --git a/sapi/cli/php.1.in b/sapi/cli/php.1.in index 2b1e3dafb4..0a224ea176 100644 --- a/sapi/cli/php.1.in +++ b/sapi/cli/php.1.in @@ -294,6 +294,16 @@ Shows information about class .IR name Shows information about extension .B name +.TP +.PD 0 +.B \-\-rextinfo +.IR name +.TP +.PD 1 +.B \-\-ri +.IR name +Shows configuration for extension +.B name .SH FILES .TP 15 .B php\-cli.ini diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 49b6cfe152..f51185a6a0 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -105,6 +105,7 @@ #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" \ @@ -152,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 */ }; @@ -460,6 +463,7 @@ static void php_cli_usage(char *argv0) " --rf Show information about function .\n" " --rc Show information about class .\n" " --re Show information about extension .\n" + " --ri Show configuration for extension .\n" "\n" #endif , prog, prog, prog, prog, prog, prog); @@ -958,6 +962,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; @@ -1263,6 +1271,22 @@ int main(int argc, char *argv[]) zval_ptr_dtor(&ref); zval_ptr_dtor(&arg); + 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 */