From 71eed76dbef92363d5f6eeb423496c6b8dac0579 Mon Sep 17 00:00:00 2001
From: Michael Gapczynski <mtgap@owncloud.com>
Date: Mon, 13 May 2013 11:17:08 -0400
Subject: [PATCH] Prevent backgroundScan() from looping if opendir() is failing
 for the same path

---
 lib/files/cache/scanner.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php
index 661bc48633..b99dea23cb 100644
--- a/lib/files/cache/scanner.php
+++ b/lib/files/cache/scanner.php
@@ -179,9 +179,11 @@ class Scanner {
 	 * walk over any folders that are not fully scanned yet and scan them
 	 */
 	public function backgroundScan() {
-		while (($path = $this->cache->getIncomplete()) !== false) {
+		$lastPath = null;
+		while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
 			$this->scan($path);
 			$this->cache->correctFolderSize($path);
+			$lastPath = $path;
 		}
 	}
 }
-- 
GitLab