From 073306eaa291435a84c86dfeefe8ec4597711b69 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Mon, 10 Jun 2013 18:35:47 +0200 Subject: [Fixing Updater Unit Tests on Windows] using $internalPath within call to self::correctFolder() because $path inside of it is not processed properly due to directory separator on Windows. error logging has been added in case the given 4path is not found within self::correctFolder --- lib/files/cache/updater.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/files/cache') diff --git a/lib/files/cache/updater.php b/lib/files/cache/updater.php index 417a47f3830..bf86596dfb3 100644 --- a/lib/files/cache/updater.php +++ b/lib/files/cache/updater.php @@ -7,6 +7,7 @@ */ namespace OC\Files\Cache; +use OCP\Util; /** * listen to filesystem hooks and change the cache accordingly @@ -40,7 +41,7 @@ class Updater { $scanner = $storage->getScanner($internalPath); $scanner->scan($internalPath, Scanner::SCAN_SHALLOW); $cache->correctFolderSize($internalPath); - self::correctFolder($path, $storage->filemtime($internalPath)); + self::correctFolder($internalPath, $storage->filemtime($internalPath)); } } @@ -116,6 +117,8 @@ class Updater { if ($id !== -1) { $cache->update($id, array('mtime' => $time, 'etag' => $storage->getETag($internalPath))); self::correctFolder($parent, $time); + } else { + Util::writeLog('core', 'Path not in cache: '.$internalPath, Util::ERROR); } } } -- cgit v1.2.3 From c0b25a43752427df90c4a2e6564e8325d12ee4f4 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Mon, 10 Jun 2013 18:47:36 +0200 Subject: [Fixing Updater Unit Tests on Windows] using $internalPath within call to self::correctFolder() because $path inside of it is not processed properly due to directory separator on Windows. --- lib/files/cache/updater.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/files/cache') diff --git a/lib/files/cache/updater.php b/lib/files/cache/updater.php index bf86596dfb3..de74f1634e2 100644 --- a/lib/files/cache/updater.php +++ b/lib/files/cache/updater.php @@ -60,7 +60,7 @@ class Updater { $cache = $storage->getCache($internalPath); $cache->remove($internalPath); $cache->correctFolderSize($internalPath); - self::correctFolder($path, time()); + self::correctFolder($internalPath, time()); } } @@ -85,8 +85,8 @@ class Updater { $cache->move($internalFrom, $internalTo); $cache->correctFolderSize($internalFrom); $cache->correctFolderSize($internalTo); - self::correctFolder($from, time()); - self::correctFolder($to, time()); + self::correctFolder($internalFrom, time()); + self::correctFolder($internalTo, time()); } else { self::deleteUpdate($from); self::writeUpdate($to); -- cgit v1.2.3 From 84a8aea410053686678f8efa6ba00ac63d31133e Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Thu, 13 Jun 2013 00:09:52 +0200 Subject: restore Updater functionality on non-Windows platforms --- lib/files/cache/updater.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/files/cache') diff --git a/lib/files/cache/updater.php b/lib/files/cache/updater.php index de74f1634e2..6fee0d58454 100644 --- a/lib/files/cache/updater.php +++ b/lib/files/cache/updater.php @@ -41,7 +41,7 @@ class Updater { $scanner = $storage->getScanner($internalPath); $scanner->scan($internalPath, Scanner::SCAN_SHALLOW); $cache->correctFolderSize($internalPath); - self::correctFolder($internalPath, $storage->filemtime($internalPath)); + self::correctFolder($path, $storage->filemtime($internalPath)); } } @@ -60,7 +60,7 @@ class Updater { $cache = $storage->getCache($internalPath); $cache->remove($internalPath); $cache->correctFolderSize($internalPath); - self::correctFolder($internalPath, time()); + self::correctFolder($path, time()); } } @@ -85,8 +85,8 @@ class Updater { $cache->move($internalFrom, $internalTo); $cache->correctFolderSize($internalFrom); $cache->correctFolderSize($internalTo); - self::correctFolder($internalFrom, time()); - self::correctFolder($internalTo, time()); + self::correctFolder($from, time()); + self::correctFolder($to, time()); } else { self::deleteUpdate($from); self::writeUpdate($to); -- cgit v1.2.3 From 87521f6c6e19bb2cff21ad0792604d24a6d6403e Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Fri, 14 Jun 2013 11:59:30 +0200 Subject: dirname('/test.txt') returns '\' on windows whereas on linux we get back '.' --- lib/files/cache/updater.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/files/cache') diff --git a/lib/files/cache/updater.php b/lib/files/cache/updater.php index 6fee0d58454..87c33a313a4 100644 --- a/lib/files/cache/updater.php +++ b/lib/files/cache/updater.php @@ -103,7 +103,7 @@ class Updater { static public function correctFolder($path, $time) { if ($path !== '' && $path !== '/') { $parent = dirname($path); - if ($parent === '.') { + if ($parent === '.' || $parent === '\\') { $parent = ''; } /** -- cgit v1.2.3