10 lines
4.2 KiB
PHP
10 lines
4.2 KiB
PHP
<?php
|
|
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';
|
|
foreach([$s['root'].'/fiscal-map-download-proof-20261111.json',$s['root'].'/statements-download-proof-20261111.json',$s['root'].'/statements-ui-20261111.json',$run['root'].'/private/receipt-composition-b4093c6f6707/single-integration/20261111-055742-599ba3f2/statements-result.json',$run['root'].'/private/receipt-composition-b4093c6f6707/single-integration/20261111-060256-39e5bc78/statements-boundaries.json',$run['root'].'/private/receipt-composition-b4093c6f6707/statements-concurrency-1794369694260/result.json']as$file)if((json_decode(file_get_contents($file),true)['passed']??false)!==true)throw new LogicException('Affected proofs required');
|
|
$previous=json_decode(file_get_contents($s['root'].'/single-integration/20261110-224624-16075a70/fiscal-obligations-preservation.json'),true);$qualified=array_unique(array_merge($previous['identical_original_tables'],$previous['original_rows_preserved_with_authorized_append'],['native.pd_due_meta','native.pd_due_versions','native.pd_due_commands','host.fo_meta','host.fo_versions','host.fo_commands','native.fs_meta','native.fs_versions','native.fs_results','native.fs_result_lines','native.fs_commands']));$before=[];$order=fn($table)=>in_array($table,['sr_outbox','sr_deliveries'],true)?'event_id':(in_array($table,['sc_catalogue_meta','pd_due_meta','fo_meta','fs_meta'],true)?'policy':(in_array($table,['fs_results','fs_result_lines'],true)?'snapshot_key':'id'));foreach($qualified as$key){[$name,$table]=explode('.',$key);$db=$name==='host'?$host:$native;$before[$name][$table]=$db->table($table)->orderBy($order($table))->get()->toJson();}$binding=hash_file('sha256',$s['root'].'/binding.json');file_put_contents($work.'/preservation-private.json',json_encode($before));
|
|
$files=['routes/web.php','app/Modules/Accounting/InternalStatementsController.php','app/Modules/Accounting/InternalStatementTotals.php','app/Modules/Identity/Services/IdentityWorkflow.php','resources/js/app.jsx','resources/js/WorkspaceNavigation.jsx','resources/js/InternalStatementsWorkspace.jsx','resources/js/internal-statements-view.js','resources/js/statement-download.js','resources/js/FiscalObligationsWorkspace.jsx','database/sql/internal_statements.sql'];foreach($files as$file)if(str_ends_with($file,'.php'))(new Symfony\Component\Process\Process([PHP_BINARY,'-l',$repo.'/'.$file]))->mustRun();$hashes=[];$copy=function($src,$file)use($s,$work,&$hashes){$dest=$s['app'].'/'.$file;$backup=$work.'/before/'.$file;if(is_file($dest)){if(!is_dir(dirname($backup)))mkdir(dirname($backup),0700,true);copy($dest,$backup);}if(!is_dir(dirname($dest)))mkdir(dirname($dest),0700,true);copy($src,$dest);$hashes[$file]=hash_file('sha256',$dest);};foreach($files as$file)$copy($repo.'/'.$file,$file);
|
|
$cfg=$work.'/internal_statements.php';file_put_contents($cfg,"<?php\nreturn ".var_export(['enabled'=>true,'schema_sha256'=>hash_file('sha256',$repo.'/database/sql/internal_statements.sql')],true).";\n");$copy($cfg,'config/internal_statements.php');
|
|
$build=$run['root'].'/private/single-statements-build-20261111';$manifest=json_decode(file_get_contents($build.'/manifest.json'),true);$assets=[];foreach($manifest as$entry){$assets[]=$entry['file'];foreach($entry['css']??[]as$file)$assets[]=$file;}foreach(array_unique($assets)as$file){if(!preg_match('~^assets/[a-zA-Z0-9_.-]+$~D',$file))throw new LogicException('Asset path invalid');$copy($build.'/'.$file,'public/build/'.$file);}$copy($build.'/manifest.json','public/build/manifest.json');
|
|
$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');file_put_contents($work.'/statements-installation.json',json_encode(['passed'=>true,'hashes'=>$hashes,'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.'/statements-installation.json']).PHP_EOL;
|
|
|