1
0
mirror of https://github.com/typemill/typemill.git synced 2025-07-31 11:20:15 +02:00

Version 1.2.2 Draft Management

This commit is contained in:
Sebastian
2018-07-24 20:17:10 +02:00
parent 84880b3c0c
commit d2a3dd9aa3
3 changed files with 10 additions and 5 deletions

View File

@@ -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();

View File

@@ -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);