Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
  • Loading branch information
rullzer authored and Backportbot committed Apr 8, 2019
commit dc99cc7eab5bcf767a45bda6a1cdec7374c09423
13 changes: 11 additions & 2 deletions lib/private/Files/SimpleFS/SimpleFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,14 @@ public function getContent() {
*
* @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();
}
}

/**
Expand All @@ -119,7 +124,11 @@ private function checkFile() {

while ($cur->stat() === false) {
$parent = $cur->getParent();
$cur->delete();
try {
$cur->delete();
} catch (NotFoundException $e) {
// Just continue then
}
$cur = $parent;
}

Expand Down
1 change: 1 addition & 0 deletions lib/public/Files/SimpleFS/ISimpleFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function getContent();
*
* @param string|resource $data
* @throws NotPermittedException
* @throws NotFoundException
* @since 11.0.0
*/
public function putContent($data);
Expand Down