diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2023-04-21 10:01:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-21 10:01:38 +0200 |
commit | 5ce0410391e19d456332de108019fff020dd9dc3 (patch) | |
tree | 00d3b2e60058e208354f9ab6ed601e936a389295 | |
parent | 768b5de3247cc1212c5e968bfefa2055c8782db8 (diff) | |
parent | 705d9d1402f1eca95bf40fec3cfb3005305732ac (diff) | |
download | nextcloud-server-5ce0410391e19d456332de108019fff020dd9dc3.tar.gz nextcloud-server-5ce0410391e19d456332de108019fff020dd9dc3.zip |
Merge pull request #37740 from nextcloud/revert-37718-revert-37701-backport/37617/stable26
[stable26] handle not being able to write file for notify self-test
-rw-r--r-- | apps/files_external/lib/Command/Notify.php | 5 | ||||
-rw-r--r-- | lib/private/Files/Storage/Common.php | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/apps/files_external/lib/Command/Notify.php b/apps/files_external/lib/Command/Notify.php index 60639f7dbe4..5013d88539b 100644 --- a/apps/files_external/lib/Command/Notify.php +++ b/apps/files_external/lib/Command/Notify.php @@ -326,7 +326,10 @@ class Notify extends Base { private function selfTest(IStorage $storage, INotifyHandler $notifyHandler, OutputInterface $output) { usleep(100 * 1000); //give time for the notify to start - $storage->file_put_contents('/.nc_test_file.txt', 'test content'); + if (!$storage->file_put_contents('/.nc_test_file.txt', 'test content')) { + $output->writeln("Failed to create test file for self-test"); + return; + } $storage->mkdir('/.nc_test_folder'); $storage->file_put_contents('/.nc_test_folder/subfile.txt', 'test content'); diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 3473eebc4a0..23f63dee264 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -207,6 +207,9 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { public function file_put_contents($path, $data) { $handle = $this->fopen($path, "w"); + if (!$handle) { + return false; + } $this->removeCachedFile($path); $count = fwrite($handle, $data); fclose($handle); |