verify that cache entry is valid
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
9bb73574c3
commit
436cd31bd2
|
@ -1058,6 +1058,9 @@ class Cache implements ICache {
|
||||||
* @return int fileid of copied entry
|
* @return int fileid of copied entry
|
||||||
*/
|
*/
|
||||||
public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int {
|
public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int {
|
||||||
|
if ($sourceEntry->getId() < 0) {
|
||||||
|
throw new \RuntimeException("Invalid source cache entry on copyFromCache");
|
||||||
|
}
|
||||||
$data = $this->cacheEntryToArray($sourceEntry);
|
$data = $this->cacheEntryToArray($sourceEntry);
|
||||||
$fileId = $this->put($targetPath, $data);
|
$fileId = $this->put($targetPath, $data);
|
||||||
if ($fileId <= 0) {
|
if ($fileId <= 0) {
|
||||||
|
|
Loading…
Reference in New Issue