Merge pull request #1375 from nextcloud/display-that-updating-failed-for-htaccess
Display an error when updating .htaccess failed
This commit is contained in:
commit
c5189a93db
|
@ -38,8 +38,12 @@ class UpdateHtaccess extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||||
\OC\Setup::updateHtaccess();
|
if (\OC\Setup::updateHtaccess()) {
|
||||||
$output->writeln('.htaccess has been updated');
|
$output->writeln('.htaccess has been updated');
|
||||||
return 0;
|
return 0;
|
||||||
|
} else {
|
||||||
|
$output->writeln('<error>Error updating .htaccess file, not enough permissions?</error>');
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,6 +410,7 @@ class Setup {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append the correct ErrorDocument path for Apache hosts
|
* Append the correct ErrorDocument path for Apache hosts
|
||||||
|
* @return bool True when success, False otherwise
|
||||||
*/
|
*/
|
||||||
public static function updateHtaccess() {
|
public static function updateHtaccess() {
|
||||||
$config = \OC::$server->getConfig();
|
$config = \OC::$server->getConfig();
|
||||||
|
@ -418,7 +419,7 @@ class Setup {
|
||||||
if(\OC::$CLI) {
|
if(\OC::$CLI) {
|
||||||
$webRoot = $config->getSystemValue('overwrite.cli.url', '');
|
$webRoot = $config->getSystemValue('overwrite.cli.url', '');
|
||||||
if($webRoot === '') {
|
if($webRoot === '') {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
$webRoot = parse_url($webRoot, PHP_URL_PATH);
|
$webRoot = parse_url($webRoot, PHP_URL_PATH);
|
||||||
$webRoot = rtrim($webRoot, '/');
|
$webRoot = rtrim($webRoot, '/');
|
||||||
|
@ -472,9 +473,10 @@ class Setup {
|
||||||
|
|
||||||
if ($content !== '') {
|
if ($content !== '') {
|
||||||
//suppress errors in case we don't have permissions for it
|
//suppress errors in case we don't have permissions for it
|
||||||
@file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent.$content . "\n");
|
return (bool) @file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent.$content . "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function protectDataDirectory() {
|
public static function protectDataDirectory() {
|
||||||
|
|
Loading…
Reference in New Issue