18 lines
1.8 KiB
Python
18 lines
1.8 KiB
Python
from pathlib import Path
|
|
import json
|
|
R=Path(__file__).resolve().parent.parent;P=R/'storage/app/private/investmoz-v2/portal-audit'
|
|
plan=json.loads((P/'internal-designation-plan.json').read_text());S=Path(plan['source'])
|
|
assert S.parent==P and plan['target']['port']==55441
|
|
fixture=(R/'tools/portal-onboarding-governance-fixture.php').read_text(encoding='utf-8')
|
|
fixture=fixture.replace("['holder','other_holder','validator']", "['holder','other_holder','promoter','validator','publisher']")
|
|
fixture=fixture.replace("'opportunities'=>$db::table('opportunities')->count()", "'organizations'=>$db::table('organizations')->get(['id','name','external_id'])->all(),'memberships'=>$db::table('memberships')->count(),'external_requests'=>$db::table('portal_profile_requests')->count(),'organization_registrations'=>$db::table('audit_events')->where('action','operator_organization_registered')->count(),'opportunities'=>$db::table('opportunities')->get(['id','organization_id','owner_user_id','workflow_context'])->all()")
|
|
fixture=fixture.replace("file_put_contents($private,json_encode", "Illuminate\\Support\\Facades\\DB::table('organizations')->insert(['id'=>(string)Illuminate\\Support\\Str::uuid(),'name'=>'Synthetic real promoter QA','organization_type'=>'private']);\nfile_put_contents($private,json_encode")
|
|
(S/'tools').mkdir(exist_ok=True);(S/'tools/internal-fixture.php').write_text(fixture,encoding='utf-8')
|
|
(S/'tools/internal-router.php').write_text('''<?php
|
|
$root=dirname(__DIR__);$uri=parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH);
|
|
$file=realpath($root.'/public'.rawurldecode($uri));$public=realpath($root.'/public');
|
|
if ($file && str_starts_with($file,$public.DIRECTORY_SEPARATOR) && is_file($file)) return false;
|
|
require $root.'/public/index.php';
|
|
''',encoding='utf-8')
|
|
print(json.dumps({'result':'synthetic_QA_browser_fixture_prepared','active_writes':0}))
|