@@ -0,0 +1,54 @@
|
||||
from pathlib import Path
|
||||
import json, shutil, re, subprocess
|
||||
R=Path(__file__).resolve().parent.parent
|
||||
P=R/'storage/app/private/investmoz-v2/portal-audit'
|
||||
plan=json.loads((P/'service-followup-latest.json').read_text(encoding='utf-8'))
|
||||
S=Path(plan['source'])
|
||||
assert S.name.startswith('workflow-service-followup-source-') and plan['target']['port']==55441
|
||||
# Adapt only the QA preparer, preserving the previous evidence and fixed source.
|
||||
text=(R/'tools/portal-workflow-upgrade-final-preflight.php').read_text(encoding='utf-8')
|
||||
text=text.replace('portal-workflow-upgrade-final-runtime.php','portal-service-followup-runtime.php')
|
||||
text=text.replace('workflow-upgrade-final-latest.json','service-followup-latest.json')
|
||||
text=text.replace('workflow-upgrade-final-preflight-20261011.json','service-followup-preflight-20261011.json')
|
||||
text=text.replace('workflow-upgrade-final-actors-private.json','service-followup-actors-private.json')
|
||||
extra=r'''
|
||||
// QA fixture initialization only: fresh restored clone, not a destination installer demonstration.
|
||||
$db->transaction(function () use ($resource,$profiles) {
|
||||
$resource->up(); $profiles->up();
|
||||
$batch=(int) Illuminate\Support\Facades\DB::table('migrations')->max('batch')+1;
|
||||
foreach(['2026_10_09_030000_extend_opportunity_resources','2026_10_10_040000_create_portal_profile_authorization'] as $migration)
|
||||
Illuminate\Support\Facades\DB::table('migrations')->insert(['migration'=>$migration,'batch'=>$batch]);
|
||||
});
|
||||
Illuminate\Support\Facades\DB::table('portal_role_assignments')->insert([
|
||||
'id'=>(string) Illuminate\Support\Str::uuid(),'user_id'=>$actors['promoter']['id'],'role'=>'promoter',
|
||||
'organization_id'=>null,'opportunity_types'=>json_encode(['real_estate']),'responsibilities'=>'[]',
|
||||
'source'=>'isolated-qa-fixture-only','approved_by'=>$actors['manager']['id'],'starts_at'=>now(),'created_at'=>now(),'updated_at'=>now(),
|
||||
]);
|
||||
$plan['qa_actor_ids']=array_map(fn($a)=>$a['id'],$actors);
|
||||
file_put_contents($plan['source'].'/upgrade-qa.json',json_encode($plan,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));
|
||||
file_put_contents($dir.'/service-followup-latest.json',json_encode($plan,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));
|
||||
'''
|
||||
text=text.replace("echo json_encode(['result'=>'passed'",extra+"\necho json_encode(['result'=>'passed'")
|
||||
(R/'tools/portal-service-followup-preflight-qa.php').write_text(text,encoding='utf-8')
|
||||
helper=(R/'tools/portal-workflow-upgrade-browser-lib.cjs').read_text(encoding='utf-8')
|
||||
helper=helper.replace('workflow-upgrade-latest.json','service-followup-latest.json').replace('workflow-upgrade-actors-private.json','service-followup-actors-private.json')
|
||||
(R/'tools/portal-service-followup-browser-lib.cjs').write_text(helper,encoding='utf-8')
|
||||
env=(S/'.env').read_text(encoding='utf-8')
|
||||
for flag in ['PORTAL_PROFILE_ACCESS_ENABLED','PORTAL_OPPORTUNITY_DASHBOARD_ACCESS_ENABLED','PORTAL_OPPORTUNITY_SPECIALIZED_DRAFTS_ENABLED']:
|
||||
env=re.sub('^'+flag+'=.*$',flag+'=true',env,flags=re.M)
|
||||
(S/'.env').write_text(env,encoding='utf-8')
|
||||
runtime=(S/'tools/upgrade-runtime.php').read_text(encoding='utf-8')
|
||||
runtime=runtime.replace('return $app;',r'''
|
||||
Illuminate\Support\Facades\Route::get('/__qa/services-runtime', function (Illuminate\Http\Request $request) use ($settings) {
|
||||
abort_unless(in_array($request->user()->id,$settings['qa_actor_ids']??[],true),403);
|
||||
return response()->json(['php'=>PHP_VERSION,'sapi'=>PHP_SAPI,'ini'=>php_ini_loaded_file(),
|
||||
'upload_max_filesize'=>ini_get('upload_max_filesize'),'post_max_size'=>ini_get('post_max_size'),
|
||||
'memory_limit'=>ini_get('memory_limit'),'max_execution_time'=>ini_get('max_execution_time'),
|
||||
'gd'=>extension_loaded('gd'),'webp'=>function_exists('imagewebp') && (gd_info()['WebP Support']??false),
|
||||
'pcntl'=>extension_loaded('pcntl'),'target'=>$settings['target'],
|
||||
'queue'=>config('queue.connections.database.queue'),'qa_only'=>true]);
|
||||
})->middleware(['web','auth','verified']);
|
||||
return $app;
|
||||
''')
|
||||
(S/'tools/upgrade-runtime.php').write_text(runtime,encoding='utf-8')
|
||||
print(json.dumps({'result':'isolated_helpers_prepared','source':str(S),'active_writes':0}))
|
||||
Reference in New Issue
Block a user