Files
SGF/scripts/sgf-payable-aging-preservation.php
T
2026-11-11 09:00:17 +02:00

6 lines
1.5 KiB
PHP

<?php
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';
$baseline=$s['root'].'/single-integration/20261110-225714-3c10e767';$before=json_decode(file_get_contents($baseline.'/preservation-private.json'),true);$installation=json_decode(file_get_contents($baseline.'/payable-aging-installation.json'),true);$binding=hash_file('sha256',$s['root'].'/binding.json');$order=fn($table)=>in_array($table,['sr_outbox','sr_deliveries'],true)?'event_id':(in_array($table,['sc_catalogue_meta','pd_due_meta','fo_meta'],true)?'policy':'id');
$checks=[];foreach($before as$name=>$tables){$db=$name==='host'?$host:$native;foreach($tables as$table=>$json){if($db->table($table)->orderBy($order($table))->get()->toJson()!==$json)throw new LogicException('Original facts changed '.$table);$checks[]=$name.'.'.$table;}}if($binding!==hash_file('sha256',$s['root'].'/binding.json'))throw new LogicException('Binding changed');foreach($installation['hashes']as$file=>$hash)if(hash_file('sha256',$s['app'].'/'.$file)!==$hash)throw new LogicException('Installed code changed');file_put_contents($work.'/payable-aging-preservation.json',json_encode(['passed'=>true,'installation_proof'=>$baseline.'/payable-aging-installation.json','identical_original_tables'=>$checks,'business_commands'=>0,'new_grants'=>0,'new_demo'=>false,'cache_cleared'=>false,'native_writes'=>0,'binding_unchanged'=>true],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'proof'=>$work.'/payable-aging-preservation.json']).PHP_EOL;