* @throws \RuntimeException
*/
public function insert($file, array $data) {
- return $this->cache->insert($this->getSourcePath($file), $data);
+ return $this->getCache()->insert($this->getSourcePath($file), $data);
}
/**
* @param array $data
*/
public function update($id, array $data) {
- $this->cache->update($id, $data);
+ $this->getCache()->update($id, $data);
}
/**
* @return int
*/
public function getId($file) {
- return $this->cache->getId($this->getSourcePath($file));
+ return $this->getCache()->getId($this->getSourcePath($file));
}
/**
if ($file === '') {
return -1;
} else {
- return $this->cache->getParentId($this->getSourcePath($file));
+ return $this->getCache()->getParentId($this->getSourcePath($file));
}
}
* @return bool
*/
public function inCache($file) {
- return $this->cache->inCache($this->getSourcePath($file));
+ return $this->getCache()->inCache($this->getSourcePath($file));
}
/**
* @param string $file
*/
public function remove($file) {
- $this->cache->remove($this->getSourcePath($file));
+ $this->getCache()->remove($this->getSourcePath($file));
}
/**
* @param string $target
*/
public function move($source, $target) {
- $this->cache->move($this->getSourcePath($source), $this->getSourcePath($target));
+ $this->getCache()->move($this->getSourcePath($source), $this->getSourcePath($target));
}
/**
* remove all entries for files that are stored on the storage from the cache
*/
public function clear() {
- $this->cache->remove($this->root);
+ $this->getCache()->remove($this->root);
}
/**
* @return int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE
*/
public function getStatus($file) {
- return $this->cache->getStatus($this->getSourcePath($file));
+ return $this->getCache()->getStatus($this->getSourcePath($file));
}
private function formatSearchResults($results) {
* @return array an array of file data
*/
public function search($pattern) {
- $results = $this->cache->search($pattern);
+ $results = $this->getCache()->search($pattern);
return $this->formatSearchResults($results);
}
* @return array
*/
public function searchByMime($mimetype) {
- $results = $this->cache->searchByMime($mimetype);
+ $results = $this->getCache()->searchByMime($mimetype);
return $this->formatSearchResults($results);
}
* @return array
*/
public function searchByTag($tag, $userId) {
- $results = $this->cache->searchByTag($tag, $userId);
+ $results = $this->getCache()->searchByTag($tag, $userId);
return $this->formatSearchResults($results);
}
* @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);
+ if ($this->getCache() instanceof Cache) {
+ $this->getCache()->correctFolderSize($this->getSourcePath($path), $data);
}
}
* @return int
*/
public function calculateFolderSize($path, $entry = null) {
- if ($this->cache instanceof Cache) {
- return $this->cache->calculateFolderSize($this->getSourcePath($path), $entry);
+ if ($this->getCache() instanceof Cache) {
+ return $this->getCache()->calculateFolderSize($this->getSourcePath($path), $entry);
} else {
return 0;
}
* @return string|null
*/
public function getPathById($id) {
- $path = $this->cache->getPathById($id);
+ $path = $this->getCache()->getPathById($id);
return $this->getJailedPath($path);
}
if ($sourceCache === $this) {
return $this->move($sourcePath, $targetPath);
}
- return $this->cache->moveFromCache($sourceCache, $sourcePath, $this->getSourcePath($targetPath));
+ return $this->getCache()->moveFromCache($sourceCache, $sourcePath, $this->getSourcePath($targetPath));
}
}
$this->cache = $cache;
}
+ protected function getCache() {
+ return $this->cache;
+ }
+
/**
* Make it easy for wrappers to modify every returned cache entry
*
* @return ICacheEntry|false
*/
public function get($file) {
- $result = $this->cache->get($file);
+ $result = $this->getCache()->get($file);
if ($result) {
$result = $this->formatCacheEntry($result);
}
* @return ICacheEntry[]
*/
public function getFolderContents($folder) {
- // can't do a simple $this->cache->.... call here since getFolderContentsById needs to be called on this
+ // can't do a simple $this->getCache()->.... call here since getFolderContentsById needs to be called on this
// and not the wrapped cache
$fileId = $this->getId($folder);
return $this->getFolderContentsById($fileId);
* @return array
*/
public function getFolderContentsById($fileId) {
- $results = $this->cache->getFolderContentsById($fileId);
+ $results = $this->getCache()->getFolderContentsById($fileId);
return array_map(array($this, 'formatCacheEntry'), $results);
}
* @throws \RuntimeException
*/
public function insert($file, array $data) {
- return $this->cache->insert($file, $data);
+ return $this->getCache()->insert($file, $data);
}
/**
* @param array $data
*/
public function update($id, array $data) {
- $this->cache->update($id, $data);
+ $this->getCache()->update($id, $data);
}
/**
* @return int
*/
public function getId($file) {
- return $this->cache->getId($file);
+ return $this->getCache()->getId($file);
}
/**
* @return int
*/
public function getParentId($file) {
- return $this->cache->getParentId($file);
+ return $this->getCache()->getParentId($file);
}
/**
* @return bool
*/
public function inCache($file) {
- return $this->cache->inCache($file);
+ return $this->getCache()->inCache($file);
}
/**
* @param string $file
*/
public function remove($file) {
- $this->cache->remove($file);
+ $this->getCache()->remove($file);
}
/**
* @param string $target
*/
public function move($source, $target) {
- $this->cache->move($source, $target);
+ $this->getCache()->move($source, $target);
}
public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
- $this->cache->moveFromCache($sourceCache, $sourcePath, $targetPath);
+ $this->getCache()->moveFromCache($sourceCache, $sourcePath, $targetPath);
}
/**
* remove all entries for files that are stored on the storage from the cache
*/
public function clear() {
- $this->cache->clear();
+ $this->getCache()->clear();
}
/**
* @return int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE
*/
public function getStatus($file) {
- return $this->cache->getStatus($file);
+ return $this->getCache()->getStatus($file);
}
/**
* @return ICacheEntry[] an array of file data
*/
public function search($pattern) {
- $results = $this->cache->search($pattern);
+ $results = $this->getCache()->search($pattern);
return array_map(array($this, 'formatCacheEntry'), $results);
}
* @return ICacheEntry[]
*/
public function searchByMime($mimetype) {
- $results = $this->cache->searchByMime($mimetype);
+ $results = $this->getCache()->searchByMime($mimetype);
return array_map(array($this, 'formatCacheEntry'), $results);
}
* @return ICacheEntry[] file data
*/
public function searchByTag($tag, $userId) {
- $results = $this->cache->searchByTag($tag, $userId);
+ $results = $this->getCache()->searchByTag($tag, $userId);
return array_map(array($this, 'formatCacheEntry'), $results);
}
* @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);
+ if ($this->getCache() instanceof Cache) {
+ $this->getCache()->correctFolderSize($path, $data);
}
}
* @return int
*/
public function calculateFolderSize($path, $entry = null) {
- if ($this->cache instanceof Cache) {
- return $this->cache->calculateFolderSize($path, $entry);
+ if ($this->getCache() instanceof Cache) {
+ return $this->getCache()->calculateFolderSize($path, $entry);
} else {
return 0;
}
* @return int[]
*/
public function getAll() {
- return $this->cache->getAll();
+ return $this->getCache()->getAll();
}
/**
* @return string|bool the path of the folder or false when no folder matched
*/
public function getIncomplete() {
- return $this->cache->getIncomplete();
+ return $this->getCache()->getIncomplete();
}
/**
* @return string|null
*/
public function getPathById($id) {
- return $this->cache->getPathById($id);
+ return $this->getCache()->getPathById($id);
}
/**
* @return int
*/
public function getNumericStorageId() {
- return $this->cache->getNumericStorageId();
+ return $this->getCache()->getNumericStorageId();
}
/**