40 lines
3.0 KiB
PHP
40 lines
3.0 KiB
PHP
<?php
|
|
ini_set('zend.exception_ignore_args', '1');
|
|
putenv('STABILITY_QA_MODE=consumers');
|
|
$diagnosticRoot = dirname(__DIR__, 2);
|
|
$app = require $diagnosticRoot.'/storage/app/private/investmoz-v2/portal-audit/portal-stability-source-20261011_083742/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.'); }
|
|
$proofPath = __DIR__.'/line07-draft-readonly-20261015.json';
|
|
if (is_file($proofPath)) { throw new RuntimeException('Preserve evidence.'); }
|
|
$db->beginTransaction();
|
|
$db->statement('SET TRANSACTION READ ONLY');
|
|
try {
|
|
$business = app(App\Services\Mne\BusinessRepository::class)->find('172aa874-98fc-4bf6-b78f-d2e9a386d345');
|
|
$actor = App\Models\User::findOrFail(21);
|
|
$payload = $business->payload;
|
|
$errors = [];
|
|
if (($payload['wizard_version'] ?? null) === '2') {
|
|
try { App\Services\BusinessFormSchema::validateSubmission($payload,$business->sector_id,$business->modality); }
|
|
catch (Illuminate\Validation\ValidationException $e) { $errors = array_keys($e->errors()); }
|
|
}
|
|
$previous = $db->table('business_workflow_transitions')->where('existing_business_id',$business->id)
|
|
->orderByDesc('created_at')->limit(5)->get(['from_status','to_status','actor_id','created_at']);
|
|
$proof = ['at'=>gmdate('c'),'target'=>$target,'SQL_read_only'=>true,'line'=>7,'business_id'=>$business->id,
|
|
'reported_reference_matches'=>$business->code==='MNE-0a29f02d-6352-4e15-9923-781945afae4d',
|
|
'state'=>$business->status,'version'=>$business->version_no,'owner_QA_account'=>$business->owner_user_id,
|
|
'QA21_owns'=>Illuminate\Support\Facades\Gate::forUser($actor)->allows('owns',$business),
|
|
'QA21_can_update'=>Illuminate\Support\Facades\Gate::forUser($actor)->allows('update',$business),
|
|
'wizard_version'=>$payload['wizard_version'] ?? null,'submission_schema_missing_or_invalid_fields'=>$errors,
|
|
'description_length'=>mb_strlen($payload['description'] ?? ''),
|
|
'source_reference_length'=>mb_strlen($payload['source_reference'] ?? ''),
|
|
'sector_present'=>$business->sector_id !== null,
|
|
'all_three_declarations_yes'=>count(array_filter(['confirm_information','confirm_disclosure_authority','confirm_no_publication_guarantee'],fn($key)=>($payload[$key]??null)==='yes'))===3,
|
|
'recent_transitions'=>$previous,'HTTP_submission_not_executed'=>true,
|
|
'consent_and_confirmation_must_be_entered_by_responsible'=>true,
|
|
'credentials_or_sessions_read'=>false,'QA_database_changes'=>0,'active_changes'=>0];
|
|
file_put_contents($proofPath,json_encode($proof,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_THROW_ON_ERROR).PHP_EOL);
|
|
echo json_encode($proof,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_THROW_ON_ERROR).PHP_EOL;
|
|
} finally { $db->rollBack(); }
|