diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-11-08 18:10:54 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-11-08 18:10:54 +0100 |
commit | 15b8a3f98757f220db190c1e9489d5888b2b1015 (patch) | |
tree | e554105e14d3f6e7fee14ab6bfd46b5d6fda0e19 | |
parent | 3f644fe70c8451ab1ab877c4dd97f34366548b70 (diff) | |
download | nextcloud-server-15b8a3f98757f220db190c1e9489d5888b2b1015.tar.gz nextcloud-server-15b8a3f98757f220db190c1e9489d5888b2b1015.zip |
move correctFolderSize from Scanner to Cache
-rw-r--r-- | lib/files/cache/cache.php | 16 | ||||
-rw-r--r-- | lib/files/cache/scanner.php | 16 | ||||
-rw-r--r-- | lib/files/cache/watcher.php | 2 | ||||
-rw-r--r-- | tests/lib/files/cache/scanner.php | 2 |
4 files changed, 18 insertions, 18 deletions
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php index 83d3585bb5f..7c6bba4fadb 100644 --- a/lib/files/cache/cache.php +++ b/lib/files/cache/cache.php @@ -341,6 +341,22 @@ class Cache { } /** + * update the folder size and the size of all parent folders + * + * @param $path + */ + public function correctFolderSize($path) { + $this->calculateFolderSize($path); + if ($path !== '') { + $parent = dirname($path); + if ($parent === '.') { + $parent = ''; + } + $this->correctFolderSize($parent); + } + } + + /** * get the size of a folder and set it in the cache * * @param string $path diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php index 7062888d74a..0adde1d354d 100644 --- a/lib/files/cache/scanner.php +++ b/lib/files/cache/scanner.php @@ -107,20 +107,4 @@ class Scanner { } return $size; } - - /** - * update the folder size and the size of all parent folders - * - * @param $path - */ - public function correctFolderSize($path) { - $this->cache->calculateFolderSize($path); - if ($path !== '') { - $parent = dirname($path); - if ($parent === '.') { - $parent = ''; - } - $this->correctFolderSize($parent); - } - } } diff --git a/lib/files/cache/watcher.php b/lib/files/cache/watcher.php index f04ca9b4656..d6039d9945c 100644 --- a/lib/files/cache/watcher.php +++ b/lib/files/cache/watcher.php @@ -50,7 +50,7 @@ class Watcher { } else { $this->scanner->scanFile($path); } - $this->scanner->correctFolderSize($path); + $this->cache->correctFolderSize($path); } } diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php index 34d38c42736..f784a82dada 100644 --- a/tests/lib/files/cache/scanner.php +++ b/tests/lib/files/cache/scanner.php @@ -98,7 +98,7 @@ class Scanner extends \UnitTestCase { $this->assertNotEqual($cachedDataFolder2['size'], -1); - $this->scanner->correctFolderSize('folder'); + $this->cache->correctFolderSize('folder'); $cachedDataFolder = $this->cache->get(''); $this->assertNotEqual($cachedDataFolder['size'], -1); |