summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2016-05-08 10:54:30 +0200
committerczaks <marcin@6irc.net>2016-05-08 10:54:30 +0200
commitb6f0317bde1b6d9a9ac5d81a660865a7aa9ad13d (patch)
tree6c6523b9081d2d561080f1b2d8378d93e2a237e1 /templates
parent644f227ab33f247dc82e0208fe2125d5d002f4f4 (diff)
advanced build (1/2): a small refactor of index generating procedure; generation strategies
Diffstat (limited to 'templates')
-rw-r--r--templates/themes/catalog/theme.php13
-rw-r--r--templates/themes/recent/theme.php5
-rw-r--r--templates/themes/sitemap/theme.php6
-rw-r--r--templates/themes/ukko/theme.php6
4 files changed, 20 insertions, 10 deletions
diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php
index 239d4dff..4f512c03 100644
--- a/templates/themes/catalog/theme.php
+++ b/templates/themes/catalog/theme.php
@@ -16,20 +16,25 @@
if ($action == 'all') {
foreach ($boards as $board) {
$b = new Catalog();
- if ($config['smart_build']) {
+
+ $action = generation_strategy("sb_catalog", array($board));
+ if ($action == 'delete') {
file_unlink($config['dir']['home'] . $board . '/catalog.html');
+ file_unlink($config['dir']['home'] . $board . '/index.rss');
}
- else {
+ elseif ($action == 'rebuild') {
$b->build($settings, $board);
}
}
} elseif ($action == 'post-thread' || ($settings['update_on_posts'] && $action == 'post') || ($settings['update_on_posts'] && $action == 'post-delete') && in_array($board, $boards)) {
$b = new Catalog();
- if ($config['smart_build']) {
+ $action = generation_strategy("sb_catalog", array($board));
+ if ($action == 'delete') {
file_unlink($config['dir']['home'] . $board . '/catalog.html');
+ file_unlink($config['dir']['home'] . $board . '/index.rss');
}
- else {
+ elseif ($action == 'rebuild') {
$b->build($settings, $board);
}
}
diff --git a/templates/themes/recent/theme.php b/templates/themes/recent/theme.php
index f44e2529..95921c35 100644
--- a/templates/themes/recent/theme.php
+++ b/templates/themes/recent/theme.php
@@ -25,10 +25,11 @@
$this->excluded = explode(' ', $settings['exclude']);
if ($action == 'all' || $action == 'post' || $action == 'post-thread' || $action == 'post-delete') {
- if ($config['smart_build']) {
+ $action = generation_strategy('sb_recent', array());
+ if ($action == 'delete') {
file_unlink($config['dir']['home'] . $settings['html']);
}
- else {
+ elseif ($action == 'rebuild') {
file_write($config['dir']['home'] . $settings['html'], $this->homepage($settings));
}
}
diff --git a/templates/themes/sitemap/theme.php b/templates/themes/sitemap/theme.php
index 52779d53..6bc035bb 100644
--- a/templates/themes/sitemap/theme.php
+++ b/templates/themes/sitemap/theme.php
@@ -23,10 +23,12 @@
}
}
- if ($config['smart_build']) {
+ $action = generation_strategy('sb_sitemap', array());
+
+ if ($action == 'delete') {
file_unlink($settings['path']);
}
- else {
+ elseif ($action == 'rebuild') {
$boards = explode(' ', $settings['boards']);
$threads = array();
diff --git a/templates/themes/ukko/theme.php b/templates/themes/ukko/theme.php
index d6fc303c..e572c467 100644
--- a/templates/themes/ukko/theme.php
+++ b/templates/themes/ukko/theme.php
@@ -11,10 +11,12 @@
return;
}
- if ($config['smart_build']) {
+ $action = generation_strategy('sb_ukko', array());
+
+ if ($action == 'delete') {
file_unlink($settings['uri'] . '/index.html');
}
- else {
+ elseif ($action == 'rebuild') {
file_write($settings['uri'] . '/index.html', $ukko->build());
}
}