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

10 lines
2.4 KiB
PHP

<?php
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';
$files=['app/Modules/Inventory/StockCompletionController.php','app/Modules/Purchasing/ReceiptRuntime.php','app/Modules/Accounting/ComposedLedgerCandidates.php','app/Shared/Context/ModuleNavigation.php','app/Modules/Identity/Services/IdentityWorkflow.php','routes/web.php','resources/views/stock-completion-workspace.blade.php','resources/views/accounting/composed-ledger.blade.php','public/sgf-stock-completion.mjs','public/sgf-stock-final.mjs','packages/general-ledger/src/StockValuation.php','packages/general-ledger/src/StockSupplierReturnEvidence.php','packages/general-ledger/src/PayableJournal.php','packages/general-ledger/src/LedgerCycle.php'];$hashes=[];
$copy=function($source,$file)use($s,$work,&$hashes){$target=$s['app'].'/'.$file;$backup=$work.'/before/'.$file;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[$file]=hash_file('sha256',$target);};
foreach($files as $file)if(str_ends_with($file,'.php')&&!str_ends_with($file,'.blade.php'))(new Symfony\Component\Process\Process([PHP_BINARY,'-l',$repo.'/'.$file]))->mustRun();foreach($files as $file)$copy($repo.'/'.$file,$file);
$build=$run['root'].'/private/single-stock-completion-ui-build-20261110';foreach(glob($build.'/assets/*') as $file)$copy($file,'public/build/assets/'.basename($file));$copy($build.'/manifest.json','public/build/manifest.json');
$file=$work.'/stock_completion.php';file_put_contents($file,"<?php\nreturn ".var_export(['enabled'=>true,'binding_sha256'=>hash_file('sha256',$s['root'].'/stock-completion-binding.json')],true).";\n");$copy($file,'config/stock_completion.php');
$config=require $s['app'].'/config/sgf_single_installation.php';$config['material_perimeter_sha256']=hash_file('sha256',$s['root'].'/single-material-perimeter.json');$file=$work.'/sgf_single_installation.php';file_put_contents($file,"<?php\nreturn ".var_export($config,true).";\n");$copy($file,'config/sgf_single_installation.php');
file_put_contents($work.'/stock-completion-installation.json',json_encode(['passed'=>true,'source_hashes'=>$hashes,'installation'=>$tag,'cache_cleared'=>false,'new_demo'=>false],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'proof'=>$work.'/stock-completion-installation.json']).PHP_EOL;