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
handle not being able to write file for notify self-test
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and backportbot-nextcloud[bot] committed Apr 13, 2023
commit a9c2373db74c6dab6a84f7b60ed58854854d97fa
5 changes: 4 additions & 1 deletion apps/files_external/lib/Command/Notify.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,10 @@ private function reconnectToDatabase(IDBConnection $connection, OutputInterface

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

Expand Down
3 changes: 3 additions & 0 deletions lib/private/Files/Storage/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ public function file_get_contents($path) {

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);
Expand Down