1
0

NonExistingFile.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 NonExistingFile extends File {
  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 stat() {
  34. throw new NotFoundException();
  35. }
  36. public function getMTime() {
  37. if ($this->fileInfo) {
  38. return parent::getMTime();
  39. } else {
  40. throw new NotFoundException();
  41. }
  42. }
  43. public function getSize($includeMounts = true): int|float {
  44. if ($this->fileInfo) {
  45. return parent::getSize($includeMounts);
  46. } else {
  47. throw new NotFoundException();
  48. }
  49. }
  50. public function getEtag() {
  51. if ($this->fileInfo) {
  52. return parent::getEtag();
  53. } else {
  54. throw new NotFoundException();
  55. }
  56. }
  57. public function getPermissions() {
  58. if ($this->fileInfo) {
  59. return parent::getPermissions();
  60. } else {
  61. throw new NotFoundException();
  62. }
  63. }
  64. public function isReadable() {
  65. if ($this->fileInfo) {
  66. return parent::isReadable();
  67. } else {
  68. throw new NotFoundException();
  69. }
  70. }
  71. public function isUpdateable() {
  72. if ($this->fileInfo) {
  73. return parent::isUpdateable();
  74. } else {
  75. throw new NotFoundException();
  76. }
  77. }
  78. public function isDeletable() {
  79. if ($this->fileInfo) {
  80. return parent::isDeletable();
  81. } else {
  82. throw new NotFoundException();
  83. }
  84. }
  85. public function isShareable() {
  86. if ($this->fileInfo) {
  87. return parent::isShareable();
  88. } else {
  89. throw new NotFoundException();
  90. }
  91. }
  92. public function getContent() {
  93. throw new NotFoundException();
  94. }
  95. public function putContent($data) {
  96. throw new NotFoundException();
  97. }
  98. public function getMimeType() {
  99. if ($this->fileInfo) {
  100. return parent::getMimeType();
  101. } else {
  102. throw new NotFoundException();
  103. }
  104. }
  105. public function fopen($mode) {
  106. throw new NotFoundException();
  107. }
  108. }