<?php
/**
 * 校验宝塔部署 Nginx 模板占位符是否已处理或文件存在
 */
$root = dirname(__DIR__);
$tpl  = $root . '/deploy/baota/nginx/cloaka-site.conf';
$inst = $root . '/deploy/baota/nginx/cloaka-site.conf.installed';
$ok   = is_readable($tpl)
    && is_readable($root . '/deploy/baota/install_bt.sh')
    && is_readable($root . '/deploy/baota/hook/post_site.sh')
    && strpos(file_get_contents($tpl), '__CLOAK_ROOT__') !== false;

echo json_encode([
    'ok'       => $ok,
    'tpl'      => $tpl,
    'has_inst' => is_readable($inst),
], JSON_UNESCAPED_UNICODE) . "\n";
