1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-23 23:20:57 +01:00

Merge pull request #689 from Zankaria/faster-delete

Speed up page builds on delete
This commit is contained in:
Lorenzo Yario 2024-03-14 05:22:34 -07:00 committed by GitHub
commit e3ae4aee80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1764,6 +1764,21 @@ function buildIndex($global_api = "yes") {
if (!$content)
break;
// Tries to avoid rebuilding if the body is the same as the one in cache.
if ($config['cache']['enabled']) {
$contentHash = md5(json_encode($content['body']));
$contentHashKey = '_index_hashed_'. $board['uri'] . '_' . $page;
$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;
}
cache::set($contentHashKey, $contentHash, 3600);
}
// json api
if ($config['api']['enabled']) {
$threads = $content['threads'];