summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <DeepDiver1975@users.noreply.github.com>2016-04-25 14:53:37 +0200
committerThomas Müller <DeepDiver1975@users.noreply.github.com>2016-04-25 14:53:37 +0200
commit9e40b647f3c633f777c8dbe8af70f21343f2a5d5 (patch)
treede00129afe6ac6232b0d258898a3b726a9a37418
parented7e009e056cb46b67aba8827efb5fdb3961de1c (diff)
parentf31d0ce87ce3b8a11414d2fc763ce244d72c5ef1 (diff)
downloadnextcloud-server-9e40b647f3c633f777c8dbe8af70f21343f2a5d5.tar.gz
nextcloud-server-9e40b647f3c633f777c8dbe8af70f21343f2a5d5.zip
Merge pull request #24248 from owncloud/d--j-master
D j master
-rw-r--r--lib/private/Files/Cache/Scanner.php2
-rw-r--r--lib/private/Files/Cache/Updater.php16
-rw-r--r--lib/private/Files/Cache/Watcher.php4
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheJail.php12
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheWrapper.php10
5 files changed, 34 insertions, 10 deletions
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php
index feefe29d276..03aca1924b0 100644
--- a/lib/private/Files/Cache/Scanner.php
+++ b/lib/private/Files/Cache/Scanner.php
@@ -480,7 +480,7 @@ class Scanner extends BasicEmitter implements IScanner {
try {
$callback();
\OC_Hook::emit('Scanner', 'correctFolderSize', array('path' => $path));
- if ($this->cacheActive) {
+ if ($this->cacheActive && $this->cache instanceof Cache) {
$this->cache->correctFolderSize($path);
}
} catch (\OCP\Files\StorageInvalidException $e) {
diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php
index 3f80f2b6167..9e4214ad72a 100644
--- a/lib/private/Files/Cache/Updater.php
+++ b/lib/private/Files/Cache/Updater.php
@@ -126,7 +126,9 @@ class Updater implements IUpdater {
} else {
// scanner didn't provide size info, fallback to full size calculation
$sizeDifference = 0;
- $this->cache->correctFolderSize($path, $data);
+ if ($this->cache instanceof Cache) {
+ $this->cache->correctFolderSize($path, $data);
+ }
}
$this->correctParentStorageMtime($path);
$this->propagator->propagateChange($path, $time, $sizeDifference);
@@ -148,7 +150,9 @@ class Updater implements IUpdater {
}
$this->cache->remove($path);
- $this->cache->correctFolderSize($parent);
+ if ($this->cache instanceof Cache) {
+ $this->cache->correctFolderSize($parent);
+ }
$this->correctParentStorageMtime($path);
$this->propagator->propagateChange($path, time());
}
@@ -190,8 +194,12 @@ class Updater implements IUpdater {
$this->cache->update($fileId, ['mimetype' => $mimeType]);
}
- $sourceCache->correctFolderSize($source);
- $this->cache->correctFolderSize($target);
+ if ($sourceCache instanceof Cache) {
+ $sourceCache->correctFolderSize($source);
+ }
+ if ($this->cache instanceof Cache) {
+ $this->cache->correctFolderSize($target);
+ }
if ($sourceUpdater instanceof Updater) {
$sourceUpdater->correctParentStorageMtime($source);
}
diff --git a/lib/private/Files/Cache/Watcher.php b/lib/private/Files/Cache/Watcher.php
index a00e875a2d4..0cf6caf0c28 100644
--- a/lib/private/Files/Cache/Watcher.php
+++ b/lib/private/Files/Cache/Watcher.php
@@ -106,7 +106,9 @@ class Watcher implements IWatcher {
if ($cachedData['mimetype'] === 'httpd/unix-directory') {
$this->cleanFolder($path);
}
- $this->cache->correctFolderSize($path);
+ if ($this->cache instanceof Cache) {
+ $this->cache->correctFolderSize($path);
+ }
}
/**
diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php
index 88b0f23a1fc..3148d1412f4 100644
--- a/lib/private/Files/Cache/Wrapper/CacheJail.php
+++ b/lib/private/Files/Cache/Wrapper/CacheJail.php
@@ -23,6 +23,7 @@
*/
namespace OC\Files\Cache\Wrapper;
+use OC\Files\Cache\Cache;
/**
* Jail to a subdirectory of the wrapped cache
@@ -233,7 +234,9 @@ class CacheJail extends CacheWrapper {
* @param array $data (optional) meta data of the folder
*/
public function correctFolderSize($path, $data = null) {
- $this->cache->correctFolderSize($this->getSourcePath($path), $data);
+ if ($this->cache instanceof Cache) {
+ $this->cache->correctFolderSize($this->getSourcePath($path), $data);
+ }
}
/**
@@ -244,7 +247,12 @@ class CacheJail extends CacheWrapper {
* @return int
*/
public function calculateFolderSize($path, $entry = null) {
- return $this->cache->calculateFolderSize($this->getSourcePath($path), $entry);
+ if ($this->cache instanceof Cache) {
+ return $this->cache->calculateFolderSize($this->getSourcePath($path), $entry);
+ } else {
+ return 0;
+ }
+
}
/**
diff --git a/lib/private/Files/Cache/Wrapper/CacheWrapper.php b/lib/private/Files/Cache/Wrapper/CacheWrapper.php
index 8c77e3c340e..a6e6e61b8c7 100644
--- a/lib/private/Files/Cache/Wrapper/CacheWrapper.php
+++ b/lib/private/Files/Cache/Wrapper/CacheWrapper.php
@@ -240,7 +240,9 @@ class CacheWrapper extends Cache {
* @param array $data (optional) meta data of the folder
*/
public function correctFolderSize($path, $data = null) {
- $this->cache->correctFolderSize($path, $data);
+ if ($this->cache instanceof Cache) {
+ $this->cache->correctFolderSize($path, $data);
+ }
}
/**
@@ -251,7 +253,11 @@ class CacheWrapper extends Cache {
* @return int
*/
public function calculateFolderSize($path, $entry = null) {
- return $this->cache->calculateFolderSize($path, $entry);
+ if ($this->cache instanceof Cache) {
+ return $this->cache->calculateFolderSize($path, $entry);
+ } else {
+ return 0;
+ }
}
/**