<?php
/** Execute por CLI a cada hora: php cron/eventos-infantis-retencao.php */
if(PHP_SAPI!=='cli'){http_response_code(403);exit('CLI only');}
require_once __DIR__.'/../config/config.php';require_once __DIR__.'/../config/database.php';require_once __DIR__.'/../includes/functions.php';
try{$result=afControlledEventProcessRetention($pdo,50,'cli',0);echo json_encode(['ok'=>true,'executed_at'=>date(DATE_ATOM)]+$result,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT).PHP_EOL;exit(0);}catch(Throwable $e){fwrite(STDERR,json_encode(['ok'=>false,'error'=>$e->getMessage()],JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES).PHP_EOL);exit(1);}
