$hash) { if (! str_starts_with($file, 'assets/') || str_contains($file, '..') || ! hash_equals($hash, hash_file('sha256', $assets.'/'.$file)) || (is_file($root.'/public/build/'.$file) && ! hash_equals($hash, hash_file('sha256', $root.'/public/build/'.$file)))) { throw new LogicException('ACTIVATION_PREFLIGHT_ASSET_MISMATCH'); } } $environment = [...$source, ...$plan['proposed_runtime_settings'], 'APP_ENV' => 'pilot-readonly', 'APP_DEBUG' => 'false', 'DB_CONNECTION' => 'pgsql', 'DB_URL' => '', 'PGOPTIONS' => '-c default_transaction_read_only=on', 'CACHE_STORE' => 'array', 'SESSION_DRIVER' => 'array', 'QUEUE_CONNECTION' => 'null', 'MAIL_MAILER' => 'array', 'APP_CONFIG_CACHE' => $root.'/storage/framework/absent-pilot-readonly-config.php', 'LOG_CHANNEL' => 'stderr']; foreach ($environment as $key => $value) { putenv($key.'='.$value); $_ENV[$key] = $_SERVER[$key] = $value; } $app = require $root.'/bootstrap/app.php'; $app->make(Kernel::class)->bootstrap(); $db = DB::connection(); if ($db->selectOne('SHOW default_transaction_read_only')->default_transaction_read_only !== 'on') { throw new LogicException('ACTIVATION_PREFLIGHT_DATABASE_NOT_READ_ONLY'); } $runtime = app(StandaloneRuntime::class); $runtime->configure($db); $runtime->assertLoadedPackages(); if (! $runtime->enabled() || count(array_filter(StandaloneRuntime::FEATURES, fn ($name) => $runtime->requested($name))) !== 24) { throw new LogicException('ACTIVATION_PREFLIGHT_CAPABILITIES_INCOMPLETE'); } if (! hash_equals($expectedSettings, hash_file('sha256', $sourcePath))) { throw new LogicException('ACTIVATION_PREFLIGHT_SETTINGS_CHANGED'); } $result = ['date' => gmdate('c'), 'state' => 'passed', 'database_enforced_read_only' => true, 'all_24_capabilities_start_with_pinned_installed_packages' => true, 'source_instance_preserved' => true, 'frontend_assets_verified' => count($plan['frontend']['files']), 'active_settings_changed' => false, 'mode' => $installed ? 'installed_configuration_read_only_postcheck' : 'prospective_read_only_preflight', 'assets_published' => $installed, 'new_grants_or_business_commands' => false]; file_put_contents($root.'/docs/proofs/'.($installed ? 'compras-standalone-pilot-activation-check.json' : 'compras-standalone-pilot-activation-preflight.json'), json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR).PHP_EOL); echo json_encode($result, JSON_THROW_ON_ERROR).PHP_EOL;