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

12 lines
2.7 KiB
PHP

<?php
use Symfony\Component\Process\Process;
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';$pins=json_decode(file_get_contents($s['root'].'/single-binding-pins.json'),true);
$files=['app/Shared/Installation/PresentationEntry.php','resources/views/sgf-presentation-entry.blade.php','app/Modules/Inventory/StockFinalController.php','app/Modules/Purchasing/ReceiptRuntime.php','app/Modules/Identity/Services/IdentityWorkflow.php','app/Shared/Context/ModuleNavigation.php','app/Modules/Accounting/ComposedLedgerCandidates.php','routes/web.php','resources/views/stock-final-workspace.blade.php','resources/views/accounting/composed-ledger.blade.php','public/sgf-stock-final.mjs','public/sgf-entry-menu.mjs','packages/general-ledger/bootstrap.php','packages/general-ledger/src/StockTransitEvidence.php','packages/general-ledger/src/StockValuation.php','packages/general-ledger/src/PayableJournal.php','packages/general-ledger/src/LedgerCycle.php'];
$hashes=[];$copy=function($source,$relative)use($s,$work,&$hashes){$target=$s['app'].'/'.$relative;$backup=$work.'/before/'.$relative;if(is_file($target)){if(!is_dir(dirname($backup)))mkdir(dirname($backup),0700,true);copy($target,$backup);}if(!is_dir(dirname($target)))mkdir(dirname($target),0700,true);copy($source,$target);$hashes[$relative]=hash_file('sha256',$target);};
foreach($files as $file)if(str_ends_with($file,'.php')&&!str_ends_with($file,'.blade.php'))(new Process([PHP_BINARY,'-l',$repo.'/'.$file]))->mustRun();
foreach($files as $file)$copy($repo.'/'.$file,$file);
$build=$run['root'].'/private/single-stock-final-ui-build-20261110';if(!is_file($build.'/manifest.json'))throw new LogicException('Build required');foreach(glob($build.'/assets/*') as $file)$copy($file,'public/build/assets/'.basename($file));$copy($build.'/manifest.json','public/build/manifest.json');
$single=require $s['app'].'/config/sgf_single_installation.php';$single['bindings_sha256']=$pins['single-bindings.json'];$single['material_perimeter_sha256']=hash_file('sha256',$s['root'].'/single-material-perimeter.json');
foreach(['sgf_single_installation'=>$single,'stock_operations'=>['enabled'=>true,'profile_sha256'=>$pins['stock-operations-binding.json'],'final_enabled'=>true,'final_sha256'=>$pins['stock-final-binding.json']]] as $name=>$values){$file=$work.'/'.$name.'.php';file_put_contents($file,"<?php\nreturn ".var_export($values,true).";\n");$copy($file,'config/'.$name.'.php');}
file_put_contents($work.'/stock-final-installation.json',json_encode(['passed'=>true,'source_hashes'=>$hashes,'same_installation'=>$tag,'frozen_native_bundle_changed'=>false,'cache_cleared'=>false,'new_demo'=>false,'sgc_enabled'=>false],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'files'=>count($hashes),'proof'=>$work.'/stock-final-installation.json']).PHP_EOL;