handle not being able to write file for notify self-test

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/37617/head
Robin Appelman 3 years ago
parent 1ac7a3f107
commit 570b64aafc
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
  1. 5
      apps/files_external/lib/Command/Notify.php
  2. 3
      lib/private/Files/Storage/Common.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');

@ -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);

Loading…
Cancel
Save