From 15ea3fe904bb38844f62a7ed31ff5f8d76fb3546 Mon Sep 17 00:00:00 2001 From: Alex Yashkin Date: Tue, 12 Jun 2018 17:00:52 +0300 Subject: [PATCH] Update Content.php Check if original page exists when get it from cache --- flextype/Content.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flextype/Content.php b/flextype/Content.php index 61711b9f..e98e9b39 100755 --- a/flextype/Content.php +++ b/flextype/Content.php @@ -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.");