@@ -27,62 +27,62 @@ |
||
| 27 | 27 | use OCP\Settings\IIconSection; |
| 28 | 28 | |
| 29 | 29 | class Section implements IIconSection { |
| 30 | - /** @var string */ |
|
| 31 | - private $id; |
|
| 32 | - /** @var string */ |
|
| 33 | - private $name; |
|
| 34 | - /** @var int */ |
|
| 35 | - private $priority; |
|
| 36 | - /** @var string */ |
|
| 37 | - private $icon; |
|
| 30 | + /** @var string */ |
|
| 31 | + private $id; |
|
| 32 | + /** @var string */ |
|
| 33 | + private $name; |
|
| 34 | + /** @var int */ |
|
| 35 | + private $priority; |
|
| 36 | + /** @var string */ |
|
| 37 | + private $icon; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param string $id |
|
| 41 | - * @param string $name |
|
| 42 | - * @param int $priority |
|
| 43 | - * @param string $icon |
|
| 44 | - */ |
|
| 45 | - public function __construct($id, $name, $priority, $icon = '') { |
|
| 46 | - $this->id = $id; |
|
| 47 | - $this->name = $name; |
|
| 48 | - $this->priority = $priority; |
|
| 49 | - $this->icon = $icon; |
|
| 50 | - } |
|
| 39 | + /** |
|
| 40 | + * @param string $id |
|
| 41 | + * @param string $name |
|
| 42 | + * @param int $priority |
|
| 43 | + * @param string $icon |
|
| 44 | + */ |
|
| 45 | + public function __construct($id, $name, $priority, $icon = '') { |
|
| 46 | + $this->id = $id; |
|
| 47 | + $this->name = $name; |
|
| 48 | + $this->priority = $priority; |
|
| 49 | + $this->icon = $icon; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @return string The ID of the section. It is supposed to be a lower case string, |
|
| 54 | - * e.g. 'ldap' |
|
| 55 | - */ |
|
| 56 | - public function getID() { |
|
| 57 | - return $this->id; |
|
| 58 | - } |
|
| 52 | + /** |
|
| 53 | + * @return string The ID of the section. It is supposed to be a lower case string, |
|
| 54 | + * e.g. 'ldap' |
|
| 55 | + */ |
|
| 56 | + public function getID() { |
|
| 57 | + return $this->id; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @return string The translated name as it should be displayed, e.g. 'LDAP / AD |
|
| 62 | - * integration'. Use the L10N service to translate it. |
|
| 63 | - */ |
|
| 64 | - public function getName() { |
|
| 65 | - return $this->name; |
|
| 66 | - } |
|
| 60 | + /** |
|
| 61 | + * @return string The translated name as it should be displayed, e.g. 'LDAP / AD |
|
| 62 | + * integration'. Use the L10N service to translate it. |
|
| 63 | + */ |
|
| 64 | + public function getName() { |
|
| 65 | + return $this->name; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @return int whether the form should be rather on the top or bottom of |
|
| 70 | - * the settings navigation. The sections are arranged in ascending order of |
|
| 71 | - * the priority values. It is required to return a value between 0 and 99. |
|
| 72 | - * |
|
| 73 | - * E.g.: 70 |
|
| 74 | - */ |
|
| 75 | - public function getPriority() { |
|
| 76 | - return $this->priority; |
|
| 77 | - } |
|
| 68 | + /** |
|
| 69 | + * @return int whether the form should be rather on the top or bottom of |
|
| 70 | + * the settings navigation. The sections are arranged in ascending order of |
|
| 71 | + * the priority values. It is required to return a value between 0 and 99. |
|
| 72 | + * |
|
| 73 | + * E.g.: 70 |
|
| 74 | + */ |
|
| 75 | + public function getPriority() { |
|
| 76 | + return $this->priority; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * @return string The relative path to an 16*16 icon describing the section. |
|
| 81 | - * e.g. '/core/img/places/files.svg' |
|
| 82 | - * |
|
| 83 | - * @since 12 |
|
| 84 | - */ |
|
| 85 | - public function getIcon() { |
|
| 86 | - return $this->icon; |
|
| 87 | - } |
|
| 79 | + /** |
|
| 80 | + * @return string The relative path to an 16*16 icon describing the section. |
|
| 81 | + * e.g. '/core/img/places/files.svg' |
|
| 82 | + * |
|
| 83 | + * @since 12 |
|
| 84 | + */ |
|
| 85 | + public function getIcon() { |
|
| 86 | + return $this->icon; |
|
| 87 | + } |
|
| 88 | 88 | } |
@@ -39,251 +39,251 @@ |
||
| 39 | 39 | * @since 6.0.0 - extends FileInfo was added in 8.0.0 |
| 40 | 40 | */ |
| 41 | 41 | interface Node extends FileInfo { |
| 42 | - /** |
|
| 43 | - * Move the file or folder to a new location |
|
| 44 | - * |
|
| 45 | - * @param string $targetPath the absolute target path |
|
| 46 | - * @return Node |
|
| 47 | - * @throws NotFoundException |
|
| 48 | - * @throws NotPermittedException if move not allowed or failed |
|
| 49 | - * @throws LockedException |
|
| 50 | - * @throws InvalidPathException |
|
| 51 | - * @since 6.0.0 |
|
| 52 | - */ |
|
| 53 | - public function move($targetPath); |
|
| 42 | + /** |
|
| 43 | + * Move the file or folder to a new location |
|
| 44 | + * |
|
| 45 | + * @param string $targetPath the absolute target path |
|
| 46 | + * @return Node |
|
| 47 | + * @throws NotFoundException |
|
| 48 | + * @throws NotPermittedException if move not allowed or failed |
|
| 49 | + * @throws LockedException |
|
| 50 | + * @throws InvalidPathException |
|
| 51 | + * @since 6.0.0 |
|
| 52 | + */ |
|
| 53 | + public function move($targetPath); |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Delete the file or folder |
|
| 57 | - * |
|
| 58 | - * @return void |
|
| 59 | - * @throws NotPermittedException |
|
| 60 | - * @throws InvalidPathException |
|
| 61 | - * @throws NotFoundException |
|
| 62 | - * @since 6.0.0 |
|
| 63 | - */ |
|
| 64 | - public function delete(); |
|
| 55 | + /** |
|
| 56 | + * Delete the file or folder |
|
| 57 | + * |
|
| 58 | + * @return void |
|
| 59 | + * @throws NotPermittedException |
|
| 60 | + * @throws InvalidPathException |
|
| 61 | + * @throws NotFoundException |
|
| 62 | + * @since 6.0.0 |
|
| 63 | + */ |
|
| 64 | + public function delete(); |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Copy the file or folder to a new location |
|
| 68 | - * |
|
| 69 | - * @param string $targetPath the absolute target path |
|
| 70 | - * @return Node |
|
| 71 | - * @since 6.0.0 |
|
| 72 | - */ |
|
| 73 | - public function copy($targetPath); |
|
| 66 | + /** |
|
| 67 | + * Copy the file or folder to a new location |
|
| 68 | + * |
|
| 69 | + * @param string $targetPath the absolute target path |
|
| 70 | + * @return Node |
|
| 71 | + * @since 6.0.0 |
|
| 72 | + */ |
|
| 73 | + public function copy($targetPath); |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Change the modified date of the file or folder |
|
| 77 | - * If $mtime is omitted the current time will be used |
|
| 78 | - * |
|
| 79 | - * @param int $mtime (optional) modified date as unix timestamp |
|
| 80 | - * @throws InvalidPathException |
|
| 81 | - * @throws NotFoundException |
|
| 82 | - * @throws NotPermittedException |
|
| 83 | - * @return void |
|
| 84 | - * @since 6.0.0 |
|
| 85 | - */ |
|
| 86 | - public function touch($mtime = null); |
|
| 75 | + /** |
|
| 76 | + * Change the modified date of the file or folder |
|
| 77 | + * If $mtime is omitted the current time will be used |
|
| 78 | + * |
|
| 79 | + * @param int $mtime (optional) modified date as unix timestamp |
|
| 80 | + * @throws InvalidPathException |
|
| 81 | + * @throws NotFoundException |
|
| 82 | + * @throws NotPermittedException |
|
| 83 | + * @return void |
|
| 84 | + * @since 6.0.0 |
|
| 85 | + */ |
|
| 86 | + public function touch($mtime = null); |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Get the storage backend the file or folder is stored on |
|
| 90 | - * |
|
| 91 | - * @return IStorage |
|
| 92 | - * @throws NotFoundException |
|
| 93 | - * @since 6.0.0 |
|
| 94 | - */ |
|
| 95 | - public function getStorage(); |
|
| 88 | + /** |
|
| 89 | + * Get the storage backend the file or folder is stored on |
|
| 90 | + * |
|
| 91 | + * @return IStorage |
|
| 92 | + * @throws NotFoundException |
|
| 93 | + * @since 6.0.0 |
|
| 94 | + */ |
|
| 95 | + public function getStorage(); |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Get the full path of the file or folder |
|
| 99 | - * |
|
| 100 | - * @return string |
|
| 101 | - * @since 6.0.0 |
|
| 102 | - */ |
|
| 103 | - public function getPath(); |
|
| 97 | + /** |
|
| 98 | + * Get the full path of the file or folder |
|
| 99 | + * |
|
| 100 | + * @return string |
|
| 101 | + * @since 6.0.0 |
|
| 102 | + */ |
|
| 103 | + public function getPath(); |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * Get the path of the file or folder relative to the mountpoint of it's storage |
|
| 107 | - * |
|
| 108 | - * @return string |
|
| 109 | - * @since 6.0.0 |
|
| 110 | - */ |
|
| 111 | - public function getInternalPath(); |
|
| 105 | + /** |
|
| 106 | + * Get the path of the file or folder relative to the mountpoint of it's storage |
|
| 107 | + * |
|
| 108 | + * @return string |
|
| 109 | + * @since 6.0.0 |
|
| 110 | + */ |
|
| 111 | + public function getInternalPath(); |
|
| 112 | 112 | |
| 113 | - /** |
|
| 114 | - * Get the internal file id for the file or folder |
|
| 115 | - * |
|
| 116 | - * @return int |
|
| 117 | - * @throws InvalidPathException |
|
| 118 | - * @throws NotFoundException |
|
| 119 | - * @since 6.0.0 |
|
| 120 | - */ |
|
| 121 | - public function getId(); |
|
| 113 | + /** |
|
| 114 | + * Get the internal file id for the file or folder |
|
| 115 | + * |
|
| 116 | + * @return int |
|
| 117 | + * @throws InvalidPathException |
|
| 118 | + * @throws NotFoundException |
|
| 119 | + * @since 6.0.0 |
|
| 120 | + */ |
|
| 121 | + public function getId(); |
|
| 122 | 122 | |
| 123 | - /** |
|
| 124 | - * Get metadata of the file or folder |
|
| 125 | - * The returned array contains the following values: |
|
| 126 | - * - mtime |
|
| 127 | - * - size |
|
| 128 | - * |
|
| 129 | - * @return array |
|
| 130 | - * @since 6.0.0 |
|
| 131 | - */ |
|
| 132 | - public function stat(); |
|
| 123 | + /** |
|
| 124 | + * Get metadata of the file or folder |
|
| 125 | + * The returned array contains the following values: |
|
| 126 | + * - mtime |
|
| 127 | + * - size |
|
| 128 | + * |
|
| 129 | + * @return array |
|
| 130 | + * @since 6.0.0 |
|
| 131 | + */ |
|
| 132 | + public function stat(); |
|
| 133 | 133 | |
| 134 | - /** |
|
| 135 | - * Get the modified date of the file or folder as unix timestamp |
|
| 136 | - * |
|
| 137 | - * @return int |
|
| 138 | - * @throws InvalidPathException |
|
| 139 | - * @throws NotFoundException |
|
| 140 | - * @since 6.0.0 |
|
| 141 | - */ |
|
| 142 | - public function getMTime(); |
|
| 134 | + /** |
|
| 135 | + * Get the modified date of the file or folder as unix timestamp |
|
| 136 | + * |
|
| 137 | + * @return int |
|
| 138 | + * @throws InvalidPathException |
|
| 139 | + * @throws NotFoundException |
|
| 140 | + * @since 6.0.0 |
|
| 141 | + */ |
|
| 142 | + public function getMTime(); |
|
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Get the size of the file or folder in bytes |
|
| 146 | - * |
|
| 147 | - * @param bool $includeMounts |
|
| 148 | - * @return int |
|
| 149 | - * @throws InvalidPathException |
|
| 150 | - * @throws NotFoundException |
|
| 151 | - * @since 6.0.0 |
|
| 152 | - */ |
|
| 153 | - public function getSize($includeMounts = true); |
|
| 144 | + /** |
|
| 145 | + * Get the size of the file or folder in bytes |
|
| 146 | + * |
|
| 147 | + * @param bool $includeMounts |
|
| 148 | + * @return int |
|
| 149 | + * @throws InvalidPathException |
|
| 150 | + * @throws NotFoundException |
|
| 151 | + * @since 6.0.0 |
|
| 152 | + */ |
|
| 153 | + public function getSize($includeMounts = true); |
|
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * Get the Etag of the file or folder |
|
| 157 | - * The Etag is an string id used to detect changes to a file or folder, |
|
| 158 | - * every time the file or folder is changed the Etag will change to |
|
| 159 | - * |
|
| 160 | - * @return string |
|
| 161 | - * @throws InvalidPathException |
|
| 162 | - * @throws NotFoundException |
|
| 163 | - * @since 6.0.0 |
|
| 164 | - */ |
|
| 165 | - public function getEtag(); |
|
| 155 | + /** |
|
| 156 | + * Get the Etag of the file or folder |
|
| 157 | + * The Etag is an string id used to detect changes to a file or folder, |
|
| 158 | + * every time the file or folder is changed the Etag will change to |
|
| 159 | + * |
|
| 160 | + * @return string |
|
| 161 | + * @throws InvalidPathException |
|
| 162 | + * @throws NotFoundException |
|
| 163 | + * @since 6.0.0 |
|
| 164 | + */ |
|
| 165 | + public function getEtag(); |
|
| 166 | 166 | |
| 167 | 167 | |
| 168 | - /** |
|
| 169 | - * Get the permissions of the file or folder as a combination of one or more of the following constants: |
|
| 170 | - * - \OCP\Constants::PERMISSION_READ |
|
| 171 | - * - \OCP\Constants::PERMISSION_UPDATE |
|
| 172 | - * - \OCP\Constants::PERMISSION_CREATE |
|
| 173 | - * - \OCP\Constants::PERMISSION_DELETE |
|
| 174 | - * - \OCP\Constants::PERMISSION_SHARE |
|
| 175 | - * |
|
| 176 | - * @return int |
|
| 177 | - * @throws InvalidPathException |
|
| 178 | - * @throws NotFoundException |
|
| 179 | - * @since 6.0.0 - namespace of constants has changed in 8.0.0 |
|
| 180 | - */ |
|
| 181 | - public function getPermissions(); |
|
| 168 | + /** |
|
| 169 | + * Get the permissions of the file or folder as a combination of one or more of the following constants: |
|
| 170 | + * - \OCP\Constants::PERMISSION_READ |
|
| 171 | + * - \OCP\Constants::PERMISSION_UPDATE |
|
| 172 | + * - \OCP\Constants::PERMISSION_CREATE |
|
| 173 | + * - \OCP\Constants::PERMISSION_DELETE |
|
| 174 | + * - \OCP\Constants::PERMISSION_SHARE |
|
| 175 | + * |
|
| 176 | + * @return int |
|
| 177 | + * @throws InvalidPathException |
|
| 178 | + * @throws NotFoundException |
|
| 179 | + * @since 6.0.0 - namespace of constants has changed in 8.0.0 |
|
| 180 | + */ |
|
| 181 | + public function getPermissions(); |
|
| 182 | 182 | |
| 183 | - /** |
|
| 184 | - * Check if the file or folder is readable |
|
| 185 | - * |
|
| 186 | - * @return bool |
|
| 187 | - * @throws InvalidPathException |
|
| 188 | - * @throws NotFoundException |
|
| 189 | - * @since 6.0.0 |
|
| 190 | - */ |
|
| 191 | - public function isReadable(); |
|
| 183 | + /** |
|
| 184 | + * Check if the file or folder is readable |
|
| 185 | + * |
|
| 186 | + * @return bool |
|
| 187 | + * @throws InvalidPathException |
|
| 188 | + * @throws NotFoundException |
|
| 189 | + * @since 6.0.0 |
|
| 190 | + */ |
|
| 191 | + public function isReadable(); |
|
| 192 | 192 | |
| 193 | - /** |
|
| 194 | - * Check if the file or folder is writable |
|
| 195 | - * |
|
| 196 | - * @return bool |
|
| 197 | - * @throws InvalidPathException |
|
| 198 | - * @throws NotFoundException |
|
| 199 | - * @since 6.0.0 |
|
| 200 | - */ |
|
| 201 | - public function isUpdateable(); |
|
| 193 | + /** |
|
| 194 | + * Check if the file or folder is writable |
|
| 195 | + * |
|
| 196 | + * @return bool |
|
| 197 | + * @throws InvalidPathException |
|
| 198 | + * @throws NotFoundException |
|
| 199 | + * @since 6.0.0 |
|
| 200 | + */ |
|
| 201 | + public function isUpdateable(); |
|
| 202 | 202 | |
| 203 | - /** |
|
| 204 | - * Check if the file or folder is deletable |
|
| 205 | - * |
|
| 206 | - * @return bool |
|
| 207 | - * @throws InvalidPathException |
|
| 208 | - * @throws NotFoundException |
|
| 209 | - * @since 6.0.0 |
|
| 210 | - */ |
|
| 211 | - public function isDeletable(); |
|
| 203 | + /** |
|
| 204 | + * Check if the file or folder is deletable |
|
| 205 | + * |
|
| 206 | + * @return bool |
|
| 207 | + * @throws InvalidPathException |
|
| 208 | + * @throws NotFoundException |
|
| 209 | + * @since 6.0.0 |
|
| 210 | + */ |
|
| 211 | + public function isDeletable(); |
|
| 212 | 212 | |
| 213 | - /** |
|
| 214 | - * Check if the file or folder is shareable |
|
| 215 | - * |
|
| 216 | - * @return bool |
|
| 217 | - * @throws InvalidPathException |
|
| 218 | - * @throws NotFoundException |
|
| 219 | - * @since 6.0.0 |
|
| 220 | - */ |
|
| 221 | - public function isShareable(); |
|
| 213 | + /** |
|
| 214 | + * Check if the file or folder is shareable |
|
| 215 | + * |
|
| 216 | + * @return bool |
|
| 217 | + * @throws InvalidPathException |
|
| 218 | + * @throws NotFoundException |
|
| 219 | + * @since 6.0.0 |
|
| 220 | + */ |
|
| 221 | + public function isShareable(); |
|
| 222 | 222 | |
| 223 | - /** |
|
| 224 | - * Get the parent folder of the file or folder |
|
| 225 | - * |
|
| 226 | - * @return Folder |
|
| 227 | - * @since 6.0.0 |
|
| 228 | - */ |
|
| 229 | - public function getParent(); |
|
| 223 | + /** |
|
| 224 | + * Get the parent folder of the file or folder |
|
| 225 | + * |
|
| 226 | + * @return Folder |
|
| 227 | + * @since 6.0.0 |
|
| 228 | + */ |
|
| 229 | + public function getParent(); |
|
| 230 | 230 | |
| 231 | - /** |
|
| 232 | - * Get the filename of the file or folder |
|
| 233 | - * |
|
| 234 | - * @return string |
|
| 235 | - * @since 6.0.0 |
|
| 236 | - */ |
|
| 237 | - public function getName(); |
|
| 231 | + /** |
|
| 232 | + * Get the filename of the file or folder |
|
| 233 | + * |
|
| 234 | + * @return string |
|
| 235 | + * @since 6.0.0 |
|
| 236 | + */ |
|
| 237 | + public function getName(); |
|
| 238 | 238 | |
| 239 | - /** |
|
| 240 | - * Acquire a lock on this file or folder. |
|
| 241 | - * |
|
| 242 | - * A shared (read) lock will prevent any exclusive (write) locks from being created but any number of shared locks |
|
| 243 | - * can be active at the same time. |
|
| 244 | - * An exclusive lock will prevent any other lock from being created (both shared and exclusive). |
|
| 245 | - * |
|
| 246 | - * A locked exception will be thrown if any conflicting lock already exists |
|
| 247 | - * |
|
| 248 | - * Note that this uses mandatory locking, if you acquire an exclusive lock on a file it will block *all* |
|
| 249 | - * other operations for that file, even within the same php process. |
|
| 250 | - * |
|
| 251 | - * Acquiring any lock on a file will also create a shared lock on all parent folders of that file. |
|
| 252 | - * |
|
| 253 | - * Note that in most cases you won't need to manually manage the locks for any files you're working with, |
|
| 254 | - * any filesystem operation will automatically acquire the relevant locks for that operation. |
|
| 255 | - * |
|
| 256 | - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
|
| 257 | - * @throws LockedException |
|
| 258 | - * @since 9.1.0 |
|
| 259 | - */ |
|
| 260 | - public function lock($type); |
|
| 239 | + /** |
|
| 240 | + * Acquire a lock on this file or folder. |
|
| 241 | + * |
|
| 242 | + * A shared (read) lock will prevent any exclusive (write) locks from being created but any number of shared locks |
|
| 243 | + * can be active at the same time. |
|
| 244 | + * An exclusive lock will prevent any other lock from being created (both shared and exclusive). |
|
| 245 | + * |
|
| 246 | + * A locked exception will be thrown if any conflicting lock already exists |
|
| 247 | + * |
|
| 248 | + * Note that this uses mandatory locking, if you acquire an exclusive lock on a file it will block *all* |
|
| 249 | + * other operations for that file, even within the same php process. |
|
| 250 | + * |
|
| 251 | + * Acquiring any lock on a file will also create a shared lock on all parent folders of that file. |
|
| 252 | + * |
|
| 253 | + * Note that in most cases you won't need to manually manage the locks for any files you're working with, |
|
| 254 | + * any filesystem operation will automatically acquire the relevant locks for that operation. |
|
| 255 | + * |
|
| 256 | + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
|
| 257 | + * @throws LockedException |
|
| 258 | + * @since 9.1.0 |
|
| 259 | + */ |
|
| 260 | + public function lock($type); |
|
| 261 | 261 | |
| 262 | - /** |
|
| 263 | - * Check the type of an existing lock. |
|
| 264 | - * |
|
| 265 | - * A shared lock can be changed to an exclusive lock is there is exactly one shared lock on the file, |
|
| 266 | - * an exclusive lock can always be changed to a shared lock since there can only be one exclusive lock int he first place. |
|
| 267 | - * |
|
| 268 | - * A locked exception will be thrown when these preconditions are not met. |
|
| 269 | - * Note that this is also the case if no existing lock exists for the file. |
|
| 270 | - * |
|
| 271 | - * @param int $targetType \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
|
| 272 | - * @throws LockedException |
|
| 273 | - * @since 9.1.0 |
|
| 274 | - */ |
|
| 275 | - public function changeLock($targetType); |
|
| 262 | + /** |
|
| 263 | + * Check the type of an existing lock. |
|
| 264 | + * |
|
| 265 | + * A shared lock can be changed to an exclusive lock is there is exactly one shared lock on the file, |
|
| 266 | + * an exclusive lock can always be changed to a shared lock since there can only be one exclusive lock int he first place. |
|
| 267 | + * |
|
| 268 | + * A locked exception will be thrown when these preconditions are not met. |
|
| 269 | + * Note that this is also the case if no existing lock exists for the file. |
|
| 270 | + * |
|
| 271 | + * @param int $targetType \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
|
| 272 | + * @throws LockedException |
|
| 273 | + * @since 9.1.0 |
|
| 274 | + */ |
|
| 275 | + public function changeLock($targetType); |
|
| 276 | 276 | |
| 277 | - /** |
|
| 278 | - * Release an existing lock. |
|
| 279 | - * |
|
| 280 | - * This will also free up the shared locks on any parent folder that were automatically acquired when locking the file. |
|
| 281 | - * |
|
| 282 | - * Note that this method will not give any sort of error when trying to free a lock that doesn't exist. |
|
| 283 | - * |
|
| 284 | - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
|
| 285 | - * @throws LockedException |
|
| 286 | - * @since 9.1.0 |
|
| 287 | - */ |
|
| 288 | - public function unlock($type); |
|
| 277 | + /** |
|
| 278 | + * Release an existing lock. |
|
| 279 | + * |
|
| 280 | + * This will also free up the shared locks on any parent folder that were automatically acquired when locking the file. |
|
| 281 | + * |
|
| 282 | + * Note that this method will not give any sort of error when trying to free a lock that doesn't exist. |
|
| 283 | + * |
|
| 284 | + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE |
|
| 285 | + * @throws LockedException |
|
| 286 | + * @since 9.1.0 |
|
| 287 | + */ |
|
| 288 | + public function unlock($type); |
|
| 289 | 289 | } |
@@ -36,264 +36,264 @@ |
||
| 36 | 36 | * @since 7.0.0 |
| 37 | 37 | */ |
| 38 | 38 | interface FileInfo { |
| 39 | - /** |
|
| 40 | - * @since 7.0.0 |
|
| 41 | - */ |
|
| 42 | - public const TYPE_FILE = 'file'; |
|
| 43 | - /** |
|
| 44 | - * @since 7.0.0 |
|
| 45 | - */ |
|
| 46 | - public const TYPE_FOLDER = 'dir'; |
|
| 39 | + /** |
|
| 40 | + * @since 7.0.0 |
|
| 41 | + */ |
|
| 42 | + public const TYPE_FILE = 'file'; |
|
| 43 | + /** |
|
| 44 | + * @since 7.0.0 |
|
| 45 | + */ |
|
| 46 | + public const TYPE_FOLDER = 'dir'; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value |
|
| 50 | - * @since 8.0.0 |
|
| 51 | - */ |
|
| 52 | - public const SPACE_NOT_COMPUTED = -1; |
|
| 53 | - /** |
|
| 54 | - * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value |
|
| 55 | - * @since 8.0.0 |
|
| 56 | - */ |
|
| 57 | - public const SPACE_UNKNOWN = -2; |
|
| 58 | - /** |
|
| 59 | - * @const \OCP\Files\FileInfo::SPACE_UNLIMITED Return value for unlimited space |
|
| 60 | - * @since 8.0.0 |
|
| 61 | - */ |
|
| 62 | - public const SPACE_UNLIMITED = -3; |
|
| 48 | + /** |
|
| 49 | + * @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value |
|
| 50 | + * @since 8.0.0 |
|
| 51 | + */ |
|
| 52 | + public const SPACE_NOT_COMPUTED = -1; |
|
| 53 | + /** |
|
| 54 | + * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value |
|
| 55 | + * @since 8.0.0 |
|
| 56 | + */ |
|
| 57 | + public const SPACE_UNKNOWN = -2; |
|
| 58 | + /** |
|
| 59 | + * @const \OCP\Files\FileInfo::SPACE_UNLIMITED Return value for unlimited space |
|
| 60 | + * @since 8.0.0 |
|
| 61 | + */ |
|
| 62 | + public const SPACE_UNLIMITED = -3; |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @since 9.1.0 |
|
| 66 | - */ |
|
| 67 | - public const MIMETYPE_FOLDER = 'httpd/unix-directory'; |
|
| 64 | + /** |
|
| 65 | + * @since 9.1.0 |
|
| 66 | + */ |
|
| 67 | + public const MIMETYPE_FOLDER = 'httpd/unix-directory'; |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * @const \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX Return regular expression to test filenames against (blacklisting) |
|
| 71 | - * @since 12.0.0 |
|
| 72 | - */ |
|
| 73 | - public const BLACKLIST_FILES_REGEX = '\.(part|filepart)$'; |
|
| 69 | + /** |
|
| 70 | + * @const \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX Return regular expression to test filenames against (blacklisting) |
|
| 71 | + * @since 12.0.0 |
|
| 72 | + */ |
|
| 73 | + public const BLACKLIST_FILES_REGEX = '\.(part|filepart)$'; |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Get the Etag of the file or folder |
|
| 77 | - * |
|
| 78 | - * @return string |
|
| 79 | - * @since 7.0.0 |
|
| 80 | - */ |
|
| 81 | - public function getEtag(); |
|
| 75 | + /** |
|
| 76 | + * Get the Etag of the file or folder |
|
| 77 | + * |
|
| 78 | + * @return string |
|
| 79 | + * @since 7.0.0 |
|
| 80 | + */ |
|
| 81 | + public function getEtag(); |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Get the size in bytes for the file or folder |
|
| 85 | - * |
|
| 86 | - * @param bool $includeMounts whether or not to include the size of any sub mounts, since 16.0.0 |
|
| 87 | - * @return int |
|
| 88 | - * @since 7.0.0 |
|
| 89 | - */ |
|
| 90 | - public function getSize($includeMounts = true); |
|
| 83 | + /** |
|
| 84 | + * Get the size in bytes for the file or folder |
|
| 85 | + * |
|
| 86 | + * @param bool $includeMounts whether or not to include the size of any sub mounts, since 16.0.0 |
|
| 87 | + * @return int |
|
| 88 | + * @since 7.0.0 |
|
| 89 | + */ |
|
| 90 | + public function getSize($includeMounts = true); |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Get the last modified date as timestamp for the file or folder |
|
| 94 | - * |
|
| 95 | - * @return int |
|
| 96 | - * @since 7.0.0 |
|
| 97 | - */ |
|
| 98 | - public function getMtime(); |
|
| 92 | + /** |
|
| 93 | + * Get the last modified date as timestamp for the file or folder |
|
| 94 | + * |
|
| 95 | + * @return int |
|
| 96 | + * @since 7.0.0 |
|
| 97 | + */ |
|
| 98 | + public function getMtime(); |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Get the name of the file or folder |
|
| 102 | - * |
|
| 103 | - * @return string |
|
| 104 | - * @since 7.0.0 |
|
| 105 | - */ |
|
| 106 | - public function getName(); |
|
| 100 | + /** |
|
| 101 | + * Get the name of the file or folder |
|
| 102 | + * |
|
| 103 | + * @return string |
|
| 104 | + * @since 7.0.0 |
|
| 105 | + */ |
|
| 106 | + public function getName(); |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Get the path relative to the storage |
|
| 110 | - * |
|
| 111 | - * @return string |
|
| 112 | - * @since 7.0.0 |
|
| 113 | - */ |
|
| 114 | - public function getInternalPath(); |
|
| 108 | + /** |
|
| 109 | + * Get the path relative to the storage |
|
| 110 | + * |
|
| 111 | + * @return string |
|
| 112 | + * @since 7.0.0 |
|
| 113 | + */ |
|
| 114 | + public function getInternalPath(); |
|
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Get the absolute path |
|
| 118 | - * |
|
| 119 | - * @return string |
|
| 120 | - * @since 7.0.0 |
|
| 121 | - */ |
|
| 122 | - public function getPath(); |
|
| 116 | + /** |
|
| 117 | + * Get the absolute path |
|
| 118 | + * |
|
| 119 | + * @return string |
|
| 120 | + * @since 7.0.0 |
|
| 121 | + */ |
|
| 122 | + public function getPath(); |
|
| 123 | 123 | |
| 124 | - /** |
|
| 125 | - * Get the full mimetype of the file or folder i.e. 'image/png' |
|
| 126 | - * |
|
| 127 | - * @return string |
|
| 128 | - * @since 7.0.0 |
|
| 129 | - */ |
|
| 130 | - public function getMimetype(); |
|
| 124 | + /** |
|
| 125 | + * Get the full mimetype of the file or folder i.e. 'image/png' |
|
| 126 | + * |
|
| 127 | + * @return string |
|
| 128 | + * @since 7.0.0 |
|
| 129 | + */ |
|
| 130 | + public function getMimetype(); |
|
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * Get the first part of the mimetype of the file or folder i.e. 'image' |
|
| 134 | - * |
|
| 135 | - * @return string |
|
| 136 | - * @since 7.0.0 |
|
| 137 | - */ |
|
| 138 | - public function getMimePart(); |
|
| 132 | + /** |
|
| 133 | + * Get the first part of the mimetype of the file or folder i.e. 'image' |
|
| 134 | + * |
|
| 135 | + * @return string |
|
| 136 | + * @since 7.0.0 |
|
| 137 | + */ |
|
| 138 | + public function getMimePart(); |
|
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * Get the storage the file or folder is storage on |
|
| 142 | - * |
|
| 143 | - * @return IStorage |
|
| 144 | - * @since 7.0.0 |
|
| 145 | - */ |
|
| 146 | - public function getStorage(); |
|
| 140 | + /** |
|
| 141 | + * Get the storage the file or folder is storage on |
|
| 142 | + * |
|
| 143 | + * @return IStorage |
|
| 144 | + * @since 7.0.0 |
|
| 145 | + */ |
|
| 146 | + public function getStorage(); |
|
| 147 | 147 | |
| 148 | - /** |
|
| 149 | - * Get the file id of the file or folder |
|
| 150 | - * |
|
| 151 | - * @return int|null |
|
| 152 | - * @since 7.0.0 |
|
| 153 | - */ |
|
| 154 | - public function getId(); |
|
| 148 | + /** |
|
| 149 | + * Get the file id of the file or folder |
|
| 150 | + * |
|
| 151 | + * @return int|null |
|
| 152 | + * @since 7.0.0 |
|
| 153 | + */ |
|
| 154 | + public function getId(); |
|
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * Check whether the file is encrypted |
|
| 158 | - * |
|
| 159 | - * @return bool |
|
| 160 | - * @since 7.0.0 |
|
| 161 | - */ |
|
| 162 | - public function isEncrypted(); |
|
| 156 | + /** |
|
| 157 | + * Check whether the file is encrypted |
|
| 158 | + * |
|
| 159 | + * @return bool |
|
| 160 | + * @since 7.0.0 |
|
| 161 | + */ |
|
| 162 | + public function isEncrypted(); |
|
| 163 | 163 | |
| 164 | - /** |
|
| 165 | - * Get the permissions of the file or folder as bitmasked combination of the following constants |
|
| 166 | - * \OCP\Constants::PERMISSION_CREATE |
|
| 167 | - * \OCP\Constants::PERMISSION_READ |
|
| 168 | - * \OCP\Constants::PERMISSION_UPDATE |
|
| 169 | - * \OCP\Constants::PERMISSION_DELETE |
|
| 170 | - * \OCP\Constants::PERMISSION_SHARE |
|
| 171 | - * \OCP\Constants::PERMISSION_ALL |
|
| 172 | - * |
|
| 173 | - * @return int |
|
| 174 | - * @since 7.0.0 - namespace of constants has changed in 8.0.0 |
|
| 175 | - */ |
|
| 176 | - public function getPermissions(); |
|
| 164 | + /** |
|
| 165 | + * Get the permissions of the file or folder as bitmasked combination of the following constants |
|
| 166 | + * \OCP\Constants::PERMISSION_CREATE |
|
| 167 | + * \OCP\Constants::PERMISSION_READ |
|
| 168 | + * \OCP\Constants::PERMISSION_UPDATE |
|
| 169 | + * \OCP\Constants::PERMISSION_DELETE |
|
| 170 | + * \OCP\Constants::PERMISSION_SHARE |
|
| 171 | + * \OCP\Constants::PERMISSION_ALL |
|
| 172 | + * |
|
| 173 | + * @return int |
|
| 174 | + * @since 7.0.0 - namespace of constants has changed in 8.0.0 |
|
| 175 | + */ |
|
| 176 | + public function getPermissions(); |
|
| 177 | 177 | |
| 178 | - /** |
|
| 179 | - * Check whether this is a file or a folder |
|
| 180 | - * |
|
| 181 | - * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER |
|
| 182 | - * @since 7.0.0 |
|
| 183 | - */ |
|
| 184 | - public function getType(); |
|
| 178 | + /** |
|
| 179 | + * Check whether this is a file or a folder |
|
| 180 | + * |
|
| 181 | + * @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER |
|
| 182 | + * @since 7.0.0 |
|
| 183 | + */ |
|
| 184 | + public function getType(); |
|
| 185 | 185 | |
| 186 | - /** |
|
| 187 | - * Check if the file or folder is readable |
|
| 188 | - * |
|
| 189 | - * @return bool |
|
| 190 | - * @since 7.0.0 |
|
| 191 | - */ |
|
| 192 | - public function isReadable(); |
|
| 186 | + /** |
|
| 187 | + * Check if the file or folder is readable |
|
| 188 | + * |
|
| 189 | + * @return bool |
|
| 190 | + * @since 7.0.0 |
|
| 191 | + */ |
|
| 192 | + public function isReadable(); |
|
| 193 | 193 | |
| 194 | - /** |
|
| 195 | - * Check if a file is writable |
|
| 196 | - * |
|
| 197 | - * @return bool |
|
| 198 | - * @since 7.0.0 |
|
| 199 | - */ |
|
| 200 | - public function isUpdateable(); |
|
| 194 | + /** |
|
| 195 | + * Check if a file is writable |
|
| 196 | + * |
|
| 197 | + * @return bool |
|
| 198 | + * @since 7.0.0 |
|
| 199 | + */ |
|
| 200 | + public function isUpdateable(); |
|
| 201 | 201 | |
| 202 | - /** |
|
| 203 | - * Check whether new files or folders can be created inside this folder |
|
| 204 | - * |
|
| 205 | - * @return bool |
|
| 206 | - * @since 8.0.0 |
|
| 207 | - */ |
|
| 208 | - public function isCreatable(); |
|
| 202 | + /** |
|
| 203 | + * Check whether new files or folders can be created inside this folder |
|
| 204 | + * |
|
| 205 | + * @return bool |
|
| 206 | + * @since 8.0.0 |
|
| 207 | + */ |
|
| 208 | + public function isCreatable(); |
|
| 209 | 209 | |
| 210 | - /** |
|
| 211 | - * Check if a file or folder can be deleted |
|
| 212 | - * |
|
| 213 | - * @return bool |
|
| 214 | - * @since 7.0.0 |
|
| 215 | - */ |
|
| 216 | - public function isDeletable(); |
|
| 210 | + /** |
|
| 211 | + * Check if a file or folder can be deleted |
|
| 212 | + * |
|
| 213 | + * @return bool |
|
| 214 | + * @since 7.0.0 |
|
| 215 | + */ |
|
| 216 | + public function isDeletable(); |
|
| 217 | 217 | |
| 218 | - /** |
|
| 219 | - * Check if a file or folder can be shared |
|
| 220 | - * |
|
| 221 | - * @return bool |
|
| 222 | - * @since 7.0.0 |
|
| 223 | - */ |
|
| 224 | - public function isShareable(); |
|
| 218 | + /** |
|
| 219 | + * Check if a file or folder can be shared |
|
| 220 | + * |
|
| 221 | + * @return bool |
|
| 222 | + * @since 7.0.0 |
|
| 223 | + */ |
|
| 224 | + public function isShareable(); |
|
| 225 | 225 | |
| 226 | - /** |
|
| 227 | - * Check if a file or folder is shared |
|
| 228 | - * |
|
| 229 | - * @return bool |
|
| 230 | - * @since 7.0.0 |
|
| 231 | - */ |
|
| 232 | - public function isShared(); |
|
| 226 | + /** |
|
| 227 | + * Check if a file or folder is shared |
|
| 228 | + * |
|
| 229 | + * @return bool |
|
| 230 | + * @since 7.0.0 |
|
| 231 | + */ |
|
| 232 | + public function isShared(); |
|
| 233 | 233 | |
| 234 | - /** |
|
| 235 | - * Check if a file or folder is mounted |
|
| 236 | - * |
|
| 237 | - * @return bool |
|
| 238 | - * @since 7.0.0 |
|
| 239 | - */ |
|
| 240 | - public function isMounted(); |
|
| 234 | + /** |
|
| 235 | + * Check if a file or folder is mounted |
|
| 236 | + * |
|
| 237 | + * @return bool |
|
| 238 | + * @since 7.0.0 |
|
| 239 | + */ |
|
| 240 | + public function isMounted(); |
|
| 241 | 241 | |
| 242 | - /** |
|
| 243 | - * Get the mountpoint the file belongs to |
|
| 244 | - * |
|
| 245 | - * @return \OCP\Files\Mount\IMountPoint |
|
| 246 | - * @since 8.0.0 |
|
| 247 | - */ |
|
| 248 | - public function getMountPoint(); |
|
| 242 | + /** |
|
| 243 | + * Get the mountpoint the file belongs to |
|
| 244 | + * |
|
| 245 | + * @return \OCP\Files\Mount\IMountPoint |
|
| 246 | + * @since 8.0.0 |
|
| 247 | + */ |
|
| 248 | + public function getMountPoint(); |
|
| 249 | 249 | |
| 250 | - /** |
|
| 251 | - * Get the owner of the file |
|
| 252 | - * |
|
| 253 | - * @return \OCP\IUser |
|
| 254 | - * @since 9.0.0 |
|
| 255 | - */ |
|
| 256 | - public function getOwner(); |
|
| 250 | + /** |
|
| 251 | + * Get the owner of the file |
|
| 252 | + * |
|
| 253 | + * @return \OCP\IUser |
|
| 254 | + * @since 9.0.0 |
|
| 255 | + */ |
|
| 256 | + public function getOwner(); |
|
| 257 | 257 | |
| 258 | - /** |
|
| 259 | - * Get the stored checksum for this file |
|
| 260 | - * |
|
| 261 | - * @return string |
|
| 262 | - * @since 9.0.0 |
|
| 263 | - */ |
|
| 264 | - public function getChecksum(); |
|
| 258 | + /** |
|
| 259 | + * Get the stored checksum for this file |
|
| 260 | + * |
|
| 261 | + * @return string |
|
| 262 | + * @since 9.0.0 |
|
| 263 | + */ |
|
| 264 | + public function getChecksum(); |
|
| 265 | 265 | |
| 266 | - /** |
|
| 267 | - * Get the extension of the file |
|
| 268 | - * |
|
| 269 | - * @return string |
|
| 270 | - * @since 15.0.0 |
|
| 271 | - */ |
|
| 272 | - public function getExtension(): string; |
|
| 266 | + /** |
|
| 267 | + * Get the extension of the file |
|
| 268 | + * |
|
| 269 | + * @return string |
|
| 270 | + * @since 15.0.0 |
|
| 271 | + */ |
|
| 272 | + public function getExtension(): string; |
|
| 273 | 273 | |
| 274 | - /** |
|
| 275 | - * Get the creation date as unix timestamp |
|
| 276 | - * |
|
| 277 | - * If the creation time is not known, 0 will be returned |
|
| 278 | - * |
|
| 279 | - * creation time is not set automatically by the server and is generally only available |
|
| 280 | - * for files uploaded by the sync clients |
|
| 281 | - * |
|
| 282 | - * @return int |
|
| 283 | - * @since 18.0.0 |
|
| 284 | - */ |
|
| 285 | - public function getCreationTime(): int; |
|
| 274 | + /** |
|
| 275 | + * Get the creation date as unix timestamp |
|
| 276 | + * |
|
| 277 | + * If the creation time is not known, 0 will be returned |
|
| 278 | + * |
|
| 279 | + * creation time is not set automatically by the server and is generally only available |
|
| 280 | + * for files uploaded by the sync clients |
|
| 281 | + * |
|
| 282 | + * @return int |
|
| 283 | + * @since 18.0.0 |
|
| 284 | + */ |
|
| 285 | + public function getCreationTime(): int; |
|
| 286 | 286 | |
| 287 | - /** |
|
| 288 | - * Get the upload date as unix timestamp |
|
| 289 | - * |
|
| 290 | - * If the upload time is not known, 0 will be returned |
|
| 291 | - * |
|
| 292 | - * Upload time will be set automatically by the server for files uploaded over DAV |
|
| 293 | - * files created by Nextcloud apps generally do not have an the upload time set |
|
| 294 | - * |
|
| 295 | - * @return int |
|
| 296 | - * @since 18.0.0 |
|
| 297 | - */ |
|
| 298 | - public function getUploadTime(): int; |
|
| 287 | + /** |
|
| 288 | + * Get the upload date as unix timestamp |
|
| 289 | + * |
|
| 290 | + * If the upload time is not known, 0 will be returned |
|
| 291 | + * |
|
| 292 | + * Upload time will be set automatically by the server for files uploaded over DAV |
|
| 293 | + * files created by Nextcloud apps generally do not have an the upload time set |
|
| 294 | + * |
|
| 295 | + * @return int |
|
| 296 | + * @since 18.0.0 |
|
| 297 | + */ |
|
| 298 | + public function getUploadTime(): int; |
|
| 299 | 299 | } |