diff options
| author | David Siegfried <david.siegfried@uni-vechta.de> | 2024-11-05 09:48:54 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-11-05 09:48:54 +0000 |
| commit | 5e4964cef121f35e93e85c1e2101e55b8077935d (patch) | |
| tree | 6d469d63e9ecf883868e63a90027628f93a06244 /lib/models/File.php | |
| parent | 31480dbdf30e1b656ea702604f142aa5ee531da2 (diff) | |
prevent php-warnings, fixes #4823
Closes #4823
Merge request studip/studip!3608
Diffstat (limited to 'lib/models/File.php')
| -rw-r--r-- | lib/models/File.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/models/File.php b/lib/models/File.php index 6cd0151..603a228 100644 --- a/lib/models/File.php +++ b/lib/models/File.php @@ -87,7 +87,7 @@ class File extends SimpleORMap */ public function deleteDataFile() { - return @unlink($this->getPath()); + return file_exists($this->getPath()) && unlink($this->getPath()); } /** @@ -107,7 +107,7 @@ class File extends SimpleORMap if (!@move_uploaded_file($path_to_file, $newpath)) { return false; } - } else if (!@copy($path_to_file, $newpath)) { + } else if (!file_exists($path_to_file) || !@copy($path_to_file, $newpath)) { return false; } $this->size = filesize($newpath); |
