Bundle's ancestors are now touched as well
This commit is contained in:
parent
5b173ac989
commit
897811f69a
|
@ -95,12 +95,12 @@ public function getSection(): ?Bundle
|
||||||
public function getParent(): ?Bundle
|
public function getParent(): ?Bundle
|
||||||
{
|
{
|
||||||
if (!isset($this->parent)) {
|
if (!isset($this->parent)) {
|
||||||
$parts = preg_split('#/#', $this->path, -1, PREG_SPLIT_NO_EMPTY);
|
$parentPath = dirname($this->getPath());
|
||||||
|
|
||||||
if (count($parts) > 0) {
|
if ($parentPath === $this->getPath()) {
|
||||||
$this->parent = new Bundle($parts[count($parts) - 1], $this->disk);
|
|
||||||
} else {
|
|
||||||
$this->parent = null;
|
$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->metadata()->set('lastModified', now()->toIso8601String());
|
||||||
$this->saveMetadata();
|
$this->saveMetadata();
|
||||||
|
|
||||||
|
$parent = $this->getParent();
|
||||||
|
|
||||||
|
if (!empty($parent)) {
|
||||||
|
$parent->touch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(bool $ignoreCache = false)
|
public function render(bool $ignoreCache = false)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user