1
0

FileInfo.php 5.1 KB

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