From 5d360bd16f345e395f7650998e8ee4a5d252c2b5 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 8 Apr 2019 13:21:46 +0200 Subject: Harden appdata putcontent If for whatever reason appdata got into a strange state this will at least propegate up and not make it do boom the next run. Signed-off-by: Roeland Jago Douma --- lib/private/Files/SimpleFS/SimpleFile.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/private/Files/SimpleFS/SimpleFile.php') diff --git a/lib/private/Files/SimpleFS/SimpleFile.php b/lib/private/Files/SimpleFS/SimpleFile.php index 7b83e9372f7..9c9ca10650c 100644 --- a/lib/private/Files/SimpleFS/SimpleFile.php +++ b/lib/private/Files/SimpleFS/SimpleFile.php @@ -99,9 +99,14 @@ class SimpleFile implements ISimpleFile { * * @param string|resource $data * @throws NotPermittedException + * @throws NotFoundException */ public function putContent($data) { - $this->file->putContent($data); + try { + return $this->file->putContent($data); + } catch (NotFoundException $e) { + $this->checkFile(); + } } /** @@ -119,7 +124,11 @@ class SimpleFile implements ISimpleFile { while ($cur->stat() === false) { $parent = $cur->getParent(); - $cur->delete(); + try { + $cur->delete(); + } catch (NotFoundException $e) { + // Just continue then + } $cur = $parent; } -- cgit v1.2.3