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

5 lines
1.3 KiB
PHP

<?php
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';$p=json_decode(file_get_contents($s['root'].'/document-math-backup-pointer.json'),true);$before=json_decode(file_get_contents($p['root'].'/preservation-private.json'),true);$checks=[];foreach(['host'=>$host,'native'=>$native]as$name=>$db)foreach($before[$name]as$table=>$json){$rows=json_decode($json,true);$after=$db->table($table)->whereIn('id',array_column($rows,'id'))->orderBy('id')->get()->toJson();if($after!==$json)throw new LogicException('Original table changed '.$table);if(!in_array($table,['fr_calculations','fr_commands'],true)&&$db->table($table)->count()!==count($rows))throw new LogicException('Unexpected domain append '.$table);$checks[]=$name.'.'.$table;}
if(hash_file('sha256',$s['root'].'/binding.json')!==$before['binding'])throw new LogicException('Original binding changed');
file_put_contents($work.'/document-math-preservation.json',json_encode(['passed'=>true,'identical_original_tables'=>$checks,'journals'=>27,'new_grants'=>0,'native_writes'=>0,'six_protected_records'=>'No connections or commands target protected databases/records','blocked_cache'=>'No clear/delete','new_demo'=>false],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'proof'=>$work.'/document-math-preservation.json']).PHP_EOL;