forked from laysense/laysense.cn
Manage dynamic blocks and expand the editor library
This commit is contained in:
@@ -75,6 +75,20 @@ final class Database
|
||||
}
|
||||
}
|
||||
|
||||
if ((int) $pdo->query('PRAGMA user_version')->fetchColumn() === 0) {
|
||||
$heroDirectory = $pdo->prepare("INSERT OR IGNORE INTO sections (page_slug, key, title, lead, style, body, position)
|
||||
VALUES ('home', 'hero-directory', '产品与服务导航', '', 'hero-links', ?, -1)");
|
||||
$heroDirectory->execute([BlockTemplates::PRODUCT_LINKS]);
|
||||
$network = $pdo->prepare("INSERT OR IGNORE INTO sections (page_slug, key, title, lead, style, body, feed, position)
|
||||
SELECT 'home', 'network', '支持项目与合作伙伴', '', 'plain', '', ?, COALESCE(MAX(position), -1) + 1
|
||||
FROM sections WHERE page_slug = 'home'");
|
||||
$network->execute([BlockTemplates::NETWORK_FEED]);
|
||||
if ($heroDirectory->rowCount() + $network->rowCount() > 0) {
|
||||
$pdo->exec("UPDATE pages SET version = version + 1 WHERE slug = 'home'");
|
||||
}
|
||||
$pdo->exec('PRAGMA user_version = 1');
|
||||
}
|
||||
|
||||
$category = $pdo->prepare('INSERT OR IGNORE INTO article_categories (slug, name) VALUES (?, ?)');
|
||||
foreach (Repository::CATEGORIES as $slug => $name) {
|
||||
$category->execute([$slug, $name]);
|
||||
|
||||
Reference in New Issue
Block a user