Merge pull request #17106 from owncloud/htaccess-update-only-once
Only update the htaccess ErrorDocument links when they are not set yet
This commit is contained in:
commit
300d1c88d0
|
@ -402,10 +402,20 @@ class Setup {
|
||||||
throw new \OC\HintException('.htaccess file has the wrong version. Please upload the correct version. Maybe you forgot to replace it after updating?');
|
throw new \OC\HintException('.htaccess file has the wrong version. Please upload the correct version. Maybe you forgot to replace it after updating?');
|
||||||
}
|
}
|
||||||
|
|
||||||
$content = "\n";
|
$htaccessContent = file_get_contents($setupHelper->pathToHtaccess());
|
||||||
$content.= "ErrorDocument 403 ".\OC::$WEBROOT."/core/templates/403.php\n";//custom 403 error page
|
$content = '';
|
||||||
$content.= "ErrorDocument 404 ".\OC::$WEBROOT."/core/templates/404.php";//custom 404 error page
|
if (strpos($htaccessContent, 'ErrorDocument 403') === false) {
|
||||||
@file_put_contents($setupHelper->pathToHtaccess(), $content, FILE_APPEND); //suppress errors in case we don't have permissions for it
|
//custom 403 error page
|
||||||
|
$content.= "\nErrorDocument 403 ".\OC::$WEBROOT."/core/templates/403.php";
|
||||||
|
}
|
||||||
|
if (strpos($htaccessContent, 'ErrorDocument 404') === false) {
|
||||||
|
//custom 404 error page
|
||||||
|
$content.= "\nErrorDocument 404 ".\OC::$WEBROOT."/core/templates/404.php";
|
||||||
|
}
|
||||||
|
if ($content !== '') {
|
||||||
|
//suppress errors in case we don't have permissions for it
|
||||||
|
@file_put_contents($setupHelper->pathToHtaccess(), $content . "\n", FILE_APPEND);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function protectDataDirectory() {
|
public static function protectDataDirectory() {
|
||||||
|
|
Loading…
Reference in New Issue