add_action('rest_api_init', function () { register_rest_route('anglia-sync/v1', '/ping', [ 'methods' => 'GET', 'permission_callback' => '__return_true', 'callback' => fn() => [ 'ok' => true, 'site' => home_url(), 'role' => function_exists('anglia_cfg') ? anglia_cfg()['role'] : 'unknown' ] ]); register_rest_route('anglia-sync/v1', '/status', [ 'methods' => 'GET', 'permission_callback' => '__return_true', 'callback' => function () { $cfg = function_exists('anglia_cfg') ? anglia_cfg() : []; $w = wp_upload_dir(); return [ 'ok' => true, 'role' => $cfg['role'] ?? 'child', 'target' => $cfg['target_site_url'] ?? '', 'log_writable' => is_writable(dirname(($cfg['log_path'] ?? (WP_CONTENT_DIR.'/uploads/anglia-sync.log')))), 'uploads' => $w['basedir'] ?? '', 'version' => '1.0.0' ]; } ]); }); add_action('rest_api_init', function () { register_rest_route('anglia-sync/v1', '/ping', [ 'methods' => 'GET', 'permission_callback' => '__return_true', 'callback' => fn() => [ 'ok' => true, 'site' => home_url(), 'role' => function_exists('anglia_cfg') ? anglia_cfg()['role'] : 'unknown' ] ]); register_rest_route('anglia-sync/v1', '/status', [ 'methods' => 'GET', 'permission_callback' => '__return_true', 'callback' => function () { $cfg = function_exists('anglia_cfg') ? anglia_cfg() : []; $w = wp_upload_dir(); return [ 'ok' => true, 'role' => $cfg['role'] ?? 'child', 'target' => $cfg['target_site_url'] ?? '', 'log_writable' => is_writable(dirname(($cfg['log_path'] ?? (WP_CONTENT_DIR.'/uploads/anglia-sync.log')))), 'uploads' => $w['basedir'] ?? '', 'version' => '1.0.0' ]; } ]); });