1
0

Bundle's ancestors are now touched as well

This commit is contained in:
Richard Dern 2024-04-28 00:27:49 +02:00
parent 5b173ac989
commit 897811f69a

View File

@ -95,12 +95,12 @@ public function getSection(): ?Bundle
public function getParent(): ?Bundle
{
if (!isset($this->parent)) {
$parts = preg_split('#/#', $this->path, -1, PREG_SPLIT_NO_EMPTY);
$parentPath = dirname($this->getPath());
if (count($parts) > 0) {
$this->parent = new Bundle($parts[count($parts) - 1], $this->disk);
} else {
if ($parentPath === $this->getPath()) {
$this->parent = null;
} else {
$this->parent = new Bundle($parentPath, $this->getDisk());
}
}
@ -202,6 +202,12 @@ public function touch()
{
$this->metadata()->set('lastModified', now()->toIso8601String());
$this->saveMetadata();
$parent = $this->getParent();
if (!empty($parent)) {
$parent->touch();
}
}
public function render(bool $ignoreCache = false)