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

4 lines
1.6 KiB
PHP

<?php
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';$files=['app/Modules/Services/CommercialQuotes.php','app/Modules/Services/Http/CommercialQuotesController.php','app/Modules/Services/ServiceWorkflow.php','app/Modules/Workshop/WorkshopBilling.php','app/Shared/Context/ModuleNavigation.php','app/Modules/Identity/Services/IdentityWorkflow.php','routes/web.php','resources/views/commercial/quote-print.blade.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,'.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-quotes-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.'/commercial_quotes.php';file_put_contents($file,"<?php\nreturn ['enabled'=>true];\n");$copy($file,'config/commercial_quotes.php');file_put_contents($work.'/commercial-quotes-installation.json',json_encode(['passed'=>true,'source_hashes'=>$hashes,'installation'=>$tag,'cache_cleared'=>false,'new_demo'=>false,'new_invoices'=>0],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'proof'=>$work.'/commercial-quotes-installation.json']).PHP_EOL;