Files
Investidor-V2/outputs/investmoz-staff-preparation-20261012/inspect-bootstrap.php
T
nala 287e991486
tests / ci (push) Waiting to run
oportunidades 7
2026-10-13 11:40:29 +02:00

18 lines
2.3 KiB
PHP

<?php
// Read-only check of the exact historical request supplied by the responsible.
ini_set('zend.exception_ignore_args','1');
try{
$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['driver']!=='pgsql'||(int)$c['port']!==5432||$c['database']!=='investemoz'||!empty($c['url']))throw new RuntimeException('Target refused');
$db=new PDO('pgsql:host=127.0.0.1;port=5432;dbname=investemoz',$c['username'],$c['password'],[PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION]);$db->exec('BEGIN READ ONLY');
$id='5f97b315-c930-4aa1-827f-761c24f8d8ed';
$s=$db->prepare('SELECT id,kind,requested_by,subject_user_id,approved_by,expires_at,consumed_at,created_at,updated_at FROM portal_security_approvals WHERE id=?');$s->execute([$id]);$request=$s->fetch(PDO::FETCH_ASSOC);
$pair=$db->query('SELECT id,first_user_id,second_user_id,approved_by,version,created_at,updated_at FROM portal_superuser_pair')->fetchAll(PDO::FETCH_ASSOC);
$s=$db->prepare('SELECT action,actor_user_id,occurred_at FROM audit_events WHERE source_system=? AND action=? AND after_data->>\'approval_id\'=?');$s->execute(['portal-profiles-v1','superuser_pair_initialized',$id]);$audit=$s->fetchAll(PDO::FETCH_ASSOC);
$organizations=$db->query('SELECT id,name,external_id FROM organizations ORDER BY created_at')->fetchAll(PDO::FETCH_ASSOC);
$assignments=$db->query('SELECT id,user_id,role,organization_id,opportunity_types,responsibilities,source,starts_at,expires_at,revoked_at FROM portal_role_assignments WHERE user_id IN (14,15,16)')->fetchAll(PDO::FETCH_ASSOC);
$db->exec('ROLLBACK');echo json_encode(['at'=>gmdate('c'),'read_only'=>true,'target'=>'investemoz:5432','request'=>$request,'superuser_pair'=>$pair,'initialization_audit'=>$audit,'organizations'=>$organizations,'staff_assignments'=>$assignments,'workflow_enabled'=>(bool)config('portal.profile_access_enabled'),'COUNTRY02'=>(bool)config('portal.organization_country_enabled')],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);
}catch(Throwable $e){echo json_encode(['result'=>'stopped','type'=>$e::class,'line'=>$e->getLine()]);exit(1);}