Commit c5627f49 authored by Vincent Petry's avatar Vincent Petry Committed by Thomas Müller

Remove server-side htaccess test

Obsoleted by client-side and env checks
parent eeb1d30d
......@@ -25,16 +25,6 @@ script('core', [
<?php endforeach; ?>
</fieldset>
<?php endif; ?>
<?php if(!$_['htaccessWorking']): ?>
<fieldset class="warning">
<legend><strong><?php p($l->t('Security warning'));?></strong></legend>
<p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br>
<?php print_unescaped($l->t(
'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer">documentation</a>.',
link_to_docs('admin-install')
)); ?></p>
</fieldset>
<?php endif; ?>
<fieldset id="adminaccount">
<legend><?php print_unescaped($l->t( 'Create an <strong>admin account</strong>' )); ?></legend>
<p class="grouptop">
......
......@@ -198,21 +198,9 @@ class Setup {
if(!file_exists($dataDir)) {
@mkdir($dataDir);
}
$htAccessWorking = true;
if (is_dir($dataDir) && is_writable($dataDir)) {
// Protect data directory here, so we can test if the protection is working
\OC\Setup::protectDataDirectory();
try {
$util = new \OC_Util();
$htAccessWorking = $util->isHtaccessWorking(\OC::$server->getConfig());
} catch (\OC\HintException $e) {
$errors[] = [
'error' => $e->getMessage(),
'hint' => $e->getHint()
];
$htAccessWorking = false;
}
}
if (\OC_Util::runningOnMac()) {
......@@ -244,7 +232,6 @@ class Setup {
'hasOracle' => isset($databases['oci']),
'databases' => $databases,
'directory' => $dataDir,
'htaccessWorking' => $htAccessWorking,
'errors' => $errors,
];
}
......
......@@ -1208,45 +1208,6 @@ class OC_Util {
fclose($fp);
}
/**
* Check if the .htaccess file is working
* @param \OCP\IConfig $config
* @return bool
* @throws Exception
* @throws \OC\HintException If the test file can't get written.
*/
public function isHtaccessWorking(\OCP\IConfig $config) {
if (\OC::$CLI || !$config->getSystemValue('check_for_working_htaccess', true)) {
return true;
}
$testContent = $this->createHtaccessTestFile($config);
if ($testContent === false) {
return false;
}
$fileName = '/htaccesstest.txt';
$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName;
// accessing the file via http
$url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT . '/data' . $fileName);
try {
$content = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody();
} catch (\Exception $e) {
$content = false;
}
// cleanup
@unlink($testFile);
/*
* If the content is not equal to test content our .htaccess
* is working as required
*/
return $content !== $testContent;
}
/**
* Check if the setlocal call does not work. This can happen if the right
* local packages are not available on the server.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment