Files
alrahma_web_client/scripts/dump-school-policy.php
2026-06-04 02:55:19 -04:00

43 lines
993 B
PHP

<?php
$root = dirname(__DIR__);
$policyHtmlPath = '/Volumes/ExternalApps/Documents/alrahma_sunday_school_api/resources/policies/school_policy.html';
if (!is_file($policyHtmlPath)) {
fwrite(STDERR, "Policy source not found: {$policyHtmlPath}\n");
exit(1);
}
$html = file_get_contents($policyHtmlPath);
if ($html === false) {
fwrite(STDERR, "Failed to read policy source\n");
exit(1);
}
$data = [
'title' => 'School Policy',
'sections' => [
[
'subsections' => [
[
'body' => $html,
],
],
],
],
];
$outDir = $root . '/public/policy';
if (!is_dir($outDir)) {
mkdir($outDir, 0777, true);
}
$json = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
if ($json === false) {
fwrite(STDERR, "json_encode failed\n");
exit(1);
}
file_put_contents($outDir . '/school-policy-content.json', $json);
echo "Wrote public/policy/school-policy-content.json\n";