Skip to content
Open
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
2 changes: 1 addition & 1 deletion core/Command/Maintenance/UpdateHtaccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('.htaccess has been updated');
return 0;
} else {
$output->writeln('<error>Error updating .htaccess file, not enough permissions, not enough free space or "overwrite.cli.url" set to an invalid URL?</error>');
$output->writeln('<error>Error updating (or creating) .htaccess file, not enough permissions, not enough free space or "overwrite.cli.url" set to an invalid URL?</error>');
return 1;
}
}
Expand Down
9 changes: 9 additions & 0 deletions lib/private/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,15 @@ public static function updateHtaccess(): bool {

$setupHelper = Server::get(\OC\Setup::class);

// Note: The .htaccess file also needs to exist, otherwise `is_writable()`
// will return false, even though the file could be written.
// This function writes the .htaccess file in that case.
if (!file_exists($setupHelper->pathToHtaccess())) {
if (!touch($setupHelper->pathToHtaccess())) {
return false;
}
}

if (!is_writable($setupHelper->pathToHtaccess())) {
return false;
}
Expand Down