|
@ -1690,12 +1690,19 @@ function buildIndex($global_api = "yes") { |
|
|
if (!$content) |
|
|
if (!$content) |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
// Tries to avoid rebuilding if the body is the same as the one in cache. |
|
|
if ($config['cache']['enabled']) { |
|
|
if ($config['cache']['enabled']) { |
|
|
$contentHash = md5(json_encode($content['body'])); |
|
|
$contentHash = md5(json_encode($content['body'])); |
|
|
$cacheHit = cache::get('index_cache'. $contentHash); |
|
|
$contentHashKey = '_index_hashed_'. $board . '_' . $page; |
|
|
if ($cacheHit) |
|
|
$cachedHash = cache::get($contentHashKey); |
|
|
|
|
|
if ($cachedHash == $contentHash){ |
|
|
|
|
|
if ($config['api']['enabled']) { |
|
|
|
|
|
// this is needed for the thread.json and catalog.json rebuilding below, which includes all pages. |
|
|
|
|
|
$catalog[$page-1] = $content['threads']; |
|
|
|
|
|
} |
|
|
continue; |
|
|
continue; |
|
|
cache::set('index_cache'. $contentHash, "processed", 3600); |
|
|
} |
|
|
|
|
|
cache::set($contentHashKey, $contentHash, 3600); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// json api |
|
|
// json api |
|
|