@@ -2435,11 +2435,42 @@ PHP_METHOD(RedisCluster, lastsave) {
24352435}
24362436/* }}} */
24372437
2438- /* {{{ proto array RedisCluster::info(string key)
2439- * proto array RedisCluster::info(array host_port) */
2438+ /* {{{ proto array RedisCluster::info(string key, [string $arg] )
2439+ * proto array RedisCluster::info(array host_port, [string $arg] ) */
24402440PHP_METHOD (RedisCluster , info ) {
2441- cluster_empty_node_cmd (INTERNAL_FUNCTION_PARAM_PASSTHRU , "INFO" ,
2442- TYPE_BULK , cluster_info_resp );
2441+ redisCluster * c = GET_CONTEXT ();
2442+ char * cmd , * opt = NULL ;
2443+ int cmd_len , opt_len ;
2444+ zval * z_arg ;
2445+ short slot ;
2446+
2447+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "zs" , & z_arg , & opt ,
2448+ & opt_len )== FAILURE )
2449+ {
2450+ RETURN_FALSE ;
2451+ }
2452+
2453+ slot = cluster_cmd_get_slot (c , z_arg );
2454+ if (slot < 0 ) {
2455+ RETURN_FALSE ;
2456+ }
2457+
2458+ if (opt != NULL ) {
2459+ cmd_len = redis_cmd_format_static (& cmd , "INFO" , "s" , opt , opt_len );
2460+ } else {
2461+ cmd_len = redis_cmd_format_static (& cmd , "INFO" , "" );
2462+ }
2463+
2464+ if (cluster_send_slot (c , slot , cmd , cmd_len , TYPE_BULK TSRMLS_CC )< 0 ) {
2465+ zend_throw_exception (redis_cluster_exception_ce ,
2466+ "Unable to send INFO command to spacific node" , 0 TSRMLS_CC );
2467+ efree (cmd );
2468+ RETURN_FALSE ;
2469+ }
2470+
2471+ cluster_info_resp (INTERNAL_FUNCTION_PARAM_PASSTHRU , c , NULL );
2472+
2473+ efree (cmd );
24432474}
24442475/* }}} */
24452476
0 commit comments