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

23 lines
2.4 KiB
PHP

<?php
ini_set('zend.exception_ignore_args','1');putenv('STABILITY_QA_MODE=consumers');
$b2Root=dirname(__DIR__,2);$b2QA=$b2Root.'/storage/app/private/investmoz-v2/portal-audit/portal-stability-source-20261011_083742';
$app=require $b2QA.'/tools/portal-stability-runtime.php';$db=Illuminate\Support\Facades\DB::connection();
$target=(array)$db->selectOne('SELECT current_database() AS database,inet_server_port() AS port');
if($target!==['database'=>'stability_consumers_20261011_084534_test','port'=>55441])throw new RuntimeException('QA isolation required');
$db->beginTransaction();$db->statement('SET TRANSACTION READ ONLY');
try{
$o=App\Models\Opportunity::findOrFail(32);if($o->owner_user_id!==21||$o->opportunity_category!=='land_rights'||$o->workflow_context['working_state']!=='published')throw new RuntimeException('QA variant changed');
$b2Parcel=app(App\Services\OpportunityManagement::class)->values($o)['canonical']['land_rights']['parcels'][0];
$tables=[];foreach(['opportunity_locations','opportunity_documents','opportunity_images','desk_cases','desk_requests','desk_documents','investor_journeys','journey_steps','simulation_form_drafts','tasks','documents','memberships','organizations']as$name){$rows=$db->table($name)->get();$bytes=$rows->map(fn($r)=>json_encode($r,JSON_THROW_ON_ERROR))->all();sort($bytes,SORT_STRING);$tables[$name]=['count'=>$rows->count(),'sha256'=>hash('sha256',implode("\n",$bytes))];}
$p=['at'=>gmdate('c'),'target'=>$target,'SQL_read_only'=>true,'active_writes'=>0,
'scope_sha256'=>hash_file('sha256',$b2Root.'/docs/investmoz/v2/auditoria-portal/ambito-B-aceitacao-QA.md'),
'notifications'=>config('portal.notifications_enabled'),'external_CRM'=>config('suitecrm.enabled'),'external_AI'=>config('investmoz_ai.enabled'),
'path_available'=>app(App\Services\InvestorPath::class)->available(),'protected_tables'=>$tables,
'land_before'=>['opportunity_id'=>32,'area'=>$b2Parcel['area'],
'area_unit_recorded'=>array_key_exists('area_unit',$b2Parcel)]];
if($p['notifications']||$p['external_CRM']||$p['external_AI'])throw new RuntimeException('External integrations must remain off');
if(is_file(__DIR__.'/option-B-next-preflight.json'))throw new RuntimeException('Preserve preflight');
file_put_contents(__DIR__.'/option-B-next-preflight.json',json_encode($p,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));
echo json_encode(array_diff_key($p,['protected_tables'=>true])).PHP_EOL;
}finally{$db->rollBack();}