From 9c8b1e1775ecd9cc4fbd7ce11cc94ca9c0469f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 8 Nov 2013 10:45:35 +0100 Subject: [PATCH 1/2] adding proper htaccess commands for Apache 2.4 --- lib/private/setup.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/private/setup.php b/lib/private/setup.php index 9c3034dc06..d15d4a3fbe 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -165,8 +165,15 @@ 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 - please uncomment if you run Apache 2.4\n"; + $content.= "# Require all denied\n\n"; + $content.= "# line below if for Apache 2.2 - please remove it once you upgrade to Apache 2.4\n"; + $content.= "deny from all\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', ''); } From b5e013973be7b72bde61e967d12776d91733ef04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 8 Nov 2013 17:29:14 +0100 Subject: [PATCH 2/2] implementing solution using --- lib/private/setup.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/private/setup.php b/lib/private/setup.php index d15d4a3fbe..b5c530a091 100644 --- a/lib/private/setup.php +++ b/lib/private/setup.php @@ -168,10 +168,14 @@ class OC_Setup { //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 - please uncomment if you run Apache 2.4\n"; - $content.= "# Require all denied\n\n"; - $content.= "# line below if for Apache 2.2 - please remove it once you upgrade to Apache 2.4\n"; - $content.= "deny from all\n\n"; + $content.= "# line below if for Apache 2.4\n"; + $content.= "\n"; + $content.= "Require all denied\n"; + $content.= "\n\n"; + $content.= "# line below if for Apache 2.2\n"; + $content.= "\n"; + $content.= "deny from all\n"; + $content.= "\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);