From a1f4a0601bba05920d1f62f683a085daed65dde3 Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Fri, 5 Sep 2014 13:23:10 +0200
Subject: [PATCH] Fix hasUpdated for folders in swift backend

---
 apps/files_external/lib/swift.php | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php
index 32c7dd57af..1c56d180e2 100644
--- a/apps/files_external/lib/swift.php
+++ b/apps/files_external/lib/swift.php
@@ -509,6 +509,28 @@ class Swift extends \OC\Files\Storage\Common {
 		unlink($tmpFile);
 	}
 
+	public function hasUpdated($path, $time) {
+		if ($this->is_file($path)) {
+			return parent::hasUpdated($path, $time);
+		}
+		$path = $this->normalizePath($path);
+		$dh = $this->opendir($path);
+		$content = array();
+		while (($file = readdir($dh)) !== false) {
+			$content[] = $file;
+		}
+		if ($path === '.') {
+			$path = '';
+		}
+		$cachedContent = $this->getCache()->getFolderContents($path);
+		$cachedNames = array_map(function ($content) {
+			return $content['name'];
+		}, $cachedContent);
+		sort($cachedNames);
+		sort($content);
+		return $cachedNames != $content;
+	}
+
 	/**
 	 * check if curl is installed
 	 */
-- 
GitLab