Admin: add section rename and delete actions

Let admins manage section names and ordering from the media sidebar without manual DB edits. Add safe section deletion in admin flow and remove the section storage folder after DB cascade cleanup.
This commit is contained in:
2026-02-20 18:20:03 +03:00
parent ebca47f3c5
commit b241c9b9b3
2 changed files with 88 additions and 0 deletions
+12
View File
@@ -25,6 +25,18 @@ function sectionCreate(string $name, int $sort): void
$st->execute(['name' => $name, 'sort' => $sort]);
}
function sectionUpdate(int $id, string $name, int $sort): void
{
$st = db()->prepare('UPDATE sections SET name=:name, sort_order=:sort WHERE id=:id');
$st->execute(['id' => $id, 'name' => $name, 'sort' => $sort]);
}
function sectionDelete(int $id): void
{
$st = db()->prepare('DELETE FROM sections WHERE id=:id');
$st->execute(['id' => $id]);
}
function photosBySection(int $sectionId): array
{
$sql = 'SELECT p.*,