<?php
function newRows(){return ['user_disease'=>readNative('AI','SELECT * FROM yoshop_user_disease WHERE user_id=? ORDER BY id',[actor()['user_id']]),'habit'=>readNative('AI','SELECT * FROM yoshop_habit WHERE staff_id=? ORDER BY id',[actor()['staff_id']]),'user_other_info'=>readNative('AI','SELECT * FROM yoshop_user_other_info WHERE user_id=? ORDER BY id',[actor()['user_id']])];}
function weightProtect(){global $runtime;$rows=ownRows();ck($rows===json_decode(file_get_contents($runtime.'/weight-baseline.json'),true),'All sealed own Weight9 fullrows unchanged');$old=protect();return ['weight9'=>$rows,'old'=>$old];}
function relatedHashes(){global $runtime;$out=[];foreach(['user_disease'=>['user_id',actor()['user_id']],'habit'=>['staff_id',actor()['staff_id']],'user_other_info'=>['user_id',actor()['user_id']]] as $t=>[$key,$id]){$rows=readNative('AI','SELECT * FROM yoshop_'.$t.' WHERE ('.$key.'<>? OR '.$key.' IS NULL) ORDER BY id',[$id],true);$out[$t]=['count'=>count($rows),'sha256'=>hash('sha256',json_encode($rows,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_PRESERVE_ZERO_FRACTION))];}return $out;}
