diff --git a/cache/lastCache.txt b/cache/lastCache.txt index 96cdfa0..bba5fbf 100644 --- a/cache/lastCache.txt +++ b/cache/lastCache.txt @@ -1 +1 @@ -1532454659 \ No newline at end of file +1532455604 \ No newline at end of file diff --git a/system/Controllers/ContentBackendController.php b/system/Controllers/ContentBackendController.php index 7a00f80..22bf875 100644 --- a/system/Controllers/ContentBackendController.php +++ b/system/Controllers/ContentBackendController.php @@ -24,10 +24,10 @@ class ContentBackendController extends ContentController $this->params = isset($args['params']) ? ['url' => $this->uri->getBasePath() . '/' . $args['params']] : ['url' => $this->uri->getBasePath()]; # set structure - if(!$this->setStructure($draft = true)){ die('no structure'); return $this->render404($response, array( 'navigation' => true, 'content' => $this->errors )); } + if(!$this->setStructure($draft = true)){ return $this->render404($response, array( 'navigation' => true, 'content' => $this->errors )); } # set item - if(!$this->setItem()){ die('no item'); return $this->render404($response, array( 'navigation' => $this->structure, 'settings' => $this->settings, 'content' => $this->errors )); } + if(!$this->setItem()){ return $this->render404($response, array( 'navigation' => $this->structure, 'settings' => $this->settings, 'content' => $this->errors )); } # set the status for published and drafted $this->setPublishStatus(); diff --git a/system/Controllers/ContentController.php b/system/Controllers/ContentController.php index f0167cd..f9cb3c0 100644 --- a/system/Controllers/ContentController.php +++ b/system/Controllers/ContentController.php @@ -93,19 +93,24 @@ abstract class ContentController protected function setStructure($draft = false, $cache = true) { + # set initial structure to false + $structure = false; + # name of structure-file for draft or live $filename = $draft ? $this->structureDraftName : $this->structureLiveName; # set variables and objects $this->write = new writeCache(); - + # check, if cached structure is still valid if($cache && $this->write->validate('cache', 'lastCache.txt', 600)) { # get the cached structure $structure = $this->write->getCache('cache', $filename); } - else + + # if no structure was found or cache is deactivated + if(!$structure) { # scan the content of the folder $structure = Folder::scanFolder($this->settings['rootPath'] . $this->settings['contentFolder'], $draft);