Pārlūkot izejas kodu

Version 1.2.2 Draft Management

Sebastian 7 gadi atpakaļ
vecāks
revīzija
d2a3dd9aa3

+ 1 - 1
cache/lastCache.txt

@@ -1 +1 @@
-1532454659
+1532455604

+ 2 - 2
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();

+ 7 - 2
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);