<?php
declare(strict_types=1);
$lane=getenv('NF_LANE');$root=getenv('NF_ROOT');$out=['lane'=>$lane,'DB_connections'=>0];
$out['constants_before']=['TP_ENV'=>defined('TP_ENV'),'BUSINESS'=>defined('BUSINESS')];
$path=$root.'/application/database.php';$source=file_get_contents($path);
preg_match_all('/getenv\s*\(\s*[\'"]([A-Z_][A-Z0-9_]*)[\'"]/',$source,$m);
$out['getenv_names_in_entry']=array_values(array_unique($m[1]));
$out['entry_mentions']=['TP_ENV'=>strpos($source,'TP_ENV')!==false,'BUSINESS'=>strpos($source,'BUSINESS')!==false,'config_local'=>strpos($source,'config/local')!==false];
$cfg=(static function($p){return require $p;})($path);
$out['config_field_names']=array_keys($cfg);
if($lane==='B'){
 $local=(static function($p){return require $p;})('/workspace/zhct/zhctproject/store/application/config/local/database.php');
 foreach(['hostname','database','username','password','charset','hostport']as $k)$out['scope_equals_local'][$k]=(string)($cfg[$k]??'')===(string)($local[$k]??'');
}else $out['scope_bools']=['loopback'=>($cfg['hostname']??null)==='127.0.0.1','port5237'=>(string)($cfg['hostport']??'')==='5237','schema'=>($cfg['database']??null)==='ZHCT_APP','driver_dm'=>stripos((string)($cfg['type']??''),'dm')!==false];
$out['env_file_exists']=is_file($root.'/env.php');
echo json_encode($out,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE),"\n";
