NonExistingFolder.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OC\Files\Node;
  8. use OCP\Files\NotFoundException;
  9. class NonExistingFolder extends Folder {
  10. /**
  11. * @param string $newPath
  12. * @throws \OCP\Files\NotFoundException
  13. */
  14. public function rename($newPath) {
  15. throw new NotFoundException();
  16. }
  17. public function delete() {
  18. throw new NotFoundException();
  19. }
  20. public function copy($targetPath) {
  21. throw new NotFoundException();
  22. }
  23. public function touch($mtime = null) {
  24. throw new NotFoundException();
  25. }
  26. public function getId() {
  27. if ($this->fileInfo) {
  28. return parent::getId();
  29. } else {
  30. throw new NotFoundException();
  31. }
  32. }
  33. public function getInternalPath() {
  34. if ($this->fileInfo) {
  35. return parent::getInternalPath();
  36. } else {
  37. return $this->getParent()->getMountPoint()->getInternalPath($this->getPath());
  38. }
  39. }
  40. public function stat() {
  41. throw new NotFoundException();
  42. }
  43. public function getMTime() {
  44. if ($this->fileInfo) {
  45. return parent::getMTime();
  46. } else {
  47. throw new NotFoundException();
  48. }
  49. }
  50. public function getSize($includeMounts = true): int|float {
  51. if ($this->fileInfo) {
  52. return parent::getSize($includeMounts);
  53. } else {
  54. throw new NotFoundException();
  55. }
  56. }
  57. public function getEtag() {
  58. if ($this->fileInfo) {
  59. return parent::getEtag();
  60. } else {
  61. throw new NotFoundException();
  62. }
  63. }
  64. public function getPermissions() {
  65. if ($this->fileInfo) {
  66. return parent::getPermissions();
  67. } else {
  68. throw new NotFoundException();
  69. }
  70. }
  71. public function isReadable() {
  72. if ($this->fileInfo) {
  73. return parent::isReadable();
  74. } else {
  75. throw new NotFoundException();
  76. }
  77. }
  78. public function isUpdateable() {
  79. if ($this->fileInfo) {
  80. return parent::isUpdateable();
  81. } else {
  82. throw new NotFoundException();
  83. }
  84. }
  85. public function isDeletable() {
  86. if ($this->fileInfo) {
  87. return parent::isDeletable();
  88. } else {
  89. throw new NotFoundException();
  90. }
  91. }
  92. public function isShareable() {
  93. if ($this->fileInfo) {
  94. return parent::isShareable();
  95. } else {
  96. throw new NotFoundException();
  97. }
  98. }
  99. public function get($path) {
  100. throw new NotFoundException();
  101. }
  102. public function getDirectoryListing() {
  103. throw new NotFoundException();
  104. }
  105. public function nodeExists($path) {
  106. return false;
  107. }
  108. public function newFolder($path) {
  109. throw new NotFoundException();
  110. }
  111. public function newFile($path, $content = null) {
  112. throw new NotFoundException();
  113. }
  114. public function search($query) {
  115. throw new NotFoundException();
  116. }
  117. public function searchByMime($mimetype) {
  118. throw new NotFoundException();
  119. }
  120. public function searchByTag($tag, $userId) {
  121. throw new NotFoundException();
  122. }
  123. public function searchBySystemTag(string $tagName, string $userId, int $limit = 0, int $offset = 0): array {
  124. throw new NotFoundException();
  125. }
  126. public function getById($id) {
  127. throw new NotFoundException();
  128. }
  129. public function getFirstNodeById(int $id): ?\OCP\Files\Node {
  130. throw new NotFoundException();
  131. }
  132. public function getFreeSpace() {
  133. throw new NotFoundException();
  134. }
  135. public function isCreatable() {
  136. if ($this->fileInfo) {
  137. return parent::isCreatable();
  138. } else {
  139. throw new NotFoundException();
  140. }
  141. }
  142. }