NonExistingFolder.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Robin Appelman <robin@icewind.nl>
  7. * @author Vincent Petry <vincent@nextcloud.com>
  8. *
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OC\Files\Node;
  25. use OCP\Files\NotFoundException;
  26. class NonExistingFolder extends Folder {
  27. /**
  28. * @param string $newPath
  29. * @throws \OCP\Files\NotFoundException
  30. */
  31. public function rename($newPath) {
  32. throw new NotFoundException();
  33. }
  34. public function delete() {
  35. throw new NotFoundException();
  36. }
  37. public function copy($targetPath) {
  38. throw new NotFoundException();
  39. }
  40. public function touch($mtime = null) {
  41. throw new NotFoundException();
  42. }
  43. public function getId() {
  44. if ($this->fileInfo) {
  45. return parent::getId();
  46. } else {
  47. throw new NotFoundException();
  48. }
  49. }
  50. public function stat() {
  51. throw new NotFoundException();
  52. }
  53. public function getMTime() {
  54. if ($this->fileInfo) {
  55. return parent::getMTime();
  56. } else {
  57. throw new NotFoundException();
  58. }
  59. }
  60. public function getSize($includeMounts = true): int|float {
  61. if ($this->fileInfo) {
  62. return parent::getSize($includeMounts);
  63. } else {
  64. throw new NotFoundException();
  65. }
  66. }
  67. public function getEtag() {
  68. if ($this->fileInfo) {
  69. return parent::getEtag();
  70. } else {
  71. throw new NotFoundException();
  72. }
  73. }
  74. public function getPermissions() {
  75. if ($this->fileInfo) {
  76. return parent::getPermissions();
  77. } else {
  78. throw new NotFoundException();
  79. }
  80. }
  81. public function isReadable() {
  82. if ($this->fileInfo) {
  83. return parent::isReadable();
  84. } else {
  85. throw new NotFoundException();
  86. }
  87. }
  88. public function isUpdateable() {
  89. if ($this->fileInfo) {
  90. return parent::isUpdateable();
  91. } else {
  92. throw new NotFoundException();
  93. }
  94. }
  95. public function isDeletable() {
  96. if ($this->fileInfo) {
  97. return parent::isDeletable();
  98. } else {
  99. throw new NotFoundException();
  100. }
  101. }
  102. public function isShareable() {
  103. if ($this->fileInfo) {
  104. return parent::isShareable();
  105. } else {
  106. throw new NotFoundException();
  107. }
  108. }
  109. public function get($path) {
  110. throw new NotFoundException();
  111. }
  112. public function getDirectoryListing() {
  113. throw new NotFoundException();
  114. }
  115. public function nodeExists($path) {
  116. return false;
  117. }
  118. public function newFolder($path) {
  119. throw new NotFoundException();
  120. }
  121. public function newFile($path, $content = null) {
  122. throw new NotFoundException();
  123. }
  124. public function search($query) {
  125. throw new NotFoundException();
  126. }
  127. public function searchByMime($mimetype) {
  128. throw new NotFoundException();
  129. }
  130. public function searchByTag($tag, $userId) {
  131. throw new NotFoundException();
  132. }
  133. public function getById($id) {
  134. throw new NotFoundException();
  135. }
  136. public function getFreeSpace() {
  137. throw new NotFoundException();
  138. }
  139. public function isCreatable() {
  140. if ($this->fileInfo) {
  141. return parent::isCreatable();
  142. } else {
  143. throw new NotFoundException();
  144. }
  145. }
  146. }