20 lines
2.2 KiB
PHP
20 lines
2.2 KiB
PHP
<?php
|
|
ini_set('zend.exception_ignore_args','1');
|
|
$source='C:/Users/macbook/.config/investmoz/editorial-QA-20261018/compatible-reversal';
|
|
$boot=str_replace('editorial-QA-20261018/source','editorial-QA-20261018/compatible-reversal',file_get_contents(__DIR__.'/boot-QA.php'));
|
|
file_put_contents(__DIR__.'/boot-compatible-QA.php',$boot);require __DIR__.'/boot-compatible-QA.php';
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Storage;
|
|
if($target!==['database'=>'editorial_20261018_test','port'=>55441])throw new RuntimeException('Exact compatibility QA target');
|
|
$r=DB::table('portal_resources')->where('title','Artigo legado sintético QA')->first();$d=DB::table('documents')->find($r->document_id);
|
|
$from='C:/Users/macbook/.config/investmoz/editorial-QA-20261018/source/storage/app/private/'.$d->storage_key;$to=Storage::disk('local')->path($d->storage_key);if(!is_dir(dirname($to)))mkdir(dirname($to),0700,true);copy($from,$to);
|
|
DB::statement('SET default_transaction_read_only = on');
|
|
$before=DB::table('portal_resources')->where('id',$r->id)->value('editorial_content');
|
|
$response=app(App\Http\Controllers\EditorialArticleController::class)->show($r->id);$props=$response->toResponse(Illuminate\Http\Request::create('http://127.0.0.1:18548/artigos/'.$r->id))->getContent();
|
|
if(!str_contains($props,'Adaptação sintética QA.')&&!str_contains($props,'Adapta\u00e7\u00e3o sint\u00e9tica QA.'))throw new RuntimeException('Compatible public body missing');
|
|
$manifest=json_decode(file_get_contents($source.'/public/build/manifest.json'),true);
|
|
if(!isset($manifest['resources/js/pages/portal/article.tsx']))throw new RuntimeException('Compatible article page missing');
|
|
if($before!==DB::table('portal_resources')->where('id',$r->id)->value('editorial_content'))throw new RuntimeException('Compatibility changed body');
|
|
$p=['target'=>$target,'result'=>'observado','public_reader_with_old_management_UI'=>true,'original_file_hash_preserved'=>hash_file('sha256',$to)===trim($d->sha256),'body_and_history_not_reverted'=>true,'read_only_DB'=>true,'migration_repeated'=>false];
|
|
file_put_contents(__DIR__.'/COMPATIBILIDADE-REVERSAO-QA.json',json_encode($p,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE));echo json_encode($p).PHP_EOL;
|