Fixed FlexObject::exists() failing sometimes just after the object has been saved

This commit is contained in:
Matias Griese
2019-07-16 09:50:30 +03:00
parent a372ae90c2
commit 57c65ad881
2 changed files with 10 additions and 0 deletions

View File

@@ -18,6 +18,7 @@
* Fixed non-existing Flex object having a bad media folder
* Fixed collections using `page@.self:` should allow modular pages if requested
* Fixed an error when trying to delete a file from non-existing Flex Object
* Fixed `FlexObject::exists()` failing sometimes just after the object has been saved
# v1.6.11
## 06/21/2019

View File

@@ -550,6 +550,15 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
}
}
// FIXME: For some reason locator caching isn't cleared for the file, investigate!
$locator = Grav::instance()['locator'];
$locator->clearCache();
// Make sure that the object exists before continuing (just in case).
if (!$this->exists()) {
throw new \RuntimeException('Saving failed: Object does not exist!');
}
if (method_exists($this, 'saveUpdatedMedia')) {
$this->saveUpdatedMedia();
}