2013-09-06 22:38:59 +04:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 18:07:57 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2020-04-29 12:57:22 +03:00
|
|
|
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
2015-03-26 13:44:34 +03:00
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
2016-07-21 19:13:36 +03:00
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2020-12-16 16:54:15 +03:00
|
|
|
* @author Vincent Petry <vincent@nextcloud.com>
|
2013-11-03 16:51:39 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* @license AGPL-3.0
|
2013-11-03 16:51:39 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
2013-11-03 16:51:39 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2013-11-03 16:51:39 +04:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-03-26 13:44:34 +03:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
2013-11-03 16:51:39 +04:00
|
|
|
*
|
2015-03-26 13:44:34 +03:00
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2013-11-03 16:51:39 +04:00
|
|
|
*
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
2015-02-26 13:37:37 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Public interface of ownCloud for apps to use.
|
|
|
|
* Files/Folder interface
|
|
|
|
*/
|
|
|
|
|
2013-11-03 16:51:39 +04:00
|
|
|
// use OCP namespace for all classes that are considered public.
|
|
|
|
// This means that they should be used by apps instead of the internal ownCloud classes
|
2019-11-22 22:52:10 +03:00
|
|
|
|
2013-09-10 21:34:38 +04:00
|
|
|
namespace OCP\Files;
|
2020-04-09 12:48:10 +03:00
|
|
|
|
2017-02-02 20:20:08 +03:00
|
|
|
use OCP\Files\Search\ISearchQuery;
|
2013-09-06 22:38:59 +04:00
|
|
|
|
2015-04-16 18:00:08 +03:00
|
|
|
/**
|
|
|
|
* @since 6.0.0
|
|
|
|
*/
|
2013-09-06 22:38:59 +04:00
|
|
|
interface Folder extends Node {
|
|
|
|
/**
|
2013-09-10 22:02:15 +04:00
|
|
|
* Get the full path of an item in the folder within owncloud's filesystem
|
|
|
|
*
|
|
|
|
* @param string $path relative path of an item in the folder
|
2013-09-06 22:38:59 +04:00
|
|
|
* @return string
|
2013-09-10 22:02:15 +04:00
|
|
|
* @throws \OCP\Files\NotPermittedException
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function getFullPath($path);
|
|
|
|
|
|
|
|
/**
|
2013-09-10 22:02:15 +04:00
|
|
|
* Get the path of an item in the folder relative to the folder
|
|
|
|
*
|
|
|
|
* @param string $path absolute path of an item in the folder
|
|
|
|
* @throws \OCP\Files\NotFoundException
|
2021-03-19 20:13:59 +03:00
|
|
|
* @return string|null
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function getRelativePath($path);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* check if a node is a (grand-)child of the folder
|
|
|
|
*
|
2013-09-10 21:34:38 +04:00
|
|
|
* @param \OCP\Files\Node $node
|
2013-09-06 22:38:59 +04:00
|
|
|
* @return bool
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function isSubNode($node);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get the content of this directory
|
|
|
|
*
|
2013-09-10 22:02:15 +04:00
|
|
|
* @throws \OCP\Files\NotFoundException
|
2013-09-10 21:34:38 +04:00
|
|
|
* @return \OCP\Files\Node[]
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function getDirectoryListing();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the node at $path
|
|
|
|
*
|
2013-09-10 22:02:15 +04:00
|
|
|
* @param string $path relative path of the file or folder
|
2013-09-10 21:34:38 +04:00
|
|
|
* @return \OCP\Files\Node
|
2013-09-10 22:02:15 +04:00
|
|
|
* @throws \OCP\Files\NotFoundException
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function get($path);
|
|
|
|
|
|
|
|
/**
|
2013-09-10 22:02:15 +04:00
|
|
|
* Check if a file or folder exists in the folder
|
|
|
|
*
|
|
|
|
* @param string $path relative path of the file or folder
|
2013-09-06 22:38:59 +04:00
|
|
|
* @return bool
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function nodeExists($path);
|
|
|
|
|
|
|
|
/**
|
2013-09-10 22:02:15 +04:00
|
|
|
* Create a new folder
|
|
|
|
*
|
|
|
|
* @param string $path relative path of the new folder
|
2013-09-10 21:34:38 +04:00
|
|
|
* @return \OCP\Files\Folder
|
2013-09-10 22:02:15 +04:00
|
|
|
* @throws \OCP\Files\NotPermittedException
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function newFolder($path);
|
|
|
|
|
|
|
|
/**
|
2013-09-10 22:02:15 +04:00
|
|
|
* Create a new file
|
|
|
|
*
|
|
|
|
* @param string $path relative path of the new file
|
2020-02-18 20:02:58 +03:00
|
|
|
* @param string|resource|null $content content for the new file, since 19.0.0
|
2013-09-10 21:34:38 +04:00
|
|
|
* @return \OCP\Files\File
|
2013-09-10 22:02:15 +04:00
|
|
|
* @throws \OCP\Files\NotPermittedException
|
2015-06-19 11:51:36 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
2020-02-16 03:14:52 +03:00
|
|
|
public function newFile($path, $content = null);
|
2013-09-06 22:38:59 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* search for files with the name matching $query
|
|
|
|
*
|
2017-02-02 20:20:08 +03:00
|
|
|
* @param string|ISearchQuery $query
|
2013-09-10 21:34:38 +04:00
|
|
|
* @return \OCP\Files\Node[]
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function search($query);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* search for files by mimetype
|
2013-09-10 22:02:15 +04:00
|
|
|
* $mimetype can either be a full mimetype (image/png) or a wildcard mimetype (image)
|
2013-09-06 22:38:59 +04:00
|
|
|
*
|
|
|
|
* @param string $mimetype
|
2013-09-10 21:34:38 +04:00
|
|
|
* @return \OCP\Files\Node[]
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function searchByMime($mimetype);
|
|
|
|
|
2014-12-04 16:01:15 +03:00
|
|
|
/**
|
|
|
|
* search for files by tag
|
|
|
|
*
|
|
|
|
* @param string|int $tag tag name or tag id
|
2014-12-12 13:18:35 +03:00
|
|
|
* @param string $userId owner of the tags
|
2014-12-04 16:01:15 +03:00
|
|
|
* @return \OCP\Files\Node[]
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.0.0
|
2014-12-04 16:01:15 +03:00
|
|
|
*/
|
2014-12-12 13:18:35 +03:00
|
|
|
public function searchByTag($tag, $userId);
|
2014-12-04 16:01:15 +03:00
|
|
|
|
2013-09-06 22:38:59 +04:00
|
|
|
/**
|
2013-09-10 22:02:15 +04:00
|
|
|
* get a file or folder inside the folder by it's internal id
|
|
|
|
*
|
2018-03-21 16:22:24 +03:00
|
|
|
* This method could return multiple entries. For example once the file/folder
|
|
|
|
* is shared or mounted (files_external) to the user multiple times.
|
|
|
|
*
|
2013-09-10 22:02:15 +04:00
|
|
|
* @param int $id
|
2013-09-10 21:34:38 +04:00
|
|
|
* @return \OCP\Files\Node[]
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function getById($id);
|
|
|
|
|
2013-09-10 22:02:15 +04:00
|
|
|
/**
|
|
|
|
* Get the amount of free space inside the folder
|
|
|
|
*
|
|
|
|
* @return int
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-10 22:02:15 +04:00
|
|
|
*/
|
2013-09-06 22:38:59 +04:00
|
|
|
public function getFreeSpace();
|
|
|
|
|
|
|
|
/**
|
2013-09-10 22:02:15 +04:00
|
|
|
* Check if new files or folders can be created within the folder
|
|
|
|
*
|
2013-09-06 22:38:59 +04:00
|
|
|
* @return bool
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 6.0.0
|
2013-09-06 22:38:59 +04:00
|
|
|
*/
|
|
|
|
public function isCreatable();
|
2015-03-24 17:00:36 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a suffix to the name in case the file exists
|
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
* @return string
|
|
|
|
* @throws NotPermittedException
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-03-24 17:00:36 +03:00
|
|
|
*/
|
|
|
|
public function getNonExistingName($name);
|
2016-07-22 15:37:37 +03:00
|
|
|
|
|
|
|
/**
|
2016-07-22 14:58:53 +03:00
|
|
|
* @param int $limit
|
|
|
|
* @param int $offset
|
2016-07-22 15:37:37 +03:00
|
|
|
* @return \OCP\Files\Node[]
|
|
|
|
* @since 9.1.0
|
|
|
|
*/
|
2016-07-22 14:58:53 +03:00
|
|
|
public function getRecent($limit, $offset = 0);
|
2013-09-06 22:38:59 +04:00
|
|
|
}
|