forked from leftypol/leftypol
advanced build (1/2): a small refactor of index generating procedure; generation strategies
This commit is contained in:
parent
644f227ab3
commit
b6f0317bde
8 changed files with 169 additions and 47 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue