move correctFolderSize from Scanner to Cache

remotes/origin/stable5
Robin Appelman 13 years ago
parent 3f644fe70c
commit 15b8a3f987
  1. 16
      lib/files/cache/cache.php
  2. 16
      lib/files/cache/scanner.php
  3. 2
      lib/files/cache/watcher.php
  4. 2
      tests/lib/files/cache/scanner.php

@ -340,6 +340,22 @@ class Cache {
return $result->fetchAll();
}
/**
* 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
*

@ -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);
}
}
}

@ -50,7 +50,7 @@ class Watcher {
} else {
$this->scanner->scanFile($path);
}
$this->scanner->correctFolderSize($path);
$this->cache->correctFolderSize($path);
}
}

@ -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);

Loading…
Cancel
Save