Merge pull request #24202 from owncloud/backport-stable9-23972
[9.0] Call private cache methods only for `OC\Files\Cache\Cache`
This commit is contained in:
commit
6c861f71eb
|
@ -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) {
|
||||
|
|
|
@ -126,8 +126,10 @@ class Updater implements IUpdater {
|
|||
} else {
|
||||
// scanner didn't provide size info, fallback to full size calculation
|
||||
$sizeDifference = 0;
|
||||
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);
|
||||
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]);
|
||||
}
|
||||
|
||||
if ($sourceCache instanceof Cache) {
|
||||
$sourceCache->correctFolderSize($source);
|
||||
}
|
||||
if ($this->cache instanceof Cache) {
|
||||
$this->cache->correctFolderSize($target);
|
||||
}
|
||||
if ($sourceUpdater instanceof Updater) {
|
||||
$sourceUpdater->correctParentStorageMtime($source);
|
||||
}
|
||||
|
|
|
@ -106,8 +106,10 @@ class Watcher implements IWatcher {
|
|||
if ($cachedData['mimetype'] === 'httpd/unix-directory') {
|
||||
$this->cleanFolder($path);
|
||||
}
|
||||
if ($this->cache instanceof Cache) {
|
||||
$this->cache->correctFolderSize($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the cache for $path needs to be updated
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
namespace OC\Files\Cache\Wrapper;
|
||||
use OC\Files\Cache\Cache;
|
||||
|
||||
/**
|
||||
* Jail to a subdirectory of the wrapped cache
|
||||
|
@ -233,8 +234,10 @@ class CacheJail extends CacheWrapper {
|
|||
* @param array $data (optional) meta data of the folder
|
||||
*/
|
||||
public function correctFolderSize($path, $data = null) {
|
||||
if ($this->cache instanceof Cache) {
|
||||
$this->cache->correctFolderSize($this->getSourcePath($path), $data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the size of a folder and set it in the cache
|
||||
|
@ -244,7 +247,12 @@ class CacheJail extends CacheWrapper {
|
|||
* @return int
|
||||
*/
|
||||
public function calculateFolderSize($path, $entry = null) {
|
||||
if ($this->cache instanceof Cache) {
|
||||
return $this->cache->calculateFolderSize($this->getSourcePath($path), $entry);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -240,8 +240,10 @@ class CacheWrapper extends Cache {
|
|||
* @param array $data (optional) meta data of the folder
|
||||
*/
|
||||
public function correctFolderSize($path, $data = null) {
|
||||
if ($this->cache instanceof Cache) {
|
||||
$this->cache->correctFolderSize($path, $data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the size of a folder and set it in the cache
|
||||
|
@ -251,7 +253,11 @@ class CacheWrapper extends Cache {
|
|||
* @return int
|
||||
*/
|
||||
public function calculateFolderSize($path, $entry = null) {
|
||||
if ($this->cache instanceof Cache) {
|
||||
return $this->cache->calculateFolderSize($path, $entry);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue