]> source.dussan.org Git - nextcloud-server.git/commitdiff
DRY for creating htaccess to protect data-directory
authorBart Visscher <bartv@thisnet.nl>
Tue, 30 Oct 2012 19:57:19 +0000 (20:57 +0100)
committerBart Visscher <bartv@thisnet.nl>
Tue, 30 Oct 2012 19:57:19 +0000 (20:57 +0100)
lib/base.php
lib/setup.php

index baa384d102e625f26274427e2d2a11da2c10040f..de458cedb1e63a5ca717b4c66b553f40de63c6ce 100644 (file)
@@ -225,9 +225,7 @@ class OC{
                                if (isset($_SERVER['SERVER_SOFTWARE']) && strstr($_SERVER['SERVER_SOFTWARE'], 'Apache')) {
                                        if(!OC_Util::ishtaccessworking()) {
                                                if(!file_exists(OC::$SERVERROOT.'/data/.htaccess')) {
-                                                       $content = "deny from all\n";
-                                                       $content.= "IndexIgnore *";
-                                                       file_put_contents(OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data').'/.htaccess', $content);
+                                                       OC_Setup::protectDataDirectory();
                                                }
                                        }
                                }               
index 579a1b523ce4453ce9ae11207f3d1d8bfd366f54..1d3fbd1c8eab0958a4eab5d689dda94b1ccf631c 100644 (file)
@@ -559,6 +559,10 @@ class OC_Setup {
                $content.= "Options -Indexes\n";
                @file_put_contents(OC::$SERVERROOT.'/.htaccess', $content); //supress errors in case we don't have permissions for it
 
+               self::protectDataDirectory();
+       }
+
+       public static function protectDataDirectory() {
                $content = "deny from all\n";
                $content.= "IndexIgnore *";
                file_put_contents(OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data').'/.htaccess', $content);