diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-11 11:46:37 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-11 11:46:37 +0100 |
commit | f831d93f3f8aec6ef456f2675559cb5309a8fdb4 (patch) | |
tree | 1b0508552953cf536346ee0e45f933b6fbe322f9 /lib/private/setup.php | |
parent | f799b27f0e1f1021ddd2baea8f932d05af780596 (diff) | |
parent | 8903afec2687e762238d161ef9d986be9a1786a3 (diff) | |
download | nextcloud-server-f831d93f3f8aec6ef456f2675559cb5309a8fdb4.tar.gz nextcloud-server-f831d93f3f8aec6ef456f2675559cb5309a8fdb4.zip |
Merge pull request #20878 from owncloud/proper-htaccess-support-in-code-signing-checker
Also run .htaccess routine when installing on another system than Apache
Diffstat (limited to 'lib/private/setup.php')
-rw-r--r-- | lib/private/setup.php | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/lib/private/setup.php b/lib/private/setup.php index 869a87fbf13..4d11cb44a83 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -369,11 +369,9 @@ class Setup { // out that this is indeed an ownCloud data directory file_put_contents($config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/.ocdata', ''); - // Update htaccess files for apache hosts - if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) { - self::updateHtaccess(); - self::protectDataDirectory(); - } + // Update .htaccess files + Setup::updateHtaccess(); + Setup::protectDataDirectory(); //try to write logtimezone if (date_default_timezone_get()) { @@ -395,32 +393,17 @@ class Setup { } /** - * Checks if the .htaccess contains the current version parameter - * - * @return bool - */ - private function isCurrentHtaccess() { - $version = \OC_Util::getVersion(); - unset($version[3]); - - return !strpos( - file_get_contents($this->pathToHtaccess()), - 'Version: '.implode('.', $version) - ) === false; - } - - /** * Append the correct ErrorDocument path for Apache hosts - * - * @throws \OC\HintException If .htaccess does not include the current version */ public static function updateHtaccess() { + // From CLI we don't know the defined web root. Thus we can't write any + // directives into the .htaccess file. + if(\OC::$CLI) { + return; + } $setupHelper = new \OC\Setup(\OC::$server->getConfig(), \OC::$server->getIniWrapper(), \OC::$server->getL10N('lib'), new \OC_Defaults(), \OC::$server->getLogger(), \OC::$server->getSecureRandom()); - if(!$setupHelper->isCurrentHtaccess()) { - throw new \OC\HintException('.htaccess file has the wrong version. Please upload the correct version. Maybe you forgot to replace it after updating?'); - } $htaccessContent = file_get_contents($setupHelper->pathToHtaccess()); $content = ''; |