<?php
declare(strict_types=1);require __DIR__.'/app.php';ck(!file_exists($runtime.'/cleanup.json'),'Own cleanup once');$app=coreApp('CLEANUP');$tokens=file_exists($runtime.'/tokens.json')?json_decode(file_get_contents($runtime.'/tokens.json'),true):[];$out=[];foreach($tokens as $actor=>$token){\think\facade\Cache::delete($token);ck(!\think\facade\Cache::has($token),'Own token revoked');$out[$actor]='revoked';}$own=ownSnapshot();$old=oldProtection();$guard=file_exists($runtime.'/guard.json')?json_decode(file_get_contents($runtime.'/guard.json'),true):null;if($guard)ck($old===$guard['old_protection'],'Old final fullrow protection');saveOnce('cleanup.json',['lane'=>$lane,'tokens'=>$out,'own_final'=>$own,'old_final'=>$old,'business_rows_retained'=>true,'business_DML'=>0,'at'=>date('c')]);echo json_encode(['lane'=>$lane,'tokens_revoked'=>count($out),'business_DML'=>0]),"\n";
