9 lines
4.4 KiB
PHP
9 lines
4.4 KiB
PHP
<?php
|
|
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';$proofs=[$s['root'].'/assets-ui-20261111.json',$run['root'].'/private/receipt-composition-b4093c6f6707/single-integration/20261111-110254-0efa3049/assets-functional.json',$run['root'].'/private/receipt-composition-b4093c6f6707/single-integration/20261111-110545-62635f67/assets-correction.json',$run['root'].'/private/receipt-composition-b4093c6f6707/single-integration/20261111-110916-457253bb/assets-boundaries.json',$run['root'].'/private/receipt-composition-b4093c6f6707/single-integration/20261111-111046-e1ba8857/assets-journal-boundaries.json',$run['root'].'/private/receipt-composition-b4093c6f6707/single-integration/20261111-111227-7b78452d/assets-period.json',$run['root'].'/private/receipt-composition-b4093c6f6707/assets-concurrency-1794388203631/result.json'];foreach($proofs as$file)if((json_decode(file_get_contents($file),true)['passed']??false)!==true)throw new LogicException('Required proof missing');if(!$native->getSchemaBuilder()->hasTable('gl_asset_extension_versions'))throw new LogicException('Explicit setup required');
|
|
$originals=json_decode(file_get_contents(json_decode(file_get_contents($s['root'].'/assets-backup-pointer.json'),true)['root'].'/preservation-private.json'),true);$oldJournals=json_decode($originals['native']['gl_journals'],true);foreach($oldJournals as$j)$native->select('SELECT gl_assert_balanced(?)',[$j['id']]);if(count($oldJournals)!==27)throw new LogicException('Known27 original journals required');
|
|
$files=['routes/web.php','app/Modules/Accounting/AssetDepreciation.php','app/Modules/Accounting/FixedAssets.php','app/Modules/Accounting/FixedAssetsController.php','app/Modules/Accounting/FixedAssetLedgerSource.php','app/Modules/Accounting/FixedAssetJournalController.php','app/Modules/Accounting/ComposedLedger.php','app/Modules/Identity/Services/IdentityWorkflow.php','app/Shared/Context/ModuleNavigation.php','packages/general-ledger/bootstrap.php','packages/general-ledger/src/LedgerAssets.php','packages/general-ledger/src/PayableJournal.php','packages/general-ledger/src/LedgerCycle.php','database/sql/fixed_assets.sql','database/sql/fixed_assets_native.sql','docs/integration/sgf-fixed-assets-access-proposal.json','resources/js/FixedAssetsWorkspace.jsx','resources/js/WorkspaceNavigation.jsx','resources/js/app.jsx'];
|
|
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;if(is_file($dest)){$backup=$work.'/before/'.$file;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);
|
|
$p=json_decode(file_get_contents($repo.'/docs/integration/sgf-fixed-assets-access-proposal.json'),true);$cfg=['enabled'=>true,'schema_sha256'=>hash_file('sha256',$repo.'/database/sql/fixed_assets.sql'),'native_schema_sha256'=>hash_file('sha256',$repo.'/database/sql/fixed_assets_native.sql'),'access_sha256'=>hash('sha256',Tempo\Finance\Payables\Payables::canonical(['scope'=>$p['scope'],'grants'=>$p['grants_per_book']]))];file_put_contents($work.'/fixed_assets.php',"<?php\nreturn ".var_export($cfg,true).";\n");$copy($work.'/fixed_assets.php','config/fixed_assets.php');
|
|
$build=$run['root'].'/private/single-assets-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');
|
|
foreach($originals['files']as$file=>$hash)if(hash_file('sha256',$s['root'].'/'.$file)!==$hash)throw new LogicException('Binding changed');file_put_contents($work.'/assets-installation.json',json_encode(['passed'=>true,'hashes'=>$hashes,'legacy_balanced_journals'=>27,'bindings_unchanged'=>true,'new_business_commands'=>0,'cache_cleared'=>false,'new_demo'=>false],JSON_PRETTY_PRINT));file_put_contents($s['root'].'/assets-installation-pointer.json',json_encode(['root'=>$work]));echo json_encode(['passed'=>true,'legacy_balanced_journals'=>27,'proof'=>$work.'/assets-installation.json']).PHP_EOL;
|