Fix retrieving of cache and scanner in Updater class

This commit is contained in:
Michael Gapczynski 2012-12-30 20:27:38 -05:00
parent d275725e23
commit 3ee3323b87
1 changed files with 11 additions and 7 deletions

View File

@ -30,11 +30,13 @@ class Updater {
* @var string $internalPath * @var string $internalPath
*/ */
list($storage, $internalPath) = self::resolvePath($path); list($storage, $internalPath) = self::resolvePath($path);
$cache = new Cache($storage); if ($storage) {
$scanner = new Scanner($storage); $cache = $storage->getCache();
$scanner = $storage->getScanner();
$scanner->scan($internalPath, Scanner::SCAN_SHALLOW); $scanner->scan($internalPath, Scanner::SCAN_SHALLOW);
$cache->correctFolderSize($internalPath); $cache->correctFolderSize($internalPath);
} }
}
static public function deleteUpdate($path) { static public function deleteUpdate($path) {
/** /**
@ -42,10 +44,12 @@ class Updater {
* @var string $internalPath * @var string $internalPath
*/ */
list($storage, $internalPath) = self::resolvePath($path); list($storage, $internalPath) = self::resolvePath($path);
$cache = new Cache($storage); if ($storage) {
$cache = $storage->getCache();
$cache->remove($internalPath); $cache->remove($internalPath);
$cache->correctFolderSize($internalPath); $cache->correctFolderSize($internalPath);
} }
}
/** /**
* @param array $params * @param array $params