summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-11-09 23:13:17 -0800
committerThomas Müller <thomas.mueller@tmit.eu>2013-11-09 23:13:17 -0800
commita8f6a2446c37b59a9406f55f43ad76248293e83f (patch)
tree5ae90c52d566de0275dc481d8be7c2db5aafd41b /lib
parent3428c03b80a851d3b68790376b1b33846e3b48c6 (diff)
parentb5e013973be7b72bde61e967d12776d91733ef04 (diff)
downloadnextcloud-server-a8f6a2446c37b59a9406f55f43ad76248293e83f.tar.gz
nextcloud-server-a8f6a2446c37b59a9406f55f43ad76248293e83f.zip
Merge pull request #5759 from owncloud/fixing-5757-master
adding proper htaccess commands for Apache 2.4
Diffstat (limited to 'lib')
-rw-r--r--lib/private/setup.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/private/setup.php b/lib/private/setup.php
index 9c3034dc06b..b5c530a091f 100644
--- a/lib/private/setup.php
+++ b/lib/private/setup.php
@@ -165,8 +165,19 @@ class OC_Setup {
}
public static function protectDataDirectory() {
- $content = "deny from all\n";
- $content.= "IndexIgnore *";
+ //Require all denied
+ $now = date('Y-m-d H:i:s');
+ $content = "# Generated by ownCloud on $now\n";
+ $content.= "# line below if for Apache 2.4\n";
+ $content.= "<ifModule mod_authz_core>\n";
+ $content.= "Require all denied\n";
+ $content.= "</ifModule>\n\n";
+ $content.= "# line below if for Apache 2.2\n";
+ $content.= "<ifModule !mod_authz_core>\n";
+ $content.= "deny from all\n";
+ $content.= "</ifModule>\n\n";
+ $content.= "# section for Apache 2.2 and 2.4\n";
+ $content.= "IndexIgnore *\n";
file_put_contents(OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data').'/.htaccess', $content);
file_put_contents(OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data').'/index.html', '');
}