aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/files/cache/propagator.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/files/cache/propagator.php')
-rw-r--r--lib/private/files/cache/propagator.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/private/files/cache/propagator.php b/lib/private/files/cache/propagator.php
index bd11cef5990..50264e54d44 100644
--- a/lib/private/files/cache/propagator.php
+++ b/lib/private/files/cache/propagator.php
@@ -2,7 +2,7 @@
/**
* @author Robin Appelman <icewind@owncloud.com>
*
- * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
@@ -21,10 +21,12 @@
namespace OC\Files\Cache;
+use OCP\Files\Cache\IPropagator;
+
/**
* Propagate etags and mtimes within the storage
*/
-class Propagator {
+class Propagator implements IPropagator {
/**
* @var \OC\Files\Storage\Storage
*/
@@ -41,9 +43,10 @@ class Propagator {
/**
* @param string $internalPath
* @param int $time
+ * @param int $sizeDifference number of bytes the file has grown
* @return array[] all propagated entries
*/
- public function propagateChange($internalPath, $time) {
+ public function propagateChange($internalPath, $time, $sizeDifference = 0) {
$cache = $this->storage->getCache($internalPath);
$parentId = $cache->getParentId($internalPath);
@@ -56,7 +59,12 @@ class Propagator {
}
$mtime = max($time, $entry['mtime']);
- $cache->update($parentId, ['mtime' => $mtime, 'etag' => $this->storage->getETag($entry['path'])]);
+ if ($entry['size'] === -1) {
+ $newSize = -1;
+ } else {
+ $newSize = $entry['size'] + $sizeDifference;
+ }
+ $cache->update($parentId, ['mtime' => $mtime, 'etag' => $this->storage->getETag($entry['path']), 'size' => $newSize]);
$parentId = $entry['parent'];
}