]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix hasUpdated for folders in swift backend
authorRobin Appelman <icewind@owncloud.com>
Fri, 5 Sep 2014 11:23:10 +0000 (13:23 +0200)
committerRobin Appelman <icewind@owncloud.com>
Fri, 5 Sep 2014 11:23:10 +0000 (13:23 +0200)
apps/files_external/lib/swift.php

index 32c7dd57afb1e77fd977f7dae54272a52ff95966..1c56d180e2f21b7d1bbaa5ce8b194cb5eb3598e5 100644 (file)
@@ -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
         */