diff --git a/lib/private/setup.php b/lib/private/setup.php index 9c3034dc06..b5c530a091 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.= "\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); file_put_contents(OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data').'/index.html', ''); }