mirror of
https://github.com/nextcloud/server.git
synced 2026-04-29 18:11:41 -04:00
Fix fopen mode
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
5663f9b31e
commit
146284f170
1 changed files with 8 additions and 3 deletions
|
|
@ -112,12 +112,17 @@ class FixLegacyFileKey extends Command {
|
|||
/* If that did not throw and filekey is not empty, a legacy filekey is used */
|
||||
$clean = false;
|
||||
$output->writeln($path . ' is using a legacy filekey, migrating');
|
||||
$file = $this->rootView->fopen($path, 'w+');
|
||||
$file = $this->rootView->fopen($path, 'r+');
|
||||
if ($file) {
|
||||
fwrite($file, '');
|
||||
$firstByte = fread($file, 1);
|
||||
if ($firstByte === false) {
|
||||
$output->writeln('<error>failed to read ' . $path . '</error>');
|
||||
continue;
|
||||
}
|
||||
fwrite($file, $firstByte);
|
||||
fclose($file);
|
||||
} else {
|
||||
$output->writeln('<error>failed to open' . $path . '</error>');
|
||||
$output->writeln('<error>failed to open ' . $path . '</error>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue