aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Cache/Cache.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/Cache/Cache.php')
-rw-r--r--lib/private/Files/Cache/Cache.php145
1 files changed, 0 insertions, 145 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php
index a8d9067050d..e7f1e259e03 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -97,21 +97,10 @@ class Cache implements ICache {
return $this->storageCache;
}
- /**
- * Get the numeric storage id for this cache's storage
- *
- * @return int
- */
public function getNumericStorageId() {
return $this->storageCache->getNumericId();
}
- /**
- * get the stored metadata of a file or folder
- *
- * @param string | int $file either the path of a file or folder or the file id for a file or folder
- * @return ICacheEntry|false the cache entry as array or false if the file is not found in the cache
- */
public function get($file) {
$query = $this->getQueryBuilder();
$query->selectFileCache();
@@ -178,23 +167,11 @@ class Cache implements ICache {
return new CacheEntry($data);
}
- /**
- * get the metadata of all files stored in $folder
- *
- * @param string $folder
- * @return ICacheEntry[]
- */
public function getFolderContents($folder) {
$fileId = $this->getId($folder);
return $this->getFolderContentsById($fileId);
}
- /**
- * get the metadata of all files stored in $folder
- *
- * @param int $fileId the file id of the folder
- * @return ICacheEntry[]
- */
public function getFolderContentsById($fileId) {
if ($fileId > -1) {
$query = $this->getQueryBuilder();
@@ -217,15 +194,6 @@ class Cache implements ICache {
return [];
}
- /**
- * insert or update meta data for a file or folder
- *
- * @param string $file
- * @param array $data
- *
- * @return int file id
- * @throws \RuntimeException
- */
public function put($file, array $data) {
if (($id = $this->getId($file)) > -1) {
$this->update($id, $data);
@@ -235,15 +203,6 @@ class Cache implements ICache {
}
}
- /**
- * insert meta data for a new file or folder
- *
- * @param string $file
- * @param array $data
- *
- * @return int file id
- * @throws \RuntimeException
- */
public function insert($file, array $data) {
// normalize file
$file = $this->normalize($file);
@@ -316,12 +275,6 @@ class Cache implements ICache {
}
}
- /**
- * update the metadata of an existing file or folder in the cache
- *
- * @param int $id the fileid of the existing file or folder
- * @param array $data [$key => $value] the metadata to update, only the fields provided in the array will be updated, non-provided values will remain unchanged
- */
public function update($id, array $data) {
if (isset($data['path'])) {
// normalize path
@@ -445,16 +398,6 @@ class Cache implements ICache {
return [$params, array_filter($extensionParams)];
}
- /**
- * get the file id for a file
- *
- * A file id is a numeric id for a file or folder that's unique within an owncloud instance which stays the same for the lifetime of a file
- *
- * File ids are easiest way for apps to store references to a file since unlike paths they are not affected by renames or sharing
- *
- * @param string $file
- * @return int
- */
public function getId($file) {
// normalize file
$file = $this->normalize($file);
@@ -472,12 +415,6 @@ class Cache implements ICache {
return $id === false ? -1 : (int)$id;
}
- /**
- * get the id of the parent folder of a file
- *
- * @param string $file
- * @return int
- */
public function getParentId($file) {
if ($file === '') {
return -1;
@@ -495,23 +432,10 @@ class Cache implements ICache {
return $parent;
}
- /**
- * check if a file is available in the cache
- *
- * @param string $file
- * @return bool
- */
public function inCache($file) {
return $this->getId($file) != -1;
}
- /**
- * remove a file or folder from the cache
- *
- * when removing a folder from the cache all files and folders inside the folder will be removed as well
- *
- * @param string $file
- */
public function remove($file) {
$entry = $this->get($file);
@@ -614,12 +538,6 @@ class Cache implements ICache {
}
}
- /**
- * Move a file or folder in the cache
- *
- * @param string $source
- * @param string $target
- */
public function move($source, $target) {
$this->moveFromCache($this, $source, $target);
}
@@ -638,15 +556,6 @@ class Cache implements ICache {
return $this->storage->instanceOfStorage(Encryption::class);
}
- /**
- * Move a file or folder in the cache
- *
- * @param ICache $sourceCache
- * @param string $sourcePath
- * @param string $targetPath
- * @throws \OC\DatabaseException
- * @throws \Exception if the given storages have an invalid id
- */
public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
if ($sourceCache instanceof Cache) {
// normalize source and target
@@ -805,18 +714,6 @@ class Cache implements ICache {
$query->execute();
}
- /**
- * Get the scan status of a file
- *
- * - Cache::NOT_FOUND: File is not in the cache
- * - Cache::PARTIAL: File is not stored in the cache but some incomplete data is known
- * - Cache::SHALLOW: The folder and it's direct children are in the cache but not all sub folders are fully scanned
- * - Cache::COMPLETE: The file or folder, with all it's children) are fully scanned
- *
- * @param string $file
- *
- * @return int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE
- */
public function getStatus($file) {
// normalize file
$file = $this->normalize($file);
@@ -846,24 +743,11 @@ class Cache implements ICache {
}
}
- /**
- * search for files matching $pattern
- *
- * @param string $pattern the search pattern using SQL search syntax (e.g. '%searchstring%')
- * @return ICacheEntry[] an array of cache entries where the name matches the search pattern
- */
public function search($pattern) {
$operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', $pattern);
return $this->searchQuery(new SearchQuery($operator, 0, 0, [], null));
}
- /**
- * search for files by mimetype
- *
- * @param string $mimetype either a full mimetype to search ('text/plain') or only the first part of a mimetype ('image')
- * where it will search for all mimetypes in the group ('image/*')
- * @return ICacheEntry[] an array of cache entries where the mimetype matches the search
- */
public function searchByMime($mimetype) {
if (!str_contains($mimetype, '/')) {
$operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%');
@@ -1045,15 +929,6 @@ class Cache implements ICache {
}, $files);
}
- /**
- * find a folder in the cache which has not been fully scanned
- *
- * If multiple incomplete folders are in the cache, the one with the highest id will be returned,
- * use the one with the highest id gives the best result with the background scanner, since that is most
- * likely the folder where we stopped scanning previously
- *
- * @return string|false the path of the folder or false when no folder matched
- */
public function getIncomplete() {
// we select the fileid here first instead of directly selecting the path since this helps mariadb/mysql
// to use the correct index.
@@ -1079,12 +954,6 @@ class Cache implements ICache {
return $path ?? false;
}
- /**
- * get the path of a file on this storage by it's file id
- *
- * @param int $id the file id of the file or folder to search
- * @return string|null the path of the file (relative to the storage) or null if a file with the given id does not exists within this cache
- */
public function getPathById($id) {
$query = $this->getQueryBuilder();
$query->select('path')
@@ -1136,24 +1005,10 @@ class Cache implements ICache {
}
}
- /**
- * normalize the given path
- *
- * @param string $path
- * @return string
- */
public function normalize($path) {
return trim(\OC_Util::normalizeUnicode($path), '/');
}
- /**
- * Copy a file or folder in the cache
- *
- * @param ICache $sourceCache
- * @param ICacheEntry $sourceEntry
- * @param string $targetPath
- * @return int fileId of copied entry
- */
public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int {
if ($sourceEntry->getId() < 0) {
throw new \RuntimeException('Invalid source cache entry on copyFromCache');