2016-01-19 06:04:34 -05:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2016-01-19 06:04:34 -05:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2016-01-19 06:04:34 -05:00
|
|
|
*/
|
2016-03-10 07:38:48 -05:00
|
|
|
namespace OC\Files\Cache;
|
2016-01-19 06:04:34 -05:00
|
|
|
|
2021-05-05 12:09:53 -04:00
|
|
|
use OC\Files\Search\SearchComparison;
|
2016-02-04 10:41:27 -05:00
|
|
|
use OCP\Constants;
|
2016-01-19 06:04:34 -05:00
|
|
|
use OCP\Files\Cache\ICache;
|
2021-03-08 13:27:39 -05:00
|
|
|
use OCP\Files\Cache\ICacheEntry;
|
2021-05-05 12:09:53 -04:00
|
|
|
use OCP\Files\Search\ISearchComparison;
|
|
|
|
|
use OCP\Files\Search\ISearchOperator;
|
2017-02-02 12:20:08 -05:00
|
|
|
use OCP\Files\Search\ISearchQuery;
|
2016-01-19 06:04:34 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Storage placeholder to represent a missing precondition, storage unavailable
|
|
|
|
|
*/
|
|
|
|
|
class FailedCache implements ICache {
|
2016-03-10 07:38:48 -05:00
|
|
|
/** @var bool whether to show the failed storage in the ui */
|
2016-03-09 10:44:57 -05:00
|
|
|
private $visible;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* FailedCache constructor.
|
|
|
|
|
*
|
|
|
|
|
* @param bool $visible
|
|
|
|
|
*/
|
|
|
|
|
public function __construct($visible = true) {
|
|
|
|
|
$this->visible = $visible;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-19 06:04:34 -05:00
|
|
|
|
|
|
|
|
public function getNumericStorageId() {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function get($file) {
|
|
|
|
|
if ($file === '') {
|
|
|
|
|
return new CacheEntry([
|
|
|
|
|
'fileid' => -1,
|
|
|
|
|
'size' => 0,
|
|
|
|
|
'mimetype' => 'httpd/unix-directory',
|
|
|
|
|
'mimepart' => 'httpd',
|
2016-03-09 10:44:57 -05:00
|
|
|
'permissions' => $this->visible ? Constants::PERMISSION_READ : 0,
|
2016-01-19 06:04:34 -05:00
|
|
|
'mtime' => time()
|
|
|
|
|
]);
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getFolderContents($folder) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getFolderContentsById($fileId) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function put($file, array $data) {
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-03 12:29:24 -05:00
|
|
|
public function insert($file, array $data) {
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-19 06:04:34 -05:00
|
|
|
public function update($id, array $data) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getId($file) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getParentId($file) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function inCache($file) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function remove($file) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function move($source, $target) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function clear() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getStatus($file) {
|
|
|
|
|
return ICache::NOT_FOUND;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function search($pattern) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function searchByMime($mimetype) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-02 12:20:08 -05:00
|
|
|
public function searchQuery(ISearchQuery $query) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-19 06:04:34 -05:00
|
|
|
public function getAll() {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getIncomplete() {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getPathById($id) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function normalize($path) {
|
|
|
|
|
return $path;
|
|
|
|
|
}
|
2021-03-08 13:27:39 -05:00
|
|
|
|
|
|
|
|
public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int {
|
2024-08-23 09:10:27 -04:00
|
|
|
throw new \Exception('Invalid cache');
|
2021-03-08 13:27:39 -05:00
|
|
|
}
|
2021-05-04 13:06:02 -04:00
|
|
|
|
2021-05-05 12:09:53 -04:00
|
|
|
public function getQueryFilterForStorage(): ISearchOperator {
|
|
|
|
|
return new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', -1);
|
2021-05-04 13:06:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2016-01-19 06:04:34 -05:00
|
|
|
}
|