1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-09 06:36:52 +02:00

Update Content.php

Check if original page exists when get it from cache
This commit is contained in:
Alex Yashkin
2018-06-12 17:00:52 +03:00
committed by GitHub
parent 54253af881
commit 15ea3fe904

View File

@@ -147,15 +147,15 @@ class Content
// Try to get page from cache
if (Cache::contains($page_cache_id)) {
if (!Filesystem::fileExists($file_path)) {
Http::setResponseStatus(404);
}
return Cache::fetch($page_cache_id);
} else {
// Get 404 page if page file is not exists
if (Filesystem::fileExists($file_path)) {
$file_path = $file_path;
} else {
if (!Filesystem::fileExists($file_path)) {
if (Filesystem::fileExists($file_path = PATH['pages'] . '/404/page.html')) {
$file_path = $file_path;
Http::setResponseStatus(404);
} else {
throw new \RuntimeException("404 page file does not exist.");