]> source.dussan.org Git - nextcloud-server.git/commitdiff
possible fix for bombarding the server with the htaccess test during setup
authorRobin Appelman <icewind@owncloud.com>
Fri, 26 Oct 2012 16:17:43 +0000 (18:17 +0200)
committerRobin Appelman <icewind@owncloud.com>
Fri, 26 Oct 2012 16:17:43 +0000 (18:17 +0200)
lib/util.php

index ca8117d555af887e58877ab43573ba18c6ced4dd..98ea1da403986fbf8eb4d07f704551c17bb56979 100755 (executable)
@@ -64,23 +64,23 @@ class OC_Util {
        }
        
        public static function loadUserMountPoints($user) {
-               $user_dir = '/'.$user.'/files';\r
-               $user_root = OC_User::getHome($user);\r
+               $user_dir = '/'.$user.'/files';
+               $user_root = OC_User::getHome($user);
                $userdirectory = $user_root . '/files';
-               if (is_file($user_root.'/mount.php')) {\r
-                       $mountConfig = include($user_root.'/mount.php');\r
-                       if (isset($mountConfig['user'][$user])) {\r
-                               foreach ($mountConfig['user'][$user] as $mountPoint => $options) {\r
-                                       OC_Filesystem::mount($options['class'], $options['options'], $mountPoint);\r
-                               }\r
-                       }\r
-               \r
-                       $mtime=filemtime($user_root.'/mount.php');\r
-                       $previousMTime=OC_Preferences::getValue($user,'files','mountconfigmtime',0);\r
-                       if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated\r
-                               OC_FileCache::triggerUpdate($user);\r
-                               OC_Preferences::setValue($user,'files','mountconfigmtime',$mtime);\r
-                       }\r
+               if (is_file($user_root.'/mount.php')) {
+                       $mountConfig = include($user_root.'/mount.php');
+                       if (isset($mountConfig['user'][$user])) {
+                               foreach ($mountConfig['user'][$user] as $mountPoint => $options) {
+                                       OC_Filesystem::mount($options['class'], $options['options'], $mountPoint);
+                               }
+                       }
+               
+                       $mtime=filemtime($user_root.'/mount.php');
+                       $previousMTime=OC_Preferences::getValue($user,'files','mountconfigmtime',0);
+                       if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated
+                               OC_FileCache::triggerUpdate($user);
+                               OC_Preferences::setValue($user,'files','mountconfigmtime',$mtime);
+                       }
                }               
        }
 
@@ -544,6 +544,11 @@ class OC_Util {
 
                // creating a test file
                $testfile = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$filename;
+
+               if(file_exists($testfile)){// already running this test, possible recursive call
+                       return false;
+               }
+
                $fp = @fopen($testfile, 'w');
                @fwrite($fp, $testcontent);
                @fclose($fp);