Files
SGF/scripts/sgf-install-iva.php
T
2026-11-11 09:00:17 +02:00

5 lines
2.3 KiB
PHP

<?php
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';$proof=$run['root'].'/private/receipt-composition-b4093c6f6707/single-integration/20261110-183923-8c78d580/iva-result.json';$concurrency=$run['root'].'/private/receipt-composition-b4093c6f6707/iva-concurrency-validated/result.json';foreach([$proof,$concurrency]as$file)if((json_decode(file_get_contents($file),true)['passed']??false)!==true)throw new LogicException('Require valid affected proofs');if(!is_file($s['root'].'/iva-backup-pointer.json')||!is_file($s['root'].'/fiscal-binding.json')||!$host->getSchemaBuilder()->hasTable('fx_versions'))throw new LogicException('Backup and authorized setup required');
$files=['app/Modules/Services/FiscalCoverage.php','app/Modules/Services/FiscalAssessment.php','app/Modules/Services/Http/FiscalAssessmentController.php','app/Shared/Context/ModuleNavigation.php','app/Modules/Identity/Services/IdentityWorkflow.php','routes/web.php','resources/views/fiscal/workspace.blade.php','public/sgf-iva.mjs'];foreach($files as$file)if(str_ends_with($file,'.php'))(new Symfony\Component\Process\Process([PHP_BINARY,'-l',$repo.'/'.$file]))->mustRun();$build=$run['root'].'/private/single-iva-build-20261110';if(!is_file($build.'/manifest.json'))throw new LogicException('Private build required');
$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);$config=$work.'/fiscal_qa.php';file_put_contents($config,"<?php\nreturn ".var_export(['enabled'=>true,'binding_sha256'=>hash_file('sha256',$s['root'].'/fiscal-binding.json')],true).";\n");$copy($config,'config/fiscal_qa.php');foreach(glob($build.'/assets/*')as$file)$copy($file,'public/build/assets/'.basename($file));$copy($build.'/manifest.json','public/build/manifest.json');file_put_contents($work.'/iva-installation.json',json_encode(['passed'=>true,'hashes'=>$hashes,'new_demo'=>false,'cache_cleared'=>false,'native_writes'=>0],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'proof'=>$work.'/iva-installation.json']).PHP_EOL;