From a8e37543757a6f5e6e841a3745cdb10b2247a269 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 29 Aug 2013 18:55:25 +1000 Subject: [PATCH] Minor $config['try_smarter'] work --- inc/functions.php | 5 ++++- inc/template.php | 4 +++- post.php | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index d006d0ad..8b338063 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1306,7 +1306,7 @@ function buildIndex() { for ($page = 1; $page <= $config['max_pages']; $page++) { $filename = $board['dir'] . ($page == 1 ? $config['file_index'] : sprintf($config['file_page'], $page)); - if ($config['try_smarter'] && isset($build_pages) && count($build_pages) + if ($config['try_smarter'] && isset($build_pages) && !empty($build_pages) && !in_array($page, $build_pages) && is_file($filename)) continue; $content = index($page); @@ -1352,6 +1352,9 @@ function buildIndex() { $jsonFilename = $board['dir'] . 'catalog.json'; file_write($jsonFilename, $json); } + + if ($config['try_smarter']) + $build_pages = array(); } function buildJavascript() { diff --git a/inc/template.php b/inc/template.php index 6f85e78b..6d417631 100644 --- a/inc/template.php +++ b/inc/template.php @@ -35,7 +35,7 @@ function load_twig() { } function Element($templateFile, array $options) { - global $config, $debug, $twig; + global $config, $debug, $twig, $build_pages; if (!$twig) load_twig(); @@ -51,6 +51,8 @@ function Element($templateFile, array $options) { unset($debug['start']); unset($debug['start_debug']); } + if ($config['try_smarter'] && isset($build_pages) && !empty($build_pages)) + $debug['build_pages'] = $build_pages; $debug['included'] = get_included_files(); $debug['memory'] = round(memory_get_usage(true) / (1024 * 1024), 2) . ' MiB'; $options['body'] .= diff --git a/post.php b/post.php index 7ca9c1a9..de4bc07d 100644 --- a/post.php +++ b/post.php @@ -682,7 +682,7 @@ if (isset($_POST['delete'])) { incrementSpamHash($post['antispam_hash']); } - if (isset($post['tracked_cites']) && count($post['tracked_cites'])) { + if (isset($post['tracked_cites']) && !empty($post['tracked_cites'])) { $insert_rows = array(); foreach ($post['tracked_cites'] as $cite) { $insert_rows[] = '(' .