failedcache.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. /**
  3. * @author Robin Appelman <icewind@owncloud.com>
  4. *
  5. * @copyright Copyright (c) 2016, ownCloud, Inc.
  6. * @license AGPL-3.0
  7. *
  8. * This code is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License, version 3,
  10. * as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License, version 3,
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>
  19. *
  20. */
  21. namespace OCA\Files_External\Lib;
  22. use OC\Files\Cache\CacheEntry;
  23. use OCP\Constants;
  24. use OCP\Files\Cache\ICache;
  25. /**
  26. * Storage placeholder to represent a missing precondition, storage unavailable
  27. */
  28. class FailedCache implements ICache {
  29. public function getNumericStorageId() {
  30. return -1;
  31. }
  32. public function get($file) {
  33. if ($file === '') {
  34. return new CacheEntry([
  35. 'fileid' => -1,
  36. 'size' => 0,
  37. 'mimetype' => 'httpd/unix-directory',
  38. 'mimepart' => 'httpd',
  39. 'permissions' => Constants::PERMISSION_READ,
  40. 'mtime' => time()
  41. ]);
  42. } else {
  43. return false;
  44. }
  45. }
  46. public function getFolderContents($folder) {
  47. return [];
  48. }
  49. public function getFolderContentsById($fileId) {
  50. return [];
  51. }
  52. public function put($file, array $data) {
  53. return;
  54. }
  55. public function insert($file, array $data) {
  56. return;
  57. }
  58. public function update($id, array $data) {
  59. return;
  60. }
  61. public function getId($file) {
  62. return -1;
  63. }
  64. public function getParentId($file) {
  65. return -1;
  66. }
  67. public function inCache($file) {
  68. return false;
  69. }
  70. public function remove($file) {
  71. return;
  72. }
  73. public function move($source, $target) {
  74. return;
  75. }
  76. public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
  77. return;
  78. }
  79. public function clear() {
  80. return;
  81. }
  82. public function getStatus($file) {
  83. return ICache::NOT_FOUND;
  84. }
  85. public function search($pattern) {
  86. return [];
  87. }
  88. public function searchByMime($mimetype) {
  89. return [];
  90. }
  91. public function searchByTag($tag, $userId) {
  92. return [];
  93. }
  94. public function getAll() {
  95. return [];
  96. }
  97. public function getIncomplete() {
  98. return [];
  99. }
  100. public function getPathById($id) {
  101. return null;
  102. }
  103. public function normalize($path) {
  104. return $path;
  105. }
  106. }