feat(admin): единые процентные веса без старого формата (#28)
This commit is contained in:
1 parent
a22519e754
commit
47405b27d8
21 files changed
+326
-46
No files matched your search
@@ -4,7 +4,7 @@ require dirname(__DIR__).'/bootstrap.php';
|
||||
use PrelandAdmin\{Config,Store,Transport,Remote,Jobs,Problem};
|
||||
function obsoleteCheck(bool $ok,string $message): void {if(!$ok)throw new RuntimeException($message);echo "PASS {$message}\n";}
|
||||
function obsoleteReject(callable $call,string $message): void {try{$call();}catch(Problem $e){obsoleteCheck($e->status===422&&str_contains($e->getMessage(),'utm.chb'),$message);return;}throw new RuntimeException('Accepted obsolete key: '.$message);}
|
||||
$legacy='{"host":"zoomzilla.ru","utm":{"chb":null,"unknown":{"raw":true},"cons":{"default":"2","weights":{"1":0,"2":7}}},"custom":{"chb":true}}';
|
||||
$legacy='{"host":"zoomzilla.ru","utm":{"chb":null,"unknown":{"raw":true},"cons":{"default":"2","weights":{"1":0,"2":100}}},"custom":{"chb":true}}';
|
||||
$raw=Config::decode($legacy);obsoleteCheck(property_exists($raw->utm,'chb')&&Config::decode(Config::encode($raw))->custom->chb===true,'legacy raw remains readable and encodable without migration');
|
||||
obsoleteReject(fn()=>Config::validate($raw,static fn()=>true),'validation rejects exact deprecated key even null');
|
||||
foreach([
|
||||
|
||||
Reference in new issue
Block a user