NonExistingFile.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. *
  8. * @license AGPL-3.0
  9. *
  10. * This code is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License, version 3,
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License, version 3,
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>
  21. *
  22. */
  23. namespace OC\Files\Node;
  24. use OCP\Files\NotFoundException;
  25. class NonExistingFile extends File {
  26. /**
  27. * @param string $newPath
  28. * @throws \OCP\Files\NotFoundException
  29. */
  30. public function rename($newPath) {
  31. throw new NotFoundException();
  32. }
  33. public function delete() {
  34. throw new NotFoundException();
  35. }
  36. public function copy($targetPath) {
  37. throw new NotFoundException();
  38. }
  39. public function touch($mtime = null) {
  40. throw new NotFoundException();
  41. }
  42. public function getId() {
  43. if ($this->fileInfo) {
  44. return parent::getId();
  45. } else {
  46. throw new NotFoundException();
  47. }
  48. }
  49. public function stat() {
  50. throw new NotFoundException();
  51. }
  52. public function getMTime() {
  53. if ($this->fileInfo) {
  54. return parent::getMTime();
  55. } else {
  56. throw new NotFoundException();
  57. }
  58. }
  59. public function getSize($includeMounts = true): int|float {
  60. if ($this->fileInfo) {
  61. return parent::getSize($includeMounts);
  62. } else {
  63. throw new NotFoundException();
  64. }
  65. }
  66. public function getEtag() {
  67. if ($this->fileInfo) {
  68. return parent::getEtag();
  69. } else {
  70. throw new NotFoundException();
  71. }
  72. }
  73. public function getPermissions() {
  74. if ($this->fileInfo) {
  75. return parent::getPermissions();
  76. } else {
  77. throw new NotFoundException();
  78. }
  79. }
  80. public function isReadable() {
  81. if ($this->fileInfo) {
  82. return parent::isReadable();
  83. } else {
  84. throw new NotFoundException();
  85. }
  86. }
  87. public function isUpdateable() {
  88. if ($this->fileInfo) {
  89. return parent::isUpdateable();
  90. } else {
  91. throw new NotFoundException();
  92. }
  93. }
  94. public function isDeletable() {
  95. if ($this->fileInfo) {
  96. return parent::isDeletable();
  97. } else {
  98. throw new NotFoundException();
  99. }
  100. }
  101. public function isShareable() {
  102. if ($this->fileInfo) {
  103. return parent::isShareable();
  104. } else {
  105. throw new NotFoundException();
  106. }
  107. }
  108. public function getContent() {
  109. throw new NotFoundException();
  110. }
  111. public function putContent($data) {
  112. throw new NotFoundException();
  113. }
  114. public function getMimeType() {
  115. if ($this->fileInfo) {
  116. return parent::getMimeType();
  117. } else {
  118. throw new NotFoundException();
  119. }
  120. }
  121. public function fopen($mode) {
  122. throw new NotFoundException();
  123. }
  124. }