16 @date_default_timezone_set(@date_default_timezone_get());
18 require_once
'../inc/manager.inc.php';
20 if(php_sapi_name()!==
'cli' || !
defined(
'STDIN')){
21 echo
'Only cli execution mode supported'.PHP_EOL;
27 if(!isset(
$args[
'host']) || empty(
$args[
'host'])){
28 $args[
'host']=
'localhost';
31 $h=explode(
',',
$args[
'host']);
32 foreach($h as $key=>$hs){
37 $args[
'host']=implode(
',', $h);
40 if(!isset(
$args[
'port']) || empty(
$args[
'port'])){
41 $args[
'port']=HCE_CLUSTER_SCHEMA_PORTS_DEFAULT;
44 $h=explode(
',',
$args[
'port']);
45 foreach($h as $key=>$hs){
47 if($hs==
'' || !is_numeric($hs) || ($hs+0)==0){
51 $args[
'port']=implode(
',', $h);
54 if(!isset(
$args[
'timeout']) || empty(
$args[
'timeout'])){
55 $args[
'timeout']=HCE_CLUSTER_CMD_TIMEOUT;
62 if(!isset(
$args[
'scan']) || empty(
$args[
'scan'])){
66 if(!isset(
$args[
'ignore']) || empty(
$args[
'ignore'])){
70 if(!isset(
$args[
'tformat']) || empty(
$args[
'tformat'])){
71 $args[
'tformat']=null;
82 switch(
$args[
'command']){
83 case HCE_SPHINX_CMD_INDEX_CONNECT :
84 case HCE_SPHINX_CMD_INDEX_DISCONNECT :
85 case HCE_SPHINX_CMD_INDEX_DATA_LIST :
86 case HCE_SPHINX_CMD_INDEX_STATUS_SEARCHD :
87 case HCE_SPHINX_CMD_INDEX_STATUS :
88 case HCE_SPHINX_CMD_INDEX_MAX_DOC_ID :
89 case HCE_SPHINX_CMD_INDEX_REMOVE :
90 case HCE_SPHINX_CMD_INDEX_DELETE_DOC_NUMBER :
91 case HCE_SPHINX_CMD_INDEX_CHECK :
92 case HCE_SPHINX_CMD_INDEX_START :
93 case HCE_SPHINX_CMD_INDEX_STOP :
94 case HCE_SPHINX_CMD_INDEX_DELETE_SCHEMA_FILE:
95 case HCE_SPHINX_CMD_INDEX_CREATE : {
96 if(!isset(
$args[
'name'])){
103 case HCE_SPHINX_CMD_INDEX_APPEND_DATA_FILE :
104 case HCE_SPHINX_CMD_INDEX_STORE_DATA_FILE : {
105 if(!isset(
$args[
'name'])){
110 if(!isset(
$args[
'branch'])){
111 $aborted.=
'--branch=<branch_name> ';
115 if(!isset(
$args[
'data'])){
118 if(!file_exists(
$args[
'data'])){
119 $aborted.=
'file '.$args[
'data'].
' ';
121 if(SPHINX_JSON_USE_BASE64){
130 case HCE_SPHINX_CMD_INDEX_STORE_SCHEMA_FILE : {
131 if(!isset(
$args[
'name'])){
136 if(!isset(
$args[
'data'])){
139 if(!file_exists(
$args[
'data'])){
140 $aborted.=
'file '.$args[
'data'].
' ';
142 if(SPHINX_JSON_USE_BASE64){
151 case HCE_SPHINX_CMD_INDEX_PACK_DOC_DATA :
152 case HCE_SPHINX_CMD_INDEX_MERGE :
153 case HCE_SPHINX_CMD_INDEX_DELETE_DATA_FILE :
154 case HCE_SPHINX_CMD_INDEX_REBUILD : {
155 if(!isset(
$args[
'name'])){
160 if(!isset(
$args[
'branches'])){
161 $aborted.=
'--branches=<branches_list_csv> ';
167 case HCE_SPHINX_CMD_INDEX_DELETE_DOC : {
168 if(!isset(
$args[
'name'])){
173 if(!isset(
$args[
'documents'])){
174 $aborted.=
'--documents=<documents_list_csv> ';
180 case HCE_SPHINX_CMD_INDEX_RENAME :
181 case HCE_SPHINX_CMD_INDEX_COPY : {
182 if(!isset(
$args[
'from'])){
187 if(!isset(
$args[
'to'])){
194 case HCE_SPHINX_CMD_INDEX_SET_CONFIG_VAR : {
195 if(!isset(
$args[
'index'])){
200 if(!isset(
$args[
'type'])){
205 if(!isset(
$args[
'section'])){
206 $aborted=
'--section=<section_name> ';
210 if(!isset(
$args[
'parameter'])){
211 $aborted.=
'--parameter=<parameter_name> ';
215 if(!isset(
$args[
'value'])){
216 $aborted.=
'--value=<parameter_value> ';
222 case HCE_CLUSTER_CMD_STRUCTURE_CHECK : {
223 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
224 $aborted=
'--host and --port must to list the same number of items if --scan=1';
226 if(!isset(
$args[
'name'])){
230 if($r[
'error_code']==0){
233 if(
$args[
'log'] & 1 > 0){
234 echo $r[
'error_message'];
242 case HCE_CLUSTER_CMD_NODE_SHUTDOWN : {
243 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
244 $aborted=
'--host and --port must to list the same number of items if --scan=1';
252 case HCE_CLUSTER_CMD_NODE_MMGET : {
253 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
254 $aborted=
'--host and --port must to list the same number of items if --scan=1';
264 case HCE_CLUSTER_CMD_NODE_MMSET : {
265 $modes=array(
'smanager'=>0,
'rmanager'=>1,
'rmanager-rnd'=>4,
'rmanager-resources-usage'=>5);
266 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
267 $aborted=
'--host and --port must to list the same number of items if --scan=1';
268 }
else if(!isset(
$args[
'mode']) || !array_key_exists(
$args[
'mode'], $modes)){
269 $aborted=
'--mode must be set as "smanager", "rmanager", "rmanager-rnd" or "rmanager-resources-usage"';
279 case HCE_CLUSTER_CMD_NODE_MPMGET : {
280 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
281 $aborted=
'--host and --port must to list the same number of items if --scan=1';
291 case HCE_CLUSTER_CMD_NODE_MPMSET : {
292 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
293 $aborted=
'--host and --port must to list the same number of items if --scan=1';
294 }
else if(!isset(
$args[
'purge'])) {
295 $aborted=
'--purge must be set as "1" or "0"';
305 case HCE_CLUSTER_CMD_NODE_MRCSGET : {
306 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
307 $aborted=
'--host and --port must to list the same number of items if --scan=1';
315 case HCE_CLUSTER_CMD_NODE_MRCSSET : {
316 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
317 $aborted=
'--host and --port must to list the same number of items if --scan=1';
318 }
else if(!isset(
$args[
'csize'])) {
319 $aborted=
'--csize must be set as numeric value, "0" - unlimited size';
327 case HCE_CLUSTER_CMD_NODE_TIME :
328 case HCE_CLUSTER_CMD_NODE_ECHO : {
330 $manager_to_hce_commands_map=array(HCE_CLUSTER_CMD_NODE_TIME=>HCE_CMD_TIME, HCE_CLUSTER_CMD_NODE_ECHO=>HCE_CMD_ECHO);
332 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
333 $aborted=
'--host and --port must to list the same number of items if --scan=1';
336 foreach($nodes as $node_key=>$node_data){
337 if(isset($node_data[HCE_HANDLER_ADMIN])){
339 if($properties!==
false){
340 if($args[
'command']==HCE_CLUSTER_CMD_NODE_PROPERTIES){
341 $properties[HCE_CLUSTER_CMD_PROPERTIES_FIELD_TIME]=date(HCE_CLUSTER_CMD_DATE_FORMAT, round($properties[HCE_CLUSTER_CMD_PROPERTIES_FIELD_TIME]/1000));
342 $properties[HCE_CLUSTER_CMD_PROPERTIES_FIELD_NAME]=$properties[HCE_CLUSTER_CMD_PROPERTIES_FIELD_CIDENTITY];
343 unset($properties[HCE_CLUSTER_CMD_PROPERTIES_FIELD_CIDENTITY]);
345 $nodes[$node_key]=$properties;
354 case HCE_CLUSTER_CMD_NODE_LLGET :
355 case HCE_CLUSTER_CMD_NODE_LLSET :
356 case HCE_CLUSTER_CMD_NODE_PROPERTIES :
357 case HCE_CMD_NODE_RESOURCE_USAGE :
358 case HCE_CLUSTER_CMD_NODE_HB_DELAY_GET :
359 case HCE_CLUSTER_CMD_NODE_HB_DELAY_SET :
360 case HCE_CLUSTER_CMD_NODE_HB_TIMEOUT_GET :
361 case HCE_CLUSTER_CMD_NODE_HB_TIMEOUT_SET :
362 case HCE_CLUSTER_CMD_NODE_HB_MODE_GET :
363 case HCE_CLUSTER_CMD_NODE_HB_MODE_SET :
364 case HCE_CLUSTER_CMD_NODE_POLL_TIMEOUT_GET:
365 case HCE_CLUSTER_CMD_NODE_POLL_TIMEOUT_SET:
366 case HCE_CLUSTER_CMD_NODE_PROPERTY_INTERVAL_GET:
367 case HCE_CLUSTER_CMD_NODE_PROPERTY_INTERVAL_SET:
368 case HCE_CLUSTER_CMD_NODE_DUMP_INTERVAL_GET:
369 case HCE_CLUSTER_CMD_NODE_DUMP_INTERVAL_SET: {
370 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
371 $aborted=
'--host and --port must to list the same number of items if --scan=1 ';
374 if(!isset(
$args[
'handler'])){
375 $aborted=
'--handler=<handler_name{ADMIN,ROUTERSERVER_PROXY,DATASERVER_PROXY,DATA_CLIENT_PROXY,DATAPROCESSOR_DATA,DATACLIENT_DATA,DATAREDUCER_PROXY,*}> ';
378 if(
$args[
'command']==HCE_CLUSTER_CMD_NODE_LLSET && !isset(
$args[
'level'])){
379 $aborted=
'--level=<level(s)_value_csv> ';
383 $handlers=array(HCE_HANDLER_ADMIN, HCE_HANDLER_ROUTER_SERVER_PROXY, HCE_HANDLER_DATA_SERVER_PROXY, HCE_HANDLER_DATA_CLIENT_PROXY, HCE_HANDLER_DATA_PROCESSOR_DATA,
384 HCE_HANDLER_DATA_CLIENT_DATA, HCE_HANDLER_DATA_REDUCER_PROXY);
385 $handlers_list=explode(
',',
$args[
'handler']);
387 if($handlers_list[0]==
'*'){
388 $handlers_list=$handlers;
391 if(
$args[
'command']==HCE_CLUSTER_CMD_NODE_LLSET){
392 $levels_list=explode(
',',
$args[
'level']);
393 if((count($levels_list)>count($handlers_list)) ||
394 ((count($handlers_list)>1) && (count($levels_list)>1) && (count($levels_list)!=count($handlers_list)))
396 $aborted=
'handler and level value mismatch by items number, --handler and --level > ';
400 if(count($levels_list)==1 && count($handlers_list)>1){
401 for($i=0; $i<count($handlers_list)-1; $i++){
402 $levels_list[]=$levels_list[0];
406 $levels_list=array();
408 foreach($handlers_list as $handler_item){
409 if(!in_array($handler_item, $handlers)){
410 $aborted=
'Handler name "'.$handler_item.
'" not supported, --handler ';
415 $mgr_to_hce_cmd_map=array(HCE_CLUSTER_CMD_NODE_LLSET=>HCE_CMD_LLSET, HCE_CLUSTER_CMD_NODE_LLGET=>HCE_CMD_LLGET,
416 HCE_CLUSTER_CMD_NODE_PROPERTIES=>HCE_CMD_PROPERTIES, HCE_CLUSTER_CMD_NODE_RESOURCE_USAGE=>HCE_CMD_NODE_RESOURCE_USAGE,
417 HCE_CLUSTER_CMD_NODE_HB_DELAY_SET=>HCE_CMD_HEARTBEAT_DELAY_SET, HCE_CLUSTER_CMD_NODE_HB_DELAY_GET=>HCE_CMD_HEARTBEAT_DELAY_GET,
418 HCE_CLUSTER_CMD_NODE_HB_TIMEOUT_SET=>HCE_CMD_HEARTBEAT_TIMEOUT_SET, HCE_CLUSTER_CMD_NODE_HB_TIMEOUT_GET=>HCE_CMD_HEARTBEAT_TIMEOUT_GET,
419 HCE_CLUSTER_CMD_NODE_HB_MODE_SET=>HCE_CMD_HEARTBEAT_MODE_SET, HCE_CLUSTER_CMD_NODE_HB_MODE_GET=>HCE_CMD_HEARTBEAT_MODE_GET,
420 HCE_CLUSTER_CMD_NODE_POLL_TIMEOUT_SET=>HCE_CMD_POLL_TIMEOUT_SET, HCE_CLUSTER_CMD_NODE_POLL_TIMEOUT_GET=>HCE_CMD_POLL_TIMEOUT_GET,
421 HCE_CLUSTER_CMD_NODE_PROPERTY_INTERVAL_SET=>HCE_CMD_PROPERTY_INTERVAL_SET, HCE_CLUSTER_CMD_NODE_PROPERTY_INTERVAL_GET=>HCE_CMD_PROPERTY_INTERVAL_GET,
422 HCE_CLUSTER_CMD_NODE_DUMP_INTERVAL_SET=>HCE_CMD_DUMP_INTERVAL_SET, HCE_CLUSTER_CMD_NODE_DUMP_INTERVAL_GET=>HCE_CMD_DUMP_INTERVAL_GET);
428 foreach($node_info as $node=>$node_data){
430 for($i=0; $i<count($handlers_list); $i++){
431 if($node_data[
'error']==0 && isset($node_data[
'data'][$handlers_list[$i]])){
434 if($properties!==
false){
437 switch (
$args[
'command']){
438 case HCE_CLUSTER_CMD_NODE_LLSET:
439 $param_value=$levels_list[$i];
441 case HCE_CLUSTER_CMD_NODE_HB_DELAY_SET:{
442 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
443 $aborted=
'--host and --port must to list the same number of items if --scan=1';
444 }
else if(!isset(
$args[
'hbdelay'])) {
445 $aborted=
'--hbdelay must be set im sec';
447 $param_value=
$args[
'hbdelay'];
451 case HCE_CLUSTER_CMD_NODE_HB_TIMEOUT_SET:{
452 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
453 $aborted=
'--host and --port must to list the same number of items if --scan=1';
454 }
else if(!isset(
$args[
'hbtimeout'])) {
455 $aborted=
'--hbtimeout must be set in sec';
457 $param_value=
$args[
'hbtimeout'];
461 case HCE_CLUSTER_CMD_NODE_HB_MODE_SET:{
462 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
463 $aborted=
'--host and --port must to list the same number of items if --scan=1';
464 }
else if(!isset(
$args[
'hbmode'])) {
465 $aborted=
'--hbmode must be set in numeric value';
467 $param_value=
$args[
'hbmode'];
471 case HCE_CLUSTER_CMD_NODE_POLL_TIMEOUT_SET:{
472 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
473 $aborted=
'--host and --port must to list the same number of items if --scan=1';
474 }
else if(!isset(
$args[
'ptimeout'])) {
475 $aborted=
'--ptimeout must be set in numeric value';
477 $param_value=
$args[
'ptimeout'];
481 case HCE_CLUSTER_CMD_NODE_PROPERTY_INTERVAL_SET:{
482 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
483 $aborted=
'--host and --port must to list the same number of items if --scan=1';
484 }
else if(!isset(
$args[
'interval'])) {
485 $aborted=
'--interval must be set in numeric value';
487 $param_value=
$args[
'interval'];
491 case HCE_CLUSTER_CMD_NODE_DUMP_INTERVAL_SET:{
492 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
493 $aborted=
'--host and --port must to list the same number of items if --scan=1';
494 }
else if(!isset(
$args[
'interval'])) {
495 $aborted=
'--interval must be set in numeric value';
497 $param_value=
$args[
'interval'];
501 case HCE_CLUSTER_CMD_NODE_PROPERTIES:{
502 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
503 $aborted=
'--host and --port must to list the same number of items if --scan=1';
505 if(isset(
$args[
'realtime'])) {
506 $param_value=
$args[
'realtime'];
517 $param_value, $args[
'timeout']);
518 if($ret[$node][$handlers_list[$i]][
'error']==0){
521 if(isset($properties[
'clients'])) {
522 $properties[
'clients'] = json_decode($properties[
'clients'],
true);
524 if(is_array($properties[
'clients'][
'clients']) && $args[
'tformat']!==null){
526 foreach($properties[
'clients'][
'clients'] as $key=>$client){
527 if(is_array($client)){
528 $properties[
'clients'][
'clients'][$key][
'expiry']=date($args[
'tformat'], ceil($client[
'expiry']/1000));
534 if($properties!==
false){
535 if($args[
'command']==HCE_CLUSTER_CMD_NODE_PROPERTIES){
537 if(isset($args[
'sphinx_properties_formatted']) && $args[
'sphinx_properties_formatted']==
'yes' && isset($properties[
'sphinxDataStorageProperties'])){
538 $props=explode(
',', $properties[
'sphinxDataStorageProperties']);
539 $properties[
'sphinxDataStorageProperties']=array();
540 foreach($props as $value){
541 $props2=explode(
':', $value);
543 if($props2[0]==
'ranker_expression'){
544 $properties[
'sphinxDataStorageProperties'][$props2[0]]=rawurldecode($props2[1]);
546 $properties[
'sphinxDataStorageProperties'][$props2[0]]=$props2[1];
551 if(isset($args[
'sphinx_properties_formatted']) && $args[
'sphinx_properties_formatted']==
'yes' && isset($properties[
'drceDataStorageProperties'])){
552 $props=explode(
',', $properties[
'drceDataStorageProperties']);
553 $properties[
'drceDataStorageProperties']=array();
554 foreach($props as $value){
555 $props2=explode(
':', $value);
556 $properties[
'drceDataStorageProperties'][$props2[0]]=$props2[1];
559 $ret[$node][$handlers_list[$i]]=$properties;
561 if(isset($properties[HCE_CLUSTER_CMD_PROPERTY_NAME_LOG])){
562 $ret[$node][$handlers_list[$i]]=$properties[HCE_CLUSTER_CMD_PROPERTY_NAME_LOG];
572 $ret[$node][$handlers_list[$i]]=
'Error : '.$ret[$node][$handlers_list[$i]][
'error'];
578 $ret[$node][$handlers_list[$i]]=
'Error : Node not found at '.$node.
' or connection timeout.';
587 case HCE_CLUSTER_CMD_NODE_DRCE : {
588 require_once
'../inc/hce_drce_api.inc.php';
589 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
590 $aborted=
'--host and --port must to list the same number of items if --scan=1';
592 if(!isset(
$args[
'request']) || !isset(
$args[
'id']) || !isset(
$args[
'json'])){
593 $aborted=
'--request, --json and --id is mandatory options for this command!';
597 $requests_names=array(
'SET'=>HCE_DRCE_REQUEST_TYPE_SET,
'CHECK'=>HCE_DRCE_REQUEST_TYPE_CHECK,
'TERMINATE'=>HCE_DRCE_REQUEST_TYPE_TERMINATE,
'GET'=>HCE_DRCE_REQUEST_TYPE_GET,
'DELETE'=>HCE_DRCE_REQUEST_TYPE_DELETE);
599 echo
'Error: --request not supported "'.$REQUEST_TYPE.
'"'.PHP_EOL;
604 $REQUEST_ID=isset(
$args[
'id']) ?
$args[
'id'] : 0;
606 echo
'Error: this --request required --id value greater than zero'.PHP_EOL;
614 $input_json=trim(file_get_contents(
$args[
'json']));
616 echo
'Input file json: "'.$input_json.
'"'.PHP_EOL;
620 echo
'Parameters array: "'.var_export($params_array, TRUE).
'"'.PHP_EOL;
624 echo
'DRCE reques json: "'.$parameters.
'"'.PHP_EOL.PHP_EOL;
628 foreach($nodes as $node_key=>$node_data){
629 if(isset($node_data[HCE_HANDLER_DATA_PROCESSOR_DATA])){
630 $node_data[HCE_HANDLER_DATA_PROCESSOR_DATA]=explode(HCE_ADMIN_CMD_DELIMITER, $node_data[HCE_HANDLER_DATA_PROCESSOR_DATA]);
631 if(isset($node_data[HCE_HANDLER_DATA_PROCESSOR_DATA][1])){
632 $node_data[HCE_HANDLER_DATA_PROCESSOR_DATA][1]=json_decode($node_data[HCE_HANDLER_DATA_PROCESSOR_DATA][1],
true);
633 $node_data[HCE_HANDLER_DATA_PROCESSOR_DATA][1][0][
'stdout']=base64_decode($node_data[HCE_HANDLER_DATA_PROCESSOR_DATA][1][0][
'stdout']);
634 $node_data[HCE_HANDLER_DATA_PROCESSOR_DATA][1][0][
'stderror']=base64_decode($node_data[HCE_HANDLER_DATA_PROCESSOR_DATA][1][0][
'stderror']);
636 $nodes[$node_key]=$node_data[HCE_HANDLER_DATA_PROCESSOR_DATA];
645 case HCE_CMD_DRCE_SET_HOST : {
646 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
647 $aborted=
'--host and --port must to list the same number of items if --scan=1';
648 }
else if(!isset(
$args[
'host'])){
649 $aborted=
'--host must be set value different from zero';
657 case HCE_CMD_DRCE_GET_HOST : {
658 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
659 $aborted=
'--host and --port must to list the same number of items if --scan=1';
667 case HCE_CMD_DRCE_SET_PORT : {
668 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
669 $aborted=
'--host and --port must to list the same number of items if --scan=1';
670 }
else if(!isset(
$args[
'port'])){
671 $aborted=
'--port must be set value different from zero';
679 case HCE_CMD_DRCE_GET_PORT : {
680 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
681 $aborted=
'--host and --port must to list the same number of items if --scan=1';
689 case HCE_CMD_DRCE_GET_TASKS : {
690 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
691 $aborted=
'--host and --port must to list the same number of items if --scan=1';
699 case HCE_CMD_DRCE_GET_TASKS_INFO : {
700 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
701 $aborted=
'--host and --port must to list the same number of items if --scan=1';
709 case HCE_CMD_NODE_RECOVER_NOTIFICATION_CONNECTION : {
710 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
711 $aborted=
'--host and --port must to list the same number of items if --scan=1';
719 case HCE_CMD_NODE_ROUTES : {
720 if(
$args[
'scan']==1 && count($hosts)!=count($ports)){
721 $aborted=
'--host and --port must to list the same number of items if --scan=1';
730 $aborted=
'command "'.$args[
'command'].
'" not supported';
737 if($connection_array[
'error']==0){
740 echo
'Error of command execution '.$ret.PHP_EOL;
742 case HCE_PROTOCOL_ERROR_TIMEOUT : {
743 echo
'Timeout '.$args[
'timeout'].
' ms, or connection error!'.PHP_EOL;
746 case HCE_SPHINX_ERROR_PARSE_RESPONSE : {
747 echo
'Wrong response format!'.PHP_EOL;
752 echo
'Command executed '.PHP_EOL;
753 if($ret[
'error_code']!=HCE_SPHINX_ERROR_OK){
754 echo
'Returned error '.$ret[
'error_code'].
' : '.$ret[
'error_message'].PHP_EOL;
755 if(!empty($ret[
'data'])){
756 if(SPHINX_JSON_USE_BASE64){
757 echo
'data: '.base64_decode($ret[
'data']).PHP_EOL;
759 echo
'data: '.$ret[
'data'].PHP_EOL;
763 switch(
$args[
'command']){
764 case HCE_SPHINX_CMD_INDEX_DATA_LIST :
765 case HCE_SPHINX_CMD_INDEX_MERGE :
766 case HCE_SPHINX_CMD_INDEX_PACK_DOC_DATA :
767 case HCE_SPHINX_CMD_INDEX_DELETE_DOC_NUMBER :
768 case HCE_SPHINX_CMD_INDEX_STATUS_SEARCHD :
769 case HCE_SPHINX_CMD_INDEX_STATUS :
770 case HCE_SPHINX_CMD_INDEX_MAX_DOC_ID :
771 case HCE_SPHINX_CMD_INDEX_CHECK : {
772 if(SPHINX_JSON_USE_BASE64){
773 echo
'data: '.base64_decode($ret[
'data']).PHP_EOL;
775 echo
'data: '.$ret[
'data'].PHP_EOL;
780 echo
'time: '.$ret[
'time'].
' ms'.PHP_EOL;
784 echo
'Error create acn connection '.$connection_array[
'error'].$ret.PHP_EOL;