|
@@ -270,10 +270,10 @@ class PageController extends Controller
|
|
protected function getFreshStructure($pathToContent, $cache, $uri)
|
|
protected function getFreshStructure($pathToContent, $cache, $uri)
|
|
{
|
|
{
|
|
/* scan the content of the folder */
|
|
/* scan the content of the folder */
|
|
- $structure = Folder::scanFolder($pathToContent);
|
|
|
|
|
|
+ $pagetree = Folder::scanFolder($pathToContent);
|
|
|
|
|
|
/* if there is no content, render an empty page */
|
|
/* if there is no content, render an empty page */
|
|
- if(count($structure) == 0)
|
|
|
|
|
|
+ if(count($pagetree) == 0)
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -282,6 +282,10 @@ class PageController extends Controller
|
|
$yaml = new writeYaml();
|
|
$yaml = new writeYaml();
|
|
$extended = $yaml->getYaml('cache', 'structure-extended.yaml');
|
|
$extended = $yaml->getYaml('cache', 'structure-extended.yaml');
|
|
|
|
|
|
|
|
+ # create an array of object with the whole content of the folder
|
|
|
|
+ $structure = Folder::getFolderContentDetails($pagetree, $extended, $uri->getBaseUrl(), $uri->getBasePath());
|
|
|
|
+
|
|
|
|
+ # now update the extended structure
|
|
if(!$extended)
|
|
if(!$extended)
|
|
{
|
|
{
|
|
$extended = $this->createExtended($this->pathToContent, $yaml, $structure);
|
|
$extended = $this->createExtended($this->pathToContent, $yaml, $structure);
|
|
@@ -289,12 +293,12 @@ class PageController extends Controller
|
|
if(!empty($extended))
|
|
if(!empty($extended))
|
|
{
|
|
{
|
|
$yaml->updateYaml('cache', 'structure-extended.yaml', $extended);
|
|
$yaml->updateYaml('cache', 'structure-extended.yaml', $extended);
|
|
|
|
+
|
|
|
|
+ # we have to update the structure with extended again
|
|
|
|
+ $structure = Folder::getFolderContentDetails($pagetree, $extended, $uri->getBaseUrl(), $uri->getBasePath());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- # create an array of object with the whole content of the folder
|
|
|
|
- $structure = Folder::getFolderContentDetails($structure, $extended, $uri->getBaseUrl(), $uri->getBasePath());
|
|
|
|
-
|
|
|
|
|
|
+
|
|
# cache structure
|
|
# cache structure
|
|
$cache->updateCache('cache', 'structure.txt', 'lastCache.txt', $structure);
|
|
$cache->updateCache('cache', 'structure.txt', 'lastCache.txt', $structure);
|
|
|
|
|