14 lines
2.0 KiB
PHP
14 lines
2.0 KiB
PHP
<?php
|
|
$app=(static fn($p)=>require $p)(__DIR__.'/portal-workflow-upgrade-runtime.php');
|
|
$root=dirname(__DIR__);$dir=$root.'/storage/app/private/investmoz-v2/portal-audit';
|
|
$actors=json_decode(file_get_contents($dir.'/workflow-upgrade-actors-private.json'),true,512,JSON_THROW_ON_ERROR);
|
|
$key=(string)Illuminate\Support\Str::uuid();$bytes="%PDF-1.4\n1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n2 0 obj\n<< /Type /Pages /Count 0 /Kids [] >>\nendobj\ntrailer\n<< /Root 1 0 R >>\n%%EOF\nSIMULACAO QA -- identificacao ficticia, sem efeito juridico\n";
|
|
$storage='workflow-upgrade-fixtures/'.$key;
|
|
throw_unless(Illuminate\Support\Facades\Storage::disk('local')->put($storage,Illuminate\Support\Facades\Crypt::encryptString($bytes)),RuntimeException::class,'Private fixture storage failed');
|
|
Illuminate\Support\Facades\DB::table('documents')->insert(['id'=>$key,'source_system'=>'synthetic-workflow-upgrade-qa','file_name'=>'SIMULACAO-QA-identificacao.pdf','media_type'=>'application/pdf','storage_key'=>$storage,'storage_encryption'=>'laravel','sha256'=>hash('sha256',$bytes),'status'=>'quarantined','data_classification'=>'restricted','size_bytes'=>strlen($bytes),'uploaded_by'=>$actors['promoter']['id']]);
|
|
App\Jobs\ScanDocumentForMalware::dispatch($key);
|
|
$gd=imagecreatetruecolor(800,600);$bg=imagecolorallocate($gd,12,88,60);imagefill($gd,0,0,$bg);imagestring($gd,5,80,280,'SIMULACAO QA - SEM EFEITO JURIDICO',imagecolorallocate($gd,255,255,255));$image=storage_path('app/private/workflow-upgrade-image-qa.png');imagepng($gd,$image);imagedestroy($gd);
|
|
$fixture=['profile_document_id'=>$key,'profile_document_sha256'=>hash('sha256',$bytes),'image_path'=>$image,'image_sha256'=>hash_file('sha256',$image),'document_bytes_base64'=>base64_encode($bytes),'synthetic_only'=>true];
|
|
file_put_contents($dir.'/workflow-upgrade-fixtures-private.json',json_encode($fixture,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));
|
|
echo json_encode(['result'=>'synthetic_clone_fixture_queued','target'=>config('database.connections.pgsql.database').':55441','document_id'=>$key,'active_writes'=>0]);
|