Files
Investidor-V2/outputs/investmoz-audit-current-20261012/C132-account-metadata.php
T
nala 287e991486
tests / ci (push) Waiting to run
oportunidades 7
2026-10-13 11:40:29 +02:00

9 lines
1.3 KiB
PHP

<?php
ini_set('zend.exception_ignore_args','1');set_exception_handler(function(Throwable $e){fwrite(STDERR,$e::class);exit(1);});
$root=dirname(__DIR__,2);require $root.'/vendor/autoload.php';$app=require $root.'/bootstrap/app.php';(new Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables)->bootstrap($app);(new Illuminate\Foundation\Bootstrap\LoadConfiguration)->bootstrap($app);
$c=config('database.connections.'.config('database.default'));if($c['database']!=='investemoz'||(int)$c['port']!==5432)throw new RuntimeException('Target differs');
$db=new PDO('pgsql:host='.$c['host'].';port='.$c['port'].';dbname='.$c['database'],$c['username'],$c['password']);$db->exec('BEGIN READ ONLY');
$a=$db->query("SELECT column_name,is_nullable,column_default FROM information_schema.columns WHERE table_schema='public' AND table_name='audit_events' ORDER BY ordinal_position")->fetchAll(PDO::FETCH_ASSOC);
$u=$db->query('SELECT id,name,email,two_factor_confirmed_at,portal_access_revision FROM users WHERE id IN (14,15,16,17) ORDER BY id')->fetchAll(PDO::FETCH_ASSOC);$db->exec('ROLLBACK');
$d=['audit_schema'=>$a,'affected_accounts'=>$u];file_put_contents(__DIR__.'/C132-account-metadata.json',json_encode($d,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo json_encode($d,JSON_THROW_ON_ERROR);