From 0bf2a3e6d6a8059c6e3180fad2e9aa55438a9406 Mon Sep 17 00:00:00 2001
From: Bjoern Schiessle <schiessle@owncloud.com>
Date: Wed, 8 Aug 2012 11:29:44 +0200
Subject: [PATCH] while loop not needed because of recursive call of put()

---
 lib/filecache.php | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/lib/filecache.php b/lib/filecache.php
index 61470232ca3..e8b17e254e1 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -77,15 +77,11 @@ class OC_FileCache{
 			return;
 		}
 		
-		// add parent directories to the file cache if they does not exist yet.
+		// add parent directory to the file cache if it does not exist yet.
 		if ($parent == -1 && $fullpath != $root) {
-			$dirparts = explode(DIRECTORY_SEPARATOR, dirname($path));
-			$part = '';
-			while ($parent == -1) {
-				self::scanFile( DIRECTORY_SEPARATOR.$part);
-				$parent = self::getParentId($fullpath);
-				$part = array_shift($dirparts);
-			}
+			$parentDir = substr(dirname($path), 0, strrpos(dirname($path), DIRECTORY_SEPARATOR));
+			self::scanFile($parentDir);
+			$parent = self::getParentId($fullpath);
 		}
 		
 		if(!isset($data['size']) or !isset($data['mtime'])){//save incomplete data for the next time we write it
-- 
GitLab