fileinfo.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <?php
  2. /**
  3. * @author Joas Schilling <nickvergessen@owncloud.com>
  4. * @author Morris Jobke <hey@morrisjobke.de>
  5. * @author Robin Appelman <icewind@owncloud.com>
  6. * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
  7. * @author Thomas Müller <thomas.mueller@tmit.eu>
  8. *
  9. * @copyright Copyright (c) 2015, ownCloud, Inc.
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP\Files;
  26. /**
  27. * Interface FileInfo
  28. *
  29. * @package OCP\Files
  30. * @since 7.0.0
  31. */
  32. interface FileInfo {
  33. /**
  34. * @since 7.0.0
  35. */
  36. const TYPE_FILE = 'file';
  37. /**
  38. * @since 7.0.0
  39. */
  40. const TYPE_FOLDER = 'dir';
  41. /**
  42. * @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value
  43. * @since 8.0.0
  44. */
  45. const SPACE_NOT_COMPUTED = -1;
  46. /**
  47. * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value
  48. * @since 8.0.0
  49. */
  50. const SPACE_UNKNOWN = -2;
  51. /**
  52. * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unlimited space
  53. * @since 8.0.0
  54. */
  55. const SPACE_UNLIMITED = -3;
  56. /**
  57. * Get the Etag of the file or folder
  58. *
  59. * @return string
  60. * @since 7.0.0
  61. */
  62. public function getEtag();
  63. /**
  64. * Get the size in bytes for the file or folder
  65. *
  66. * @return int
  67. * @since 7.0.0
  68. */
  69. public function getSize();
  70. /**
  71. * Get the last modified date as timestamp for the file or folder
  72. *
  73. * @return int
  74. * @since 7.0.0
  75. */
  76. public function getMtime();
  77. /**
  78. * Get the name of the file or folder
  79. *
  80. * @return string
  81. * @since 7.0.0
  82. */
  83. public function getName();
  84. /**
  85. * Get the path relative to the storage
  86. *
  87. * @return string
  88. * @since 7.0.0
  89. */
  90. public function getInternalPath();
  91. /**
  92. * Get the absolute path
  93. *
  94. * @return string
  95. * @since 7.0.0
  96. */
  97. public function getPath();
  98. /**
  99. * Get the full mimetype of the file or folder i.e. 'image/png'
  100. *
  101. * @return string
  102. * @since 7.0.0
  103. */
  104. public function getMimetype();
  105. /**
  106. * Get the first part of the mimetype of the file or folder i.e. 'image'
  107. *
  108. * @return string
  109. * @since 7.0.0
  110. */
  111. public function getMimePart();
  112. /**
  113. * Get the storage the file or folder is storage on
  114. *
  115. * @return \OCP\Files\Storage
  116. * @since 7.0.0
  117. */
  118. public function getStorage();
  119. /**
  120. * Get the file id of the file or folder
  121. *
  122. * @return int
  123. * @since 7.0.0
  124. */
  125. public function getId();
  126. /**
  127. * Check whether the file is encrypted
  128. *
  129. * @return bool
  130. * @since 7.0.0
  131. */
  132. public function isEncrypted();
  133. /**
  134. * Get the permissions of the file or folder as bitmasked combination of the following constants
  135. * \OCP\Constants::PERMISSION_CREATE
  136. * \OCP\Constants::PERMISSION_READ
  137. * \OCP\Constants::PERMISSION_UPDATE
  138. * \OCP\Constants::PERMISSION_DELETE
  139. * \OCP\Constants::PERMISSION_SHARE
  140. * \OCP\Constants::PERMISSION_ALL
  141. *
  142. * @return int
  143. * @since 7.0.0 - namespace of constants has changed in 8.0.0
  144. */
  145. public function getPermissions();
  146. /**
  147. * Check whether this is a file or a folder
  148. *
  149. * @return \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
  150. * @since 7.0.0
  151. */
  152. public function getType();
  153. /**
  154. * Check if the file or folder is readable
  155. *
  156. * @return bool
  157. * @since 7.0.0
  158. */
  159. public function isReadable();
  160. /**
  161. * Check if a file is writable
  162. *
  163. * @return bool
  164. * @since 7.0.0
  165. */
  166. public function isUpdateable();
  167. /**
  168. * Check whether new files or folders can be created inside this folder
  169. *
  170. * @return bool
  171. * @since 8.0.0
  172. */
  173. public function isCreatable();
  174. /**
  175. * Check if a file or folder can be deleted
  176. *
  177. * @return bool
  178. * @since 7.0.0
  179. */
  180. public function isDeletable();
  181. /**
  182. * Check if a file or folder can be shared
  183. *
  184. * @return bool
  185. * @since 7.0.0
  186. */
  187. public function isShareable();
  188. /**
  189. * Check if a file or folder is shared
  190. *
  191. * @return bool
  192. * @since 7.0.0
  193. */
  194. public function isShared();
  195. /**
  196. * Check if a file or folder is mounted
  197. *
  198. * @return bool
  199. * @since 7.0.0
  200. */
  201. public function isMounted();
  202. /**
  203. * Get the mountpoint the file belongs to
  204. *
  205. * @return \OCP\Files\Mount\IMountPoint
  206. * @since 8.0.0
  207. */
  208. public function getMountPoint();
  209. }