Allow deleting and recreating the homepage

This commit is contained in:
2026-11-28 02:06:27 +08:00
parent 268a278ec1
commit a0df3e60de
11 changed files with 31 additions and 27 deletions
+3 -3
View File
@@ -157,8 +157,8 @@ final class SiteBackup
}
}
}
if (count($tables['site_settings']) !== 1 || !in_array('home', array_column($tables['pages'], 'slug'), true)) {
throw new RuntimeException('备份缺少站点身份或首页。');
if (count($tables['site_settings']) !== 1) {
throw new RuntimeException('备份缺少站点身份。');
}
$designs = [];
foreach ($tables['design_presets'] as &$row) {
@@ -198,7 +198,7 @@ final class SiteBackup
$publishedSystemPages[$row['slug']] = $row['page_type'];
}
} elseif ($layout === null) {
PageDraft::slug($row['slug'] ?? null, array_diff(PageDraft::RESERVED, ['home']));
PageDraft::slug($row['slug'] ?? null);
} else {
$kind = is_int($layout) ? ($designs[$layout] ?? null) : null;
if (!in_array($kind, ['header', 'footer'], true) || ($row['slug'] ?? null) !== LayoutPage::slug($kind, $layout)) {