@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
ini_set('zend.exception_ignore_args','1');
|
||||
putenv('STABILITY_QA_MODE=consumers');
|
||||
$b5Root=dirname(__DIR__,2);
|
||||
$b5QA=$b5Root.'/storage/app/private/investmoz-v2/portal-audit/portal-stability-source-20261011_083742';
|
||||
$app=require $b5QA.'/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{
|
||||
if(config('portal.notifications_enabled')||config('suitecrm.enabled')||config('investmoz_ai.enabled'))throw new RuntimeException('External integrations must remain off');
|
||||
$proof=['at'=>gmdate('c'),'target'=>$target,'read_only'=>true,'active_writes'=>0,'browser_observed'=>false];
|
||||
$access=app(App\Services\PortalProfileAccess::class);
|
||||
$proof['pair']=$db->table('portal_superuser_pair')->first(['first_user_id','second_user_id']);
|
||||
$proof['coeditor_assignments']=$db->table('portal_role_assignments')->where('user_id',22)->whereNull('revoked_at')->get(['id','role','organization_id','opportunity_types','source']);
|
||||
$proof['coeditor_memberships']=$db->table('memberships')->where('user_id',22)->whereNull('deleted_at')->get(['id','organization_id','role']);
|
||||
$proof['records']=[];
|
||||
foreach([30,31,32,33,34,35,54,56]as$id){
|
||||
$o=App\Models\Opportunity::findOrFail($id);$p=app(App\Services\OpportunityManagement::class)->values($o)['canonical'];
|
||||
$proof['records'][]=['id'=>$id,'category'=>$o->opportunity_category,'owner'=>$o->owner_user_id,'organization_id'=>$o->organization_id,'working_state'=>$o->workflow_context['working_state'],'coeditor_scope'=>$access->promoterRecordScope(App\Models\User::findOrFail(22),$o),'documents'=>$p['documents'],'land_rights'=>$p['land_rights']??null,'business_transaction'=>$p['business_transaction']??null];
|
||||
}
|
||||
$schema=app(App\Services\OpportunityCanonicalContract::class)->schema();$proof['definition_fields']=[];
|
||||
foreach($schema['$defs']as$name=>$def){
|
||||
if(preg_match('/^(landRights|parcel|community|businessTransaction|partnership|franchise|encumbrance|governance|license|authority|authorization|evidence|document|location)/i',$name)){
|
||||
$proof['definition_fields'][$name]=['required'=>$def['required']??[],'properties'=>array_keys($def['properties']??[]),'conditions'=>$def['allOf']??[]];
|
||||
}
|
||||
}
|
||||
$proof['protected_tables']=[];
|
||||
foreach(['opportunities','opportunity_locations','opportunity_documents','opportunity_images','tasks','documents','organizations','memberships','portal_role_assignments','portal_superuser_pair','desk_cases','desk_documents','desk_requests','investor_journeys','journey_steps','users']as$t){
|
||||
$rows=$db->table($t)->get();$bytes=$rows->map(fn($r)=>json_encode($r,JSON_THROW_ON_ERROR))->all();sort($bytes,SORT_STRING);
|
||||
$proof['protected_tables'][$t]=['count'=>$rows->count(),'sha256'=>hash('sha256',implode("\n",$bytes))];
|
||||
}
|
||||
$dest=__DIR__.'/option-B5-finite-inventory.json';if(is_file($dest))throw new RuntimeException('Preserve previous inventory');
|
||||
file_put_contents($dest,json_encode($proof,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_THROW_ON_ERROR));
|
||||
echo json_encode(['result'=>'read_only_inventory_recorded','target'=>$target,'records'=>count($proof['records']),'definitions'=>array_keys($proof['definition_fields']),'pair'=>$proof['pair'],'coeditor_grants'=>$proof['coeditor_assignments']],JSON_UNESCAPED_UNICODE).PHP_EOL;
|
||||
}finally{$db->rollBack();}
|
||||
Reference in New Issue
Block a user