Files
SGF/scripts/sgf-composition-bootstrap.php
2026-11-11 09:00:17 +02:00

14 lines
1.8 KiB
PHP

<?php
use Illuminate\Support\Facades\DB;
use App\Shared\Installation\CompositionSchema;
$repo=dirname(__DIR__);$run=json_decode(file_get_contents('C:/laragon/data/sgf-tempo/run/modular-regression-current.json'),true);
$s=json_decode(file_get_contents($run['root'].'/private/receipt-composition-b4093c6f6707/state.json'),true);
if($run['id']!=='2576427d1939'||$s['tag']!=='b4093c6f6707'||!is_file($s['root'].'/integrated-result.json')||is_file($s['root'].'/demo-server.json'))throw new LogicException('Existing regression only');
$proof=$run['root'].'/private/sgf-composition-proof-'.bin2hex(random_bytes(6));mkdir($proof,0700,true);
foreach($s['env'] as $key=>$value)if(preg_match('/^(APP_|DB_|SGF_|SESSION_|CACHE_|QUEUE_|BCRYPT_)/',$key)){putenv($key.'='.$value);$_ENV[$key]=$value;$_SERVER[$key]=$value;}
foreach(['APP_BASE_PATH'=>$repo,'APP_CONFIG_CACHE'=>$proof.'/config.php','APP_ROUTES_CACHE'=>$proof.'/routes.php','APP_SERVICES_CACHE'=>$proof.'/services.php','APP_PACKAGES_CACHE'=>$proof.'/packages.php','SESSION_DRIVER'=>'array','CACHE_STORE'=>'array'] as $key=>$value){putenv($key.'='.$value);$_ENV[$key]=$value;$_SERVER[$key]=$value;}
require $repo.'/vendor/autoload.php';$app=require $repo.'/bootstrap/app.php';$app->addAbsoluteCachePathPrefix('C:');$app->useStoragePath($proof.'/storage');foreach(['logs','framework/views','framework/sessions','framework/cache/data'] as $dir)mkdir($proof.'/storage/'.$dir,0700,true);
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();$host=DB::connection();
if(($argv[1]??null)==='--inspect'){echo json_encode(['tables'=>array_column($host->select("SELECT tablename FROM pg_tables WHERE schemaname='public' ORDER BY tablename"),'tablename'),'a_client_columns'=>$host->getSchemaBuilder()->getColumns('a_clients')],JSON_PRETTY_PRINT).PHP_EOL;exit;}