2014-01-13 08:28:49 -05:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2014-01-13 08:28:49 -05:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
|
|
|
|
namespace OCP\Files;
|
|
|
|
|
|
2021-12-21 09:33:37 -05:00
|
|
|
use OCP\Files\Storage\IStorage;
|
|
|
|
|
|
2015-04-16 11:00:08 -04:00
|
|
|
/**
|
|
|
|
|
* Interface FileInfo
|
|
|
|
|
*
|
|
|
|
|
* @since 7.0.0
|
|
|
|
|
*/
|
2014-01-13 09:13:45 -05:00
|
|
|
interface FileInfo {
|
2015-04-16 11:00:08 -04:00
|
|
|
/**
|
|
|
|
|
* @since 7.0.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const TYPE_FILE = 'file';
|
2015-04-16 11:00:08 -04:00
|
|
|
/**
|
|
|
|
|
* @since 7.0.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const TYPE_FOLDER = 'dir';
|
2014-01-13 08:28:49 -05:00
|
|
|
|
2015-04-16 11:00:08 -04:00
|
|
|
/**
|
2014-08-19 10:49:51 -04:00
|
|
|
* @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2014-08-19 10:49:51 -04:00
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const SPACE_NOT_COMPUTED = -1;
|
2015-04-16 11:00:08 -04:00
|
|
|
/**
|
2014-08-19 10:49:51 -04:00
|
|
|
* @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2014-08-19 10:49:51 -04:00
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const SPACE_UNKNOWN = -2;
|
2015-04-16 11:00:08 -04:00
|
|
|
/**
|
2016-08-16 05:42:28 -04:00
|
|
|
* @const \OCP\Files\FileInfo::SPACE_UNLIMITED Return value for unlimited space
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2014-08-19 10:49:51 -04:00
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const SPACE_UNLIMITED = -3;
|
2014-08-19 08:05:08 -04:00
|
|
|
|
2016-07-22 08:37:37 -04:00
|
|
|
/**
|
|
|
|
|
* @since 9.1.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const MIMETYPE_FOLDER = 'httpd/unix-directory';
|
2016-07-22 08:37:37 -04:00
|
|
|
|
2017-02-13 10:51:23 -05:00
|
|
|
/**
|
|
|
|
|
* @const \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX Return regular expression to test filenames against (blacklisting)
|
|
|
|
|
* @since 12.0.0
|
|
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const BLACKLIST_FILES_REGEX = '\.(part|filepart)$';
|
2017-02-13 10:51:23 -05:00
|
|
|
|
2014-01-13 08:28:49 -05:00
|
|
|
/**
|
2014-01-13 08:42:14 -05:00
|
|
|
* Get the Etag of the file or folder
|
|
|
|
|
*
|
2014-01-13 08:28:49 -05:00
|
|
|
* @return string
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
|
|
|
|
public function getEtag();
|
|
|
|
|
|
|
|
|
|
/**
|
2014-01-13 08:42:14 -05:00
|
|
|
* Get the size in bytes for the file or folder
|
|
|
|
|
*
|
2019-02-27 09:35:44 -05:00
|
|
|
* @param bool $includeMounts whether or not to include the size of any sub mounts, since 16.0.0
|
2023-01-23 07:30:38 -05:00
|
|
|
* @return int|float
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
2019-02-27 09:35:44 -05:00
|
|
|
public function getSize($includeMounts = true);
|
2014-01-13 08:28:49 -05:00
|
|
|
|
|
|
|
|
/**
|
2014-01-13 08:42:14 -05:00
|
|
|
* Get the last modified date as timestamp for the file or folder
|
|
|
|
|
*
|
2014-01-13 08:28:49 -05:00
|
|
|
* @return int
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
|
|
|
|
public function getMtime();
|
|
|
|
|
|
|
|
|
|
/**
|
2014-01-13 08:42:14 -05:00
|
|
|
* Get the name of the file or folder
|
|
|
|
|
*
|
2014-01-13 08:28:49 -05:00
|
|
|
* @return string
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
|
|
|
|
public function getName();
|
|
|
|
|
|
|
|
|
|
/**
|
2014-01-13 08:42:14 -05:00
|
|
|
* Get the path relative to the storage
|
|
|
|
|
*
|
2014-01-13 08:28:49 -05:00
|
|
|
* @return string
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
|
|
|
|
public function getInternalPath();
|
|
|
|
|
|
|
|
|
|
/**
|
2014-01-13 08:42:14 -05:00
|
|
|
* Get the absolute path
|
|
|
|
|
*
|
2014-01-13 08:28:49 -05:00
|
|
|
* @return string
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
|
|
|
|
public function getPath();
|
|
|
|
|
|
|
|
|
|
/**
|
2014-01-13 08:42:14 -05:00
|
|
|
* Get the full mimetype of the file or folder i.e. 'image/png'
|
|
|
|
|
*
|
2014-01-13 08:28:49 -05:00
|
|
|
* @return string
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
|
|
|
|
public function getMimetype();
|
|
|
|
|
|
|
|
|
|
/**
|
2014-01-13 08:42:14 -05:00
|
|
|
* Get the first part of the mimetype of the file or folder i.e. 'image'
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-13 08:42:14 -05:00
|
|
|
*/
|
|
|
|
|
public function getMimePart();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the storage the file or folder is storage on
|
|
|
|
|
*
|
2021-12-21 09:33:37 -05:00
|
|
|
* @return IStorage
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
|
|
|
|
public function getStorage();
|
|
|
|
|
|
|
|
|
|
/**
|
2014-01-13 08:42:14 -05:00
|
|
|
* Get the file id of the file or folder
|
|
|
|
|
*
|
2017-03-23 12:52:47 -04:00
|
|
|
* @return int|null
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
|
|
|
|
public function getId();
|
|
|
|
|
|
|
|
|
|
/**
|
2024-08-27 04:52:35 -04:00
|
|
|
* Check whether the node is encrypted.
|
|
|
|
|
* If it is a file, then it is server side encrypted.
|
|
|
|
|
* If it is a folder, then it is end-to-end encrypted.
|
2014-01-13 08:42:14 -05:00
|
|
|
*
|
2014-01-13 08:28:49 -05:00
|
|
|
* @return bool
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
|
|
|
|
public function isEncrypted();
|
|
|
|
|
|
|
|
|
|
/**
|
2014-01-13 08:42:14 -05:00
|
|
|
* Get the permissions of the file or folder as bitmasked combination of the following constants
|
2014-11-25 10:28:41 -05:00
|
|
|
* \OCP\Constants::PERMISSION_CREATE
|
|
|
|
|
* \OCP\Constants::PERMISSION_READ
|
|
|
|
|
* \OCP\Constants::PERMISSION_UPDATE
|
|
|
|
|
* \OCP\Constants::PERMISSION_DELETE
|
|
|
|
|
* \OCP\Constants::PERMISSION_SHARE
|
|
|
|
|
* \OCP\Constants::PERMISSION_ALL
|
2014-01-13 08:42:14 -05:00
|
|
|
*
|
2014-01-13 08:28:49 -05:00
|
|
|
* @return int
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0 - namespace of constants has changed in 8.0.0
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
|
|
|
|
public function getPermissions();
|
|
|
|
|
|
|
|
|
|
/**
|
2014-01-13 08:42:14 -05:00
|
|
|
* Check whether this is a file or a folder
|
|
|
|
|
*
|
2017-10-18 08:15:03 -04:00
|
|
|
* @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-13 08:28:49 -05:00
|
|
|
*/
|
|
|
|
|
public function getType();
|
2014-01-24 09:54:40 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if the file or folder is readable
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-24 09:54:40 -05:00
|
|
|
*/
|
|
|
|
|
public function isReadable();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if a file is writable
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-24 09:54:40 -05:00
|
|
|
*/
|
|
|
|
|
public function isUpdateable();
|
|
|
|
|
|
2014-09-24 11:49:52 -04:00
|
|
|
/**
|
|
|
|
|
* Check whether new files or folders can be created inside this folder
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2014-09-24 11:49:52 -04:00
|
|
|
*/
|
|
|
|
|
public function isCreatable();
|
|
|
|
|
|
2014-01-24 09:54:40 -05:00
|
|
|
/**
|
|
|
|
|
* Check if a file or folder can be deleted
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-24 09:54:40 -05:00
|
|
|
*/
|
|
|
|
|
public function isDeletable();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if a file or folder can be shared
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-01-24 09:54:40 -05:00
|
|
|
*/
|
|
|
|
|
public function isShareable();
|
2014-05-02 11:37:16 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if a file or folder is shared
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-05-02 11:37:16 -04:00
|
|
|
*/
|
|
|
|
|
public function isShared();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if a file or folder is mounted
|
|
|
|
|
*
|
|
|
|
|
* @return bool
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 7.0.0
|
2014-05-02 11:37:16 -04:00
|
|
|
*/
|
|
|
|
|
public function isMounted();
|
2014-12-16 08:24:48 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the mountpoint the file belongs to
|
|
|
|
|
*
|
|
|
|
|
* @return \OCP\Files\Mount\IMountPoint
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2014-12-16 08:24:48 -05:00
|
|
|
*/
|
|
|
|
|
public function getMountPoint();
|
2015-11-02 08:56:38 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the owner of the file
|
|
|
|
|
*
|
2023-03-28 04:34:01 -04:00
|
|
|
* @return ?\OCP\IUser
|
2015-11-02 08:56:38 -05:00
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getOwner();
|
2016-01-29 15:50:48 -05:00
|
|
|
|
|
|
|
|
/**
|
2021-07-22 09:13:56 -04:00
|
|
|
* Get the stored checksum(s) for this file
|
|
|
|
|
*
|
|
|
|
|
* Checksums are stored in the format TYPE:CHECKSUM, here may be multiple checksums separated by a single space
|
|
|
|
|
* e.g. MD5:d3b07384d113edec49eaa6238ad5ff00 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15
|
2016-01-29 15:50:48 -05:00
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getChecksum();
|
2018-10-29 10:23:33 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the extension of the file
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
* @since 15.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getExtension(): string;
|
2019-10-29 08:49:41 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the creation date as unix timestamp
|
|
|
|
|
*
|
|
|
|
|
* If the creation time is not known, 0 will be returned
|
|
|
|
|
*
|
|
|
|
|
* creation time is not set automatically by the server and is generally only available
|
|
|
|
|
* for files uploaded by the sync clients
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
* @since 18.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getCreationTime(): int;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the upload date as unix timestamp
|
|
|
|
|
*
|
|
|
|
|
* If the upload time is not known, 0 will be returned
|
|
|
|
|
*
|
|
|
|
|
* Upload time will be set automatically by the server for files uploaded over DAV
|
|
|
|
|
* files created by Nextcloud apps generally do not have an the upload time set
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
* @since 18.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getUploadTime(): int;
|
2023-08-14 15:12:12 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the fileid or the parent folder
|
|
|
|
|
* or -1 if this item has no parent folder (because it is the root)
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
* @since 28.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getParentId(): int;
|
2023-11-06 20:21:29 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the metadata, if available
|
|
|
|
|
*
|
|
|
|
|
* @return array<string, int|string|bool|float|string[]|int[]>
|
|
|
|
|
* @since 28.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getMetadata(): array;
|
2014-01-13 08:28:49 -05:00
|
|
|
}
|