From 182b6977bd5f7a6e3cf12785844a6e64450eb43b Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Sun, 10 Jan 2016 15:03:50 +0100 Subject: [PATCH 1/2] The date for the last update of a page that is modular is the update time of the module that was last modified --- system/src/Grav/Common/Page/Page.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 5e02559af..91747f868 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -1424,6 +1424,17 @@ class Page if ($var !== null) { $this->modified = $var; } + + if ($this->template == 'modular') { + foreach ($this->children() as $child) { + $modified = $child->modified(); + + if ($modified > $this->modified) { + $this->modified = $modified; + } + } + } + return $this->modified; } From d65ec29408a5fb775643dd3bb47cd30b36bd3e62 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 13 Jan 2016 17:42:56 -0700 Subject: [PATCH 2/2] Moved logic into page recurse where pages are already recursed and use collection() --- system/src/Grav/Common/Page/Page.php | 10 ---------- system/src/Grav/Common/Page/Pages.php | 11 +++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 91747f868..916d99aca 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -1425,16 +1425,6 @@ class Page $this->modified = $var; } - if ($this->template == 'modular') { - foreach ($this->children() as $child) { - $modified = $child->modified(); - - if ($modified > $this->modified) { - $this->modified = $modified; - } - } - } - return $this->modified; } diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index 7193db791..a6368ec17 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -790,6 +790,17 @@ class Pages $page->routable(false); } + // Override the modified time if modular + if ($page->template() == 'modular') { + foreach ($page->collection() as $child) { + $modified = $child->modified(); + + if ($modified > $last_modified) { + $last_modified = $modified; + } + } + } + // Override the modified and ID so that it takes the latest change into account $page->modified($last_modified); $page->id($last_modified.md5($page->filePath()));