// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Activity;
+/**
+ * Interface IConsumer
+ *
+ * @package OCP\Activity
+ * @since 6.0.0
+ */
interface IConsumer {
/**
* @param $app
* @param $type
* @param $priority
* @return mixed
+ * @since 6.0.0
*/
function receive($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority );
}
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Activity;
+/**
+ * Interface IExtension
+ *
+ * @package OCP\Activity
+ * @since 8.0.0
+ */
interface IExtension {
const PRIORITY_VERYLOW = 10;
*
* @param string $languageCode
* @return array|false
+ * @since 8.0.0
*/
public function getNotificationTypes($languageCode);
*
* @param string $method
* @return array|false
+ * @since 8.0.0
*/
public function getDefaultTypes($method);
*
* @param string $type
* @return string|false
+ * @since 8.0.0
*/
public function getTypeIcon($type);
* @param boolean $highlightParams
* @param string $languageCode
* @return string|false
+ * @since 8.0.0
*/
public function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
* @param string $app
* @param string $text
* @return array|false
+ * @since 8.0.0
*/
public function getSpecialParameterList($app, $text);
*
* @param array $activity
* @return integer|false
+ * @since 8.0.0
*/
public function getGroupParameter($activity);
* If no further entries are to be added false is no be returned.
*
* @return array|false
+ * @since 8.0.0
*/
public function getNavigation();
*
* @param string $filterValue
* @return boolean
+ * @since 8.0.0
*/
public function isFilterValid($filterValue);
* @param array $types
* @param string $filter
* @return array|false
+ * @since 8.0.0
*/
public function filterNotificationTypes($types, $filter);
*
* @param string $filter
* @return array|false
+ * @since 8.0.0
*/
public function getQueryForFilter($filter);
}
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Activity;
+/**
+ * Interface IManager
+ *
+ * @package OCP\Activity
+ * @since 6.0.0
+ */
interface IManager {
/**
* @param $type
* @param $priority
* @return mixed
+ * @since 6.0.0
*/
function publishActivity($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority);
*
* @param \Closure $callable
* @return void
+ * @since 6.0.0
*/
function registerConsumer(\Closure $callable);
*
* @param \Closure $callable
* @return void
+ * @since 8.0.0
*/
function registerExtension(\Closure $callable);
* Will return additional notification types as specified by other apps
* @param string $languageCode
* @return array
+ * @since 8.0.0
*/
function getNotificationTypes($languageCode);
/**
* @param string $method
* @return array
+ * @since 8.0.0
*/
function getDefaultTypes($method);
/**
* @param string $type
* @return string
+ * @since 8.0.0
*/
function getTypeIcon($type);
* @param boolean $highlightParams
* @param string $languageCode
* @return string|false
+ * @since 8.0.0
*/
function translate($app, $text, $params, $stripPath, $highlightParams, $languageCode);
* @param string $app
* @param string $text
* @return array|false
+ * @since 8.0.0
*/
function getSpecialParameterList($app, $text);
/**
* @param array $activity
* @return integer|false
+ * @since 8.0.0
*/
function getGroupParameter($activity);
/**
* @return array
+ * @since 8.0.0
*/
function getNavigation();
/**
* @param string $filterValue
* @return boolean
+ * @since 8.0.0
*/
function isFilterValid($filterValue);
* @param array $types
* @param string $filter
* @return array
+ * @since 8.0.0
*/
function filterNotificationTypes($types, $filter);
/**
* @param string $filter
* @return array
+ * @since 8.0.0
*/
function getQueryForFilter($filter);
*
* @return string
* @throws \UnexpectedValueException If the token is invalid, does not exist or is not unique
+ * @since 8.1.0
*/
public function getCurrentUserId();
}
/**
* This class provides functions to manage apps in ownCloud
+ * @since 5.0.0
*/
class API {
* @param int $authLevel the level of authentication required for the call (See OC_API constants)
* @param array $defaults
* @param array $requirements
+ * @since 5.0.0
*/
public static function register($method, $url, $action, $app, $authLevel = OC_API::USER_AUTH,
$defaults = array(), $requirements = array()){
/**
* This class provides functions to manage apps in ownCloud
+ * @since 4.0.0
*/
class App {
/**
*
* @deprecated Use \OC::$server->getNavigationManager()->add() instead to
* register a closure, this helps to speed up all requests against ownCloud
+ * @since 4.0.0
*/
public static function addNavigationEntry($data) {
\OC::$server->getNavigationManager()->add($data);
* highlighting the current position of the user.
*
* @deprecated Use \OC::$server->getNavigationManager()->setActiveEntry() instead
+ * @since 4.0.0
*/
public static function setActiveNavigationEntry( $id ) {
return \OC_App::setActiveNavigationEntry( $id );
* @param string $app appid
* @param string $page page to be included
* @return void
+ * @since 4.0.0
*/
public static function registerPersonal( $app, $page ) {
\OC_App::registerPersonal( $app, $page );
* @param string $app string appid
* @param string $page string page to be included
* @return void
+ * @since 4.0.0
*/
public static function registerAdmin( $app, $page ) {
\OC_App::registerAdmin( $app, $page );
* @param string $app id of the app or the path of the info.xml file
* @param boolean $path (optional)
* @return array
+ * @since 4.0.0
*/
public static function getAppInfo( $app, $path=false ) {
return \OC_App::getAppInfo( $app, $path);
* @return boolean
*
* This function checks whether or not an app is enabled.
+ * @since 4.0.0
*/
public static function isEnabled( $app ) {
return \OC_App::isEnabled( $app );
* Check if the app is enabled, redirects to home if not
* @param string $app
* @return void
+ * @since 4.0.0
*/
public static function checkAppEnabled( $app ) {
\OC_Util::checkAppEnabled( $app );
* Get the last version of the app, either from appinfo/version or from appinfo/info.xml
* @param string $app
* @return string
+ * @since 4.0.0
*/
public static function getAppVersion( $app ) {
return \OC_App::getAppVersion( $app );
use OCP\IUser;
+/**
+ * Interface IAppManager
+ *
+ * @package OCP\App
+ * @since 8.0.0
+ */
interface IAppManager {
/**
* Check if an app is enabled for user
* @param string $appId
* @param \OCP\IUser $user (optional) if not defined, the currently loggedin user will be used
* @return bool
+ * @since 8.0.0
*/
public function isEnabledForUser($appId, $user = null);
*
* @param string $appId
* @return bool
+ * @since 8.0.0
*/
public function isInstalled($appId);
* Enable an app for every user
*
* @param string $appId
+ * @since 8.0.0
*/
public function enableApp($appId);
*
* @param string $appId
* @param \OCP\IGroup[] $groups
+ * @since 8.0.0
*/
public function enableAppForGroups($appId, $groups);
* Disable an app for every user
*
* @param string $appId
+ * @since 8.0.0
*/
public function disableApp($appId);
*
* @param \OCP\IUser $user
* @return string[]
+ * @since 8.1.0
*/
public function getEnabledAppsForUser(IUser $user);
* List all installed apps
*
* @return string[]
+ * @since 8.0.0
*/
public function getInstalledApps();
/**
* Clear the cached list of apps when enabling/disabling an app
+ * @since 8.1.0
*/
public function clearAppsCache();
}
/**
* Base class to inherit your controllers from that are used for RESTful APIs
+ * @since 7.0.0
*/
abstract class ApiController extends Controller {
* defaults to 'Authorization, Content-Type, Accept'
* @param int $corsMaxAge number in seconds how long a preflighted OPTIONS
* request should be cached, defaults to 1728000 seconds
+ * @since 7.0.0
*/
public function __construct($appName,
IRequest $request,
* @NoAdminRequired
* @NoCSRFRequired
* @PublicPage
+ * @since 7.0.0
*/
public function preflightedCors() {
if(isset($this->request->server['HTTP_ORIGIN'])) {
*
* Any application must inherit this call - all controller instances to be used are
* to be registered using IContainer::registerService
+ * @since 6.0.0
*/
class App {
* @param string $topNamespace the namespace which should be prepended to
* the transformed app id, defaults to OCA\
* @return string the starting namespace for the app
+ * @since 8.0.0
*/
public static function buildAppNamespace($appId, $topNamespace='OCA\\') {
return \OC\AppFramework\App::buildAppNamespace($appId, $topNamespace);
/**
* @param array $urlParams an array with variables extracted from the routes
+ * @since 6.0.0
*/
public function __construct($appName, $urlParams = array()) {
$this->container = new \OC\AppFramework\DependencyInjection\DIContainer($appName, $urlParams);
/**
* @return IAppContainer
+ * @since 6.0.0
*/
public function getContainer() {
return $this->container;
*
* @param \OCP\Route\IRouter $router
* @param array $routes
+ * @since 6.0.0
*/
public function registerRoutes($router, $routes) {
$routeConfig = new RouteConfig($this->container, $router, $routes);
* @param string $controllerName the name of the controller under which it is
* stored in the DI container
* @param string $methodName the method that you want to call
+ * @since 6.0.0
*/
public function dispatch($controllerName, $methodName) {
\OC\AppFramework\App::main($controllerName, $methodName, $this->container);
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\Http\Response;
use OCP\IRequest;
/**
* Base class to inherit your controllers from
+ * @since 6.0.0
*/
abstract class Controller {
/**
* app name
* @var string
+ * @since 7.0.0
*/
protected $appName;
/**
* current request
* @var \OCP\IRequest
+ * @since 6.0.0
*/
protected $request;
+ /**
+ * @var array
+ * @since 7.0.0
+ */
private $responders;
/**
* constructor of the controller
* @param string $appName the name of the app
* @param IRequest $request an instance of the request
+ * @since 6.0.0 - parameter $appName was added in 7.0.0 - parameter $app was removed in 7.0.0
*/
public function __construct($appName,
IRequest $request){
* Parses an HTTP accept header and returns the supported responder type
* @param string $acceptHeader
* @return string the responder type
+ * @since 7.0.0
*/
public function getResponderByHTTPHeader($acceptHeader) {
$headers = explode(',', $acceptHeader);
* Registers a formatter for a type
* @param string $format
* @param \Closure $responder
+ * @since 7.0.0
*/
protected function registerResponder($format, \Closure $responder) {
$this->responders[$format] = $responder;
* @param string $format the format for which a formatter has been registered
* @throws \DomainException if format does not match a registered formatter
* @return Response
+ * @since 7.0.0
*/
public function buildResponse($response, $format='json') {
if(array_key_exists($format, $this->responders)) {
* 3. GET parameters
* @param string $default If the key is not found, this value will be returned
* @return mixed the content of the array
+ * @since 6.0.0
*/
public function params($key, $default=null){
return $this->request->getParam($key, $default);
* (as GET or POST) or through the URL by the route
* @deprecated use $this->request instead
* @return array the array with all parameters
+ * @since 6.0.0
*/
public function getParams() {
return $this->request->getParams();
* Returns the method of the request
* @deprecated use $this->request instead
* @return string the method of the request (POST, GET, etc)
+ * @since 6.0.0
*/
public function method() {
return $this->request->getMethod();
* @deprecated use $this->request instead
* @param string $key the key that will be taken from the $_FILES array
* @return array the file in the $_FILES element
+ * @since 6.0.0
*/
public function getUploadedFile($key) {
return $this->request->getUploadedFile($key);
* @deprecated use $this->request instead
* @param string $key the key that will be taken from the $_ENV array
* @return array the value in the $_ENV element
+ * @since 6.0.0
*/
public function env($key) {
return $this->request->getEnv($key);
* @deprecated use $this->request instead
* @param string $key the key that will be taken from the $_COOKIE array
* @return array the value in the $_COOKIE element
+ * @since 6.0.0
*/
public function cookie($key) {
return $this->request->getCookie($key);
* admin an entry in the admin settings
* @param string[] $headers set additional headers in name/value pairs
* @return \OCP\AppFramework\Http\TemplateResponse containing the page
+ * @since 6.0.0
*/
public function render($templateName, array $params=array(),
$renderAs='user', array $headers=array()){
/**
* This is returned or should be returned when a find request does not find an
* entry in the database
+ * @since 7.0.0
*/
class DoesNotExistException extends \Exception {
parent::__construct($msg);
}
-}
\ No newline at end of file
+}
/**
* @method integer getId()
* @method void setId(integer $id)
+ * @since 7.0.0
*/
abstract class Entity {
* @param array $params the array which was obtained via $this->params('key')
* in the controller
* @return Entity
+ * @since 7.0.0
*/
public static function fromParams(array $params) {
$instance = new static();
/**
* Maps the keys of the row array to the attributes
* @param array $row the row to map onto the entity
+ * @since 7.0.0
*/
public static function fromRow(array $row){
$instance = new static();
/**
- * @return an array with attribute and type
+ * @return array with attribute and type
+ * @since 7.0.0
*/
public function getFieldTypes() {
return $this->_fieldTypes;
/**
* Marks the entity as clean needed for setting the id after the insertion
+ * @since 7.0.0
*/
public function resetUpdatedFields(){
$this->_updatedFields = array();
}
-
protected function setter($name, $args) {
// setters should only work for existing attributes
if(property_exists($this, $name)){
}
}
-
protected function getter($name) {
// getters should only work for existing attributes
if(property_exists($this, $name)){
* into an array: for instance setId will save Id in the
* updated fields array so it can be easily used to create the
* getter method
+ * @since 7.0.0
*/
public function __call($methodName, $args){
$attr = lcfirst( substr($methodName, 3) );
* Transform a database columnname to a property
* @param string $columnName the name of the column
* @return string the property name
+ * @since 7.0.0
*/
public function columnToProperty($columnName){
$parts = explode('_', $columnName);
* Transform a property to a database column name
* @param string $property the name of the property
* @return string the column name
+ * @since 7.0.0
*/
public function propertyToColumn($property){
$parts = preg_split('/(?=[A-Z])/', $property);
/**
* @return array array of updated fields for update query
+ * @since 7.0.0
*/
public function getUpdatedFields(){
return $this->_updatedFields;
* Warning: This doesn't result in a unique value
* @param string $attributeName the name of the attribute, which value should be slugified
* @return string slugified value
+ * @since 7.0.0
*/
public function slugify($attributeName){
// toSlug should only work for existing attributes
/**
* Simple parent class for inheriting your data access layer from. This class
* may be subject to change in the future
+ * @since 7.0.0
*/
abstract class Mapper {
* @param string $tableName the name of the table. set this to allow entity
* @param string $entityClass the name of the entity that the sql should be
* mapped to queries without using sql
+ * @since 7.0.0
*/
public function __construct(IDBConnection $db, $tableName, $entityClass=null){
$this->db = $db;
/**
* @return string the table name
+ * @since 7.0.0
*/
public function getTableName(){
return $this->tableName;
* Deletes an entity from the table
* @param Entity $entity the entity that should be deleted
* @return Entity the deleted entity
+ * @since 7.0.0 - return value added in 8.1.0
*/
public function delete(Entity $entity){
$sql = 'DELETE FROM `' . $this->tableName . '` WHERE `id` = ?';
* Creates a new entry in the db from an entity
* @param Entity $entity the entity that should be created
* @return Entity the saved entity with the set id
+ * @since 7.0.0
*/
public function insert(Entity $entity){
// get updated fields to save, fields have to be set using a setter to
* @throws \InvalidArgumentException if entity has no id
* @param Entity $entity the entity that should be created
* @return Entity the saved entity with the set id
+ * @since 7.0.0 - return value was added in 8.0.0
*/
public function update(Entity $entity){
// if entity wasn't changed it makes no sense to run a db query
* @param int $limit the maximum number of rows
* @param int $offset from which row we want to start
* @return \PDOStatement the database query result
+ * @since 7.0.0
*/
protected function execute($sql, array $params=[], $limit=null, $offset=null){
if ($this->db instanceof IDb) {
* @throws DoesNotExistException if the item does not exist
* @throws MultipleObjectsReturnedException if more than one item exist
* @return array the result as row
+ * @since 7.0.0
*/
protected function findOneQuery($sql, array $params=[], $limit=null, $offset=null){
$stmt = $this->execute($sql, $params, $limit, $offset);
* from the current mapper name (MyEntityMapper -> MyEntity)
* @param array $row the row which should be converted to an entity
* @return Entity the entity
+ * @since 7.0.0
*/
protected function mapRowToEntity($row) {
return call_user_func($this->entityClass .'::fromRow', $row);
* @param int $limit the maximum number of rows
* @param int $offset from which row we want to start
* @return array all fetched entities
+ * @since 7.0.0
*/
protected function findEntities($sql, array $params=[], $limit=null, $offset=null) {
$stmt = $this->execute($sql, $params, $limit, $offset);
* @throws DoesNotExistException if the item does not exist
* @throws MultipleObjectsReturnedException if more than one item exist
* @return Entity the entity
+ * @since 7.0.0
*/
protected function findEntity($sql, array $params=[], $limit=null, $offset=null){
return $this->mapRowToEntity($this->findOneQuery($sql, $params, $limit, $offset));
/**
* This is returned or should be returned when a find request finds more than one
* row
+ * @since 7.0.0
*/
class MultipleObjectsReturnedException extends \Exception {
parent::__construct($msg);
}
-}
\ No newline at end of file
+}
/**
* Base class which contains constants for HTTP status codes
+ * @since 6.0.0
*/
class Http {
* should require no modification at all for most use-cases.
*
* @package OCP\AppFramework\Http
+ * @since 8.1.0
*/
class ContentSecurityPolicy {
/** @var bool Whether inline JS snippets are allowed */
* Whether inline JavaScript snippets are allowed or forbidden
* @param bool $state
* @return $this
+ * @since 8.1.0
*/
public function allowInlineScript($state = false) {
$this->inlineScriptAllowed = $state;
* Whether eval in JavaScript is allowed or forbidden
* @param bool $state
* @return $this
+ * @since 8.1.0
*/
public function allowEvalScript($state = true) {
$this->evalScriptAllowed= $state;
* allow JavaScript from all domains.
* @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized.
* @return $this
+ * @since 8.1.0
*/
public function addAllowedScriptDomain($domain) {
$this->allowedScriptDomains[] = $domain;
* Whether inline CSS snippets are allowed or forbidden
* @param bool $state
* @return $this
+ * @since 8.1.0
*/
public function allowInlineStyle($state = true) {
$this->inlineStyleAllowed = $state;
* CSS from all domains.
* @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized.
* @return $this
+ * @since 8.1.0
*/
public function addAllowedStyleDomain($domain) {
$this->allowedStyleDomains[] = $domain;
* fonts from all domains.
* @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized.
* @return $this
+ * @since 8.1.0
*/
public function addAllowedFontDomain($domain) {
$this->allowedFontDomains[] = $domain;
* images from all domains.
* @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized.
* @return $this
+ * @since 8.1.0
*/
public function addAllowedImageDomain($domain) {
$this->allowedImageDomains[] = $domain;
* To which remote domains the JS connect to.
* @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized.
* @return $this
+ * @since 8.1.0
*/
public function addAllowedConnectDomain($domain) {
$this->allowedConnectDomains[] = $domain;
* From whoch domains media elements can be embedded.
* @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized.
* @return $this
+ * @since 8.1.0
*/
public function addAllowedMediaDomain($domain) {
$this->allowedMediaDomains[] = $domain;
* From which domains objects such as <object>, <embed> or <applet> are executed
* @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized.
* @return $this
+ * @since 8.1.0
*/
public function addAllowedObjectDomain($domain) {
$this->allowedObjectDomains[] = $domain;
* Which domains can be embedded in an iframe
* @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized.
* @return $this
+ * @since 8.1.0
*/
public function addAllowedFrameDomain($domain) {
$this->allowedFrameDomains[] = $domain;
* Domains from which web-workers and nested browsing content can load elements
* @param string $domain Domain to whitelist. Any passed value needs to be properly sanitized.
* @return $this
+ * @since 8.1.0
*/
public function addAllowedChildSrcDomain($domain) {
$this->allowedChildSrcDomains[] = $domain;
/**
* Get the generated Content-Security-Policy as a string
* @return string
+ * @since 8.1.0
*/
public function buildPolicy() {
$policy = "default-src 'none';";
use OCP\AppFramework\Http;
+/**
+ * Class DataDisplayResponse
+ *
+ * @package OCP\AppFramework\Http
+ * @since 8.1.0
+ */
class DataDisplayResponse extends Response {
/**
* @param string $data the data to display
* @param int $statusCode the Http status code, defaults to 200
* @param array $headers additional key value based headers
+ * @since 8.1.0
*/
public function __construct($data="", $statusCode=Http::STATUS_OK,
$headers=[]) {
/**
* Outputs data. No processing is done.
* @return string
+ * @since 8.1.0
*/
public function render() {
return $this->data;
* Sets values in the data
* @param string $data the data to display
* @return DataDisplayResponse Reference to this object
+ * @since 8.1.0
*/
public function setData($data){
$this->data = $data;
/**
* Used to get the set parameters
* @return string the data
+ * @since 8.1.0
*/
public function getData(){
return $this->data;
*/
namespace OCP\AppFramework\Http;
+/**
+ * Class DataDownloadResponse
+ *
+ * @package OCP\AppFramework\Http
+ * @since 8.0.0
+ */
class DataDownloadResponse extends DownloadResponse {
/**
* @var string
* @param string $data text to be downloaded
* @param string $filename the name that the downloaded file should have
* @param string $contentType the mimetype that the downloaded file should have
+ * @since 8.0.0
*/
public function __construct($data, $filename, $contentType) {
$this->data = $data;
/**
* @param string $data
+ * @since 8.0.0
*/
public function setData($data) {
$this->data = $data;
/**
* @return string
+ * @since 8.0.0
*/
public function render() {
return $this->data;
/**
* A generic DataResponse class that is used to return generic data responses
* for responders to transform
+ * @since 8.0.0
*/
class DataResponse extends Response {
* @param array|object $data the object or array that should be transformed
* @param int $statusCode the Http status code, defaults to 200
* @param array $headers additional key value based headers
+ * @since 8.0.0
*/
public function __construct($data=array(), $statusCode=Http::STATUS_OK,
array $headers=array()) {
* Sets values in the data json array
* @param array|object $data an array or object which will be transformed
* @return DataResponse Reference to this object
+ * @since 8.0.0
*/
public function setData($data){
$this->data = $data;
/**
* Used to get the set parameters
* @return array the data
+ * @since 8.0.0
*/
public function getData(){
return $this->data;
/**
* Prompts the user to download the a file
+ * @since 7.0.0
*/
class DownloadResponse extends \OCP\AppFramework\Http\Response {
* Creates a response that prompts the user to download the file
* @param string $filename the name that the downloaded file should have
* @param string $contentType the mimetype that the downloaded file should have
+ * @since 7.0.0
*/
public function __construct($filename, $contentType) {
$this->filename = $filename;
* Interface ICallbackResponse
*
* @package OCP\AppFramework\Http
+ * @since 8.1.0
*/
interface ICallbackResponse {
* Outputs the content that should be printed
*
* @param IOutput $output a small wrapper that handles output
+ * @since 8.1.0
*/
function callback(IOutput $output);
/**
* Very thin wrapper class to make output testable
+ * @since 8.1.0
*/
interface IOutput {
/**
* @param string $out
+ * @since 8.1.0
*/
public function setOutput($out);
* @param string $path
*
* @return bool false if an error occured
+ * @since 8.1.0
*/
public function setReadfile($path);
/**
* @param string $header
+ * @since 8.1.0
*/
public function setHeader($header);
/**
* @return int returns the current http response code
+ * @since 8.1.0
*/
public function getHttpResponseCode();
/**
* @param int $code sets the http status code
+ * @since 8.1.0
*/
public function setHttpResponseCode($code);
* @param string $domain
* @param bool $secure
* @param bool $httponly
+ * @since 8.1.0
*/
public function setCookie($name, $value, $expire, $path, $domain, $secure, $httponly);
/**
* A renderer for JSON calls
+ * @since 6.0.0
*/
class JSONResponse extends Response {
* constructor of JSONResponse
* @param array|object $data the object or array that should be transformed
* @param int $statusCode the Http status code, defaults to 200
+ * @since 6.0.0
*/
public function __construct($data=array(), $statusCode=Http::STATUS_OK) {
$this->data = $data;
/**
* Returns the rendered json
* @return string the rendered json
+ * @since 6.0.0
*/
public function render(){
return json_encode($this->data);
* @param array|object $data an array or object which will be transformed
* to JSON
* @return JSONResponse Reference to this object
+ * @since 6.0.0 - return value was added in 7.0.0
*/
public function setData($data){
$this->data = $data;
/**
* Used to get the set parameters
* @return array the data
+ * @since 6.0.0
*/
public function getData(){
return $this->data;
/**
* A generic 404 response showing an 404 error page as well to the end-user
+ * @since 8.1.0
*/
class NotFoundResponse extends Response {
+ /**
+ * @since 8.1.0
+ */
public function __construct() {
$this->setStatus(404);
}
/**
* @return string
+ * @since 8.1.0
*/
public function render() {
$template = new Template('core', '404', 'guest');
/**
* A renderer for OCS responses
+ * @since 8.1.0
*/
class OCSResponse extends Response {
* @param int $dimension
* @param int|string $itemscount
* @param int|string $itemsperpage
+ * @since 8.1.0
*/
public function __construct($format, $status, $statuscode, $message,
$data=[], $tag='', $tagattribute='',
}
}
-
+ /**
+ * @return string
+ * @since 8.1.0
+ */
public function render() {
return OC_OCS::generateXml(
$this->format, $this->status, $this->statuscode, $this->message,
}
-}
\ No newline at end of file
+}
/**
* Redirects to a different URL
+ * @since 7.0.0
*/
class RedirectResponse extends Response {
/**
* Creates a response that redirects to a url
* @param string $redirectURL the url to redirect to
+ * @since 7.0.0
*/
public function __construct($redirectURL) {
$this->redirectURL = $redirectURL;
/**
* @return string the url to redirect
+ * @since 7.0.0
*/
public function getRedirectURL() {
return $this->redirectURL;
* Base class for responses. Also used to just send headers.
*
* It handles headers, HTTP status code, last modified and ETag.
+ * @since 6.0.0
*/
class Response {
* @param int $cacheSeconds the amount of seconds that should be cached
* if 0 then caching will be disabled
* @return $this
+ * @since 6.0.0 - return value was added in 7.0.0
*/
public function cacheFor($cacheSeconds) {
* to null cookie will be considered as session
* cookie.
* @return $this
+ * @since 8.0.0
*/
public function addCookie($name, $value, \DateTime $expireDate = null) {
$this->cookies[$name] = array('value' => $value, 'expireDate' => $expireDate);
* Set the specified cookies
* @param array $cookies array('foo' => array('value' => 'bar', 'expire' => null))
* @return $this
+ * @since 8.0.0
*/
public function setCookies(array $cookies) {
$this->cookies = $cookies;
* Invalidates the specified cookie
* @param string $name
* @return $this
+ * @since 8.0.0
*/
public function invalidateCookie($name) {
$this->addCookie($name, 'expired', new \DateTime('1971-01-01 00:00'));
* Invalidates the specified cookies
* @param array $cookieNames array('foo', 'bar')
* @return $this
+ * @since 8.0.0
*/
public function invalidateCookies(array $cookieNames) {
foreach($cookieNames as $cookieName) {
/**
* Returns the cookies
* @return array
+ * @since 8.0.0
*/
public function getCookies() {
return $this->cookies;
* @param string $name The name of the HTTP header
* @param string $value The value, null will delete it
* @return $this
+ * @since 6.0.0 - return value was added in 7.0.0
*/
public function addHeader($name, $value) {
$name = trim($name); // always remove leading and trailing whitespace
* Set the headers
* @param array $headers value header pairs
* @return $this
+ * @since 8.0.0
*/
public function setHeaders(array $headers) {
$this->headers = $headers;
/**
* Returns the set headers
* @return array the headers
+ * @since 6.0.0
*/
public function getHeaders() {
$mergeWith = [];
/**
* By default renders no output
* @return null
+ * @since 6.0.0
*/
public function render() {
return null;
/**
- * Set response status
- * @param int $status a HTTP status code, see also the STATUS constants
- * @return Response Reference to this object
- */
+ * Set response status
+ * @param int $status a HTTP status code, see also the STATUS constants
+ * @return Response Reference to this object
+ * @since 6.0.0 - return value was added in 7.0.0
+ */
public function setStatus($status) {
$this->status = $status;
* Set a Content-Security-Policy
* @param ContentSecurityPolicy $csp Policy to set for the response object
* @return $this
+ * @since 8.1.0
*/
public function setContentSecurityPolicy(ContentSecurityPolicy $csp) {
$this->contentSecurityPolicy = $csp;
* Get the currently used Content-Security-Policy
* @return ContentSecurityPolicy|null Used Content-Security-Policy or null if
* none specified.
+ * @since 8.1.0
*/
public function getContentSecurityPolicy() {
return $this->contentSecurityPolicy;
/**
* Get response status
+ * @since 6.0.0
*/
public function getStatus() {
return $this->status;
/**
* Get the ETag
* @return string the etag
+ * @since 6.0.0
*/
public function getETag() {
return $this->ETag;
/**
* Get "last modified" date
* @return \DateTime RFC2822 formatted last modified date
+ * @since 6.0.0
*/
public function getLastModified() {
return $this->lastModified;
* Set the ETag
* @param string $ETag
* @return Response Reference to this object
+ * @since 6.0.0 - return value was added in 7.0.0
*/
public function setETag($ETag) {
$this->ETag = $ETag;
* Set "last modified" date
* @param \DateTime $lastModified
* @return Response Reference to this object
+ * @since 6.0.0 - return value was added in 7.0.0
*/
public function setLastModified($lastModified) {
$this->lastModified = $lastModified;
* Class StreamResponse
*
* @package OCP\AppFramework\Http
+ * @since 8.1.0
*/
class StreamResponse extends Response implements ICallbackResponse {
/** @var string */
/**
* @param string $filePath the path to the file which should be streamed
+ * @since 8.1.0
*/
public function __construct ($filePath) {
$this->filePath = $filePath;
* Streams the file using readfile
*
* @param IOutput $output a small wrapper that handles output
+ * @since 8.1.0
*/
public function callback (IOutput $output) {
// handle caching
/**
* Response for a normal template
+ * @since 6.0.0
*/
class TemplateResponse extends Response {
* @param array $params an array of parameters which should be passed to the
* template
* @param string $renderAs how the page should be rendered, defaults to user
+ * @since 6.0.0 - parameters $params and $renderAs were added in 7.0.0
*/
public function __construct($appName, $templateName, array $params=array(),
$renderAs='user') {
* @param array $params an array with key => value structure which sets template
* variables
* @return TemplateResponse Reference to this object
+ * @since 6.0.0 - return value was added in 7.0.0
*/
public function setParams(array $params){
$this->params = $params;
/**
* Used for accessing the set parameters
* @return array the params
+ * @since 6.0.0
*/
public function getParams(){
return $this->params;
/**
* Used for accessing the name of the set template
* @return string the name of the used template
+ * @since 6.0.0
*/
public function getTemplateName(){
return $this->templateName;
* normal page including footer and header and blank
* just renders the plain template
* @return TemplateResponse Reference to this object
+ * @since 6.0.0 - return value was added in 7.0.0
*/
public function renderAs($renderAs){
$this->renderAs = $renderAs;
/**
* Returns the set renderAs
* @return string the renderAs value
+ * @since 6.0.0
*/
public function getRenderAs(){
return $this->renderAs;
/**
* Returns the rendered html
* @return string the rendered html
+ * @since 6.0.0
*/
public function render(){
// \OCP\Template needs an empty string instead of 'blank' for an unwrapped response
* @package OCP\AppFramework
*
* This container interface provides short cuts for app developers to access predefined app service.
+ * @since 6.0.0
*/
interface IAppContainer extends IContainer {
/**
* used to return the appname of the set application
* @return string the name of your application
+ * @since 6.0.0
*/
function getAppName();
/**
* @deprecated implements only deprecated methods
* @return IApi
+ * @since 6.0.0
*/
function getCoreApi();
/**
* @return \OCP\IServerContainer
+ * @since 6.0.0
*/
function getServer();
/**
* @param string $middleWare
* @return boolean
+ * @since 6.0.0
*/
function registerMiddleWare($middleWare);
/**
* @deprecated use IUserSession->isLoggedIn()
* @return boolean
+ * @since 6.0.0
*/
function isLoggedIn();
* @return boolean
* @deprecated use the groupmanager instead to find out if the user is in
* the admin group
+ * @since 6.0.0
*/
function isAdminUser();
* @param string $message
* @param string $level
* @return mixed
+ * @since 6.0.0
*/
function log($message, $level);
* deal with possible exceptions raised in the controller methods.
* They're modeled after Django's middleware system:
* https://docs.djangoproject.com/en/dev/topics/http/middleware/
+ * @since 6.0.0
*/
abstract class Middleware {
* @param Controller $controller the controller that is being called
* @param string $methodName the name of the method that will be called on
* the controller
+ * @since 6.0.0
*/
public function beforeController($controller, $methodName){
* @param \Exception $exception the thrown exception
* @throws \Exception the passed in exception if it cant handle it
* @return Response a Response object in case that the exception was handled
+ * @since 6.0.0
*/
public function afterException($controller, $methodName, \Exception $exception){
throw $exception;
* the controller
* @param Response $response the generated response from the controller
* @return Response a Response object
+ * @since 6.0.0
*/
public function afterController($controller, $methodName, Response $response){
return $response;
* the controller
* @param string $output the generated output from a response
* @return string the output that should be printed
+ * @since 6.0.0
*/
public function beforeOutput($controller, $methodName, $output){
return $output;
/**
* Base class to inherit your controllers from that are used for RESTful APIs
+ * @since 8.1.0
*/
abstract class OCSController extends ApiController {
* defaults to 'Authorization, Content-Type, Accept'
* @param int $corsMaxAge number in seconds how long a preflighted OPTIONS
* request should be cached, defaults to 1728000 seconds
+ * @since 8.1.0
*/
public function __construct($appName,
IRequest $request,
* Unwrap data and build ocs response
* @param string $format json or xml
* @param array|DataResponse $data the data which should be transformed
+ * @since 8.1.0
*/
private function buildOCSResponse($format, $data) {
if ($data instanceof DataResponse) {
use Exception;
-
+/**
+ * Class QueryException
+ *
+ * @package OCP\AppFramework
+ * @since 8.1.0
+ */
class QueryException extends Exception {}
* Reads and parses annotations from doc comments
*
* @package OCP\AppFramework\Utility
+ * @since 8.0.0
*/
interface IControllerMethodReflector {
/**
* @param object $object an object or classname
* @param string $method the method which we want to inspect
+ * @since 8.0.0
*/
public function reflect($object, $method);
* parsed
* @return string|null type in the type parameters (@param int $something)
* would return int or null if not existing
+ * @since 8.0.0
*/
public function getType($parameter);
/**
* @return array the arguments of the method with key => default value
+ * @since 8.0.0
*/
public function getParameters();
*
* @param string $name the name of the annotation
* @return bool true if the annotation is found
+ * @since 8.0.0
*/
public function hasAnnotation($name);
-}
\ No newline at end of file
+}
/**
* Needed to mock calls to time()
+ * @since 8.0.0
*/
interface ITimeFactory {
/**
* @return int the result of a call to time()
+ * @since 8.0.0
*/
public function getTime();
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Authentication;
+/**
+ * Interface IApacheBackend
+ *
+ * @package OCP\Authentication
+ * @since 6.0.0
+ */
interface IApacheBackend {
/**
* In case the user has been authenticated by Apache true is returned.
*
* @return boolean whether Apache reports a user as currently logged in.
+ * @since 6.0.0
*/
public function isSessionActive();
* supply any attribute(s) which are valid for <a>.
*
* @return string with one or more HTML attributes.
+ * @since 6.0.0
*/
public function getLogoutAttribute();
/**
* Return the id of the current user
* @return string
+ * @since 6.0.0
*/
public function getCurrentUserId();
* A regular Job will be executed every time cron.php is run, a QueuedJob will only run once and a TimedJob
* will only run at a specific interval which is to be specified in the constructor of the job by calling
* $this->setInterval($interval) with $interval in seconds.
+ * @since 4.5.0
*/
class BackgroundJob {
/**
*
* This method returns the type how background jobs are executed. If the user
* did not select something, the type is ajax.
+ * @since 5.0.0
*/
public static function getExecutionType() {
return \OC_BackgroundJob::getExecutionType();
*
* This method sets the execution type of the background jobs. Possible types
* are "none", "ajax", "webcron", "cron"
+ * @since 5.0.0
*/
public static function setExecutionType($type) {
return \OC_BackgroundJob::setExecutionType($type);
/**
* @param string $job
* @param mixed $argument
+ * @since 6.0.0
*/
public static function registerJob($job, $argument = null) {
$jobList = \OC::$server->getJobList();
* @param string $klass class name
* @param string $method method name
* @return boolean|null
+ * @since 4.5.0
*/
public static function addRegularTask($klass, $method) {
if (!\OC::needUpgrade()) {
* @return array
*
* key is string "$klass-$method", value is array( $klass, $method )
+ * @since 4.5.0
*/
static public function allRegularTasks() {
$jobList = \OC::$server->getJobList();
* Gets one queued task
* @param int $id ID of the task
* @return BackgroundJob\IJob|null
+ * @since 4.5.0
*/
public static function findQueuedTask($id) {
$jobList = \OC::$server->getJobList();
* @deprecated
* Gets all queued tasks
* @return array an array of associative arrays
+ * @since 4.5.0
*/
public static function allQueuedTasks() {
$jobList = \OC::$server->getJobList();
* Gets all queued tasks of a specific app
* @param string $app app name
* @return array an array of associative arrays
+ * @since 4.5.0
*/
public static function queuedTaskWhereAppIs($app) {
$jobList = \OC::$server->getJobList();
* @param string $method method name
* @param string $parameters all useful data as text
* @return boolean id of task
+ * @since 4.5.0
*/
public static function addQueuedTask($app, $class, $method, $parameters) {
self::registerJob('OC\BackgroundJob\Legacy\QueuedJob', array('app' => $app, 'klass' => $class, 'method' => $method, 'parameters' => $parameters));
* @return boolean|null
*
* Deletes a report
+ * @since 4.5.0
*/
public static function deleteQueuedTask($id) {
$jobList = \OC::$server->getJobList();
namespace OCP\BackgroundJob;
+/**
+ * Interface IJob
+ *
+ * @package OCP\BackgroundJob
+ * @since 7.0.0
+ */
interface IJob {
/**
* Run the background job with the registered argument
* @param \OCP\BackgroundJob\IJobList $jobList The job list that manages the state of this job
* @param \OC\Log $logger
* @return void
+ * @since 7.0.0
*/
public function execute($jobList, $logger = null);
* This id is determined by the job list when a job is added to the list
*
* @return int
+ * @since 7.0.0
*/
public function getId();
* Get the last time this job was run as unix timestamp
*
* @return int
+ * @since 7.0.0
*/
public function getLastRun();
* This is the argument that will be passed to the background job
*
* @return mixed
+ * @since 7.0.0
*/
public function getArgument();
}
namespace OCP\BackgroundJob;
+/**
+ * Interface IJobList
+ *
+ * @package OCP\BackgroundJob
+ * @since 7.0.0
+ */
interface IJobList {
/**
* Add a job to the list
* @param mixed $argument The argument to be passed to $job->run() when the job is exectured
* @param string $job
* @return void
+ * @since 7.0.0
*/
public function add($job, $argument = null);
* @param \OCP\BackgroundJob\IJob|string $job
* @param mixed $argument
* @return void
+ * @since 7.0.0
*/
public function remove($job, $argument = null);
* @param \OCP\BackgroundJob\IJob|string $job
* @param mixed $argument
* @return bool
+ * @since 7.0.0
*/
public function has($job, $argument);
* get all jobs in the list
*
* @return \OCP\BackgroundJob\IJob[]
+ * @since 7.0.0
*/
public function getAll();
* get the next job in the list
*
* @return \OCP\BackgroundJob\IJob
+ * @since 7.0.0
*/
public function getNext();
/**
* @param int $id
* @return \OCP\BackgroundJob\IJob
+ * @since 7.0.0
*/
public function getById($id);
*
* @param \OCP\BackgroundJob\IJob $job
* @return void
+ * @since 7.0.0
*/
public function setLastJob($job);
* get the id of the last ran job
*
* @return int
+ * @since 7.0.0
*/
public function getLastJob();
*
* @param \OCP\BackgroundJob\IJob $job
* @return void
+ * @since 7.0.0
*/
public function setLastRun($job);
}
namespace OCP\Command;
+/**
+ * Interface IBus
+ *
+ * @package OCP\Command
+ * @since 8.1.0
+ */
interface IBus {
/**
* Schedule a command to be fired
*
* @param \OCP\Command\ICommand | callable $command
+ * @since 8.1.0
*/
public function push($command);
* Require all commands using a trait to be run synchronous
*
* @param string $trait
+ * @since 8.1.0
*/
public function requireSync($trait);
}
namespace OCP\Command;
+/**
+ * Interface ICommand
+ *
+ * @package OCP\Command
+ * @since 8.1.0
+ */
interface ICommand {
/**
* Run the command
+ * @since 8.1.0
*/
public function handle();
}
/** @deprecated Use \OCP\Constants::FILENAME_INVALID_CHARS instead */
const FILENAME_INVALID_CHARS = "\\/<>:\"|?*\n";
+/**
+ * Class Constants
+ *
+ * @package OCP
+ * @since 8.0.0
+ */
class Constants {
/**
* CRUDS permissions.
* For updating it is mandatory to keep the id.
* Without an id a new contact will be created.
*
+ * @since 5.0.0
*/
class Contacts {
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options - for future use. One should always have options!
* @return array an array of contacts which are arrays of key-value-pairs
+ * @since 5.0.0
*/
public static function search($pattern, $searchProperties = array(), $options = array()) {
$cm = \OC::$server->getContactsManager();
* @param object $id the unique identifier to a contact
* @param string $address_book_key
* @return bool successful or not
+ * @since 5.0.0
*/
public static function delete($id, $address_book_key) {
$cm = \OC::$server->getContactsManager();
* @param array $properties this array if key-value-pairs defines a contact
* @param string $address_book_key identifier of the address book in which the contact shall be created or updated
* @return array an array representing the contact just created or updated
+ * @since 5.0.0
*/
public static function createOrUpdate($properties, $address_book_key) {
$cm = \OC::$server->getContactsManager();
* Check if contacts are available (e.g. contacts app enabled)
*
* @return bool true if enabled, false if not
+ * @since 5.0.0
*/
public static function isEnabled() {
$cm = \OC::$server->getContactsManager();
/**
* @param \OCP\IAddressBook $address_book
+ * @since 5.0.0
*/
public static function registerAddressBook(\OCP\IAddressBook $address_book) {
$cm = \OC::$server->getContactsManager();
/**
* @param \OCP\IAddressBook $address_book
+ * @since 5.0.0
*/
public static function unregisterAddressBook(\OCP\IAddressBook $address_book) {
$cm = \OC::$server->getContactsManager();
/**
* @return array
+ * @since 5.0.0
*/
public static function getAddressBooks() {
$cm = \OC::$server->getContactsManager();
/**
* removes all registered address book instances
+ * @since 5.0.0
*/
public static function clear() {
$cm = \OC::$server->getContactsManager();
* For updating it is mandatory to keep the id.
* Without an id a new contact will be created.
*
+ * @since 6.0.0
*/
interface IManager {
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options - for future use. One should always have options!
* @return array an array of contacts which are arrays of key-value-pairs
+ * @since 6.0.0
*/
function search($pattern, $searchProperties = array(), $options = array());
* @param object $id the unique identifier to a contact
* @param string $address_book_key identifier of the address book in which the contact shall be deleted
* @return bool successful or not
+ * @since 6.0.0
*/
function delete($id, $address_book_key);
* @param array $properties this array if key-value-pairs defines a contact
* @param string $address_book_key identifier of the address book in which the contact shall be created or updated
* @return array an array representing the contact just created or updated
+ * @since 6.0.0
*/
function createOrUpdate($properties, $address_book_key);
* Check if contacts are available (e.g. contacts app enabled)
*
* @return bool true if enabled, false if not
+ * @since 6.0.0
*/
function isEnabled();
*
* @param \OCP\IAddressBook $address_book
* @return void
+ * @since 6.0.0
*/
function registerAddressBook(\OCP\IAddressBook $address_book);
*
* @param \OCP\IAddressBook $address_book
* @return void
+ * @since 6.0.0
*/
function unregisterAddressBook(\OCP\IAddressBook $address_book);
*
* @param \Closure $callable
* @return void
+ * @since 6.0.0
*/
function register(\Closure $callable);
/**
* @return array
+ * @since 6.0.0
*/
function getAddressBooks();
/**
* removes all registered address book instances
* @return void
+ * @since 6.0.0
*/
function clear();
}
/**
* This class provides access to the internal database system. Use this class exlusively if you want to access databases
+ * @since 4.5.0
*/
class DB {
/**
* @return \OC_DB_StatementWrapper prepared SQL query
*
* SQL query via Doctrine prepare(), needs to be execute()'d!
+ * @since 4.5.0
*/
static public function prepare( $query, $limit=null, $offset=null ) {
return(\OC_DB::prepare($query, $limit, $offset));
* If this is null or an empty array, all keys of $input will be compared
* @return int number of inserted rows
* @throws \Doctrine\DBAL\DBALException
+ * @since 5.0.0 - parameter $compare was added in 8.1.0
*
*/
public static function insertIfNotExist($table, $input, array $compare = null) {
*
* Call this method right after the insert command or other functions may
* cause trouble!
+ * @since 4.5.0
*/
public static function insertid($table=null) {
return(\OC_DB::insertid($table));
/**
* Start a transaction
+ * @since 4.5.0
*/
public static function beginTransaction() {
\OC_DB::beginTransaction();
/**
* Commit the database changes done during a transaction that is in progress
+ * @since 4.5.0
*/
public static function commit() {
\OC_DB::commit();
/**
* Rollback the database changes done during a transaction that is in progress
+ * @since 8.0.0
*/
public static function rollback() {
\OC_DB::rollback();
* Check if a result is an error, works with Doctrine
* @param mixed $result
* @return bool
+ * @since 4.5.0
*/
public static function isError($result) {
return(\OC_DB::isError($result));
* works with DoctrineException
* @param mixed $error
* @return string
+ * @since 6.0.0
*/
public static function getErrorMessage($error) {
return(\OC_DB::getErrorMessage($error));
/**
* public api to access default strings and urls for your templates
+ * @since 6.0.0
*/
class Defaults {
/**
* \OC_Defaults instance to retrieve the defaults
* @return string
+ * @since 6.0.0
*/
private $defaults;
/**
* get base URL for the organisation behind your ownCloud instance
* @return string
+ * @since 6.0.0
*/
public function getBaseUrl() {
return $this->defaults->getBaseUrl();
/**
* link to the desktop sync client
* @return string
+ * @since 6.0.0
*/
public function getSyncClientUrl() {
return $this->defaults->getSyncClientUrl();
/**
* link to the iOS client
* @return string
+ * @since 8.0.0
*/
public function getiOSClientUrl() {
return $this->defaults->getiOSClientUrl();
/**
* link to the Android client
* @return string
+ * @since 8.0.0
*/
public function getAndroidClientUrl() {
return $this->defaults->getAndroidClientUrl();
/**
* base URL to the documentation of your ownCloud instance
* @return string
+ * @since 6.0.0
*/
public function getDocBaseUrl() {
return $this->defaults->getDocBaseUrl();
/**
* name of your ownCloud instance
* @return string
+ * @since 6.0.0
*/
public function getName() {
return $this->defaults->getName();
/**
* name of your ownCloud instance containing HTML styles
* @return string
+ * @since 8.0.0
*/
public function getHTMLName() {
return $this->defaults->getHTMLName();
/**
* Entity behind your onwCloud instance
* @return string
+ * @since 6.0.0
*/
public function getEntity() {
return $this->defaults->getEntity();
/**
* ownCloud slogan
* @return string
+ * @since 6.0.0
*/
public function getSlogan() {
return $this->defaults->getSlogan();
/**
* logo claim
* @return string
+ * @since 6.0.0
*/
public function getLogoClaim() {
return $this->defaults->getLogoClaim();
/**
* footer, short version
* @return string
+ * @since 6.0.0
*/
public function getShortFooter() {
return $this->defaults->getShortFooter();
/**
* footer, long version
* @return string
+ * @since 6.0.0
*/
public function getLongFooter() {
return $this->defaults->getLongFooter();
/**
* Returns the AppId for the App Store for the iOS Client
* @return string AppId
+ * @since 8.0.0
*/
public function getiTunesAppId() {
return $this->defaults->getiTunesAppId();
namespace OCP\Diagnostics;
+/**
+ * Interface IEvent
+ *
+ * @package OCP\Diagnostics
+ * @since 8.0.0
+ */
interface IEvent {
/**
* @return string
+ * @since 8.0.0
*/
public function getId();
/**
* @return string
+ * @since 8.0.0
*/
public function getDescription();
/**
* @return float
+ * @since 8.0.0
*/
public function getStart();
/**
* @return float
+ * @since 8.0.0
*/
public function getEnd();
/**
* @return float
+ * @since 8.0.0
*/
public function getDuration();
}
namespace OCP\Diagnostics;
+/**
+ * Interface IEventLogger
+ *
+ * @package OCP\Diagnostics
+ * @since 8.0.0
+ */
interface IEventLogger {
/**
* Mark the start of an event
*
* @param string $id
* @param string $description
+ * @since 8.0.0
*/
public function start($id, $description);
* Mark the end of an event
*
* @param string $id
+ * @since 8.0.0
*/
public function end($id);
* @param string $description
* @param float $start
* @param float $end
+ * @since 8.0.0
*/
public function log($id, $description, $start, $end);
/**
* @return \OCP\Diagnostics\IEvent[]
+ * @since 8.0.0
*/
public function getEvents();
}
namespace OCP\Diagnostics;
+/**
+ * Interface IQuery
+ *
+ * @package OCP\Diagnostics
+ * @since 8.0.0
+ */
interface IQuery {
/**
* @return string
+ * @since 8.0.0
*/
public function getSql();
/**
* @return array
+ * @since 8.0.0
*/
public function getParams();
/**
* @return float
+ * @since 8.0.0
*/
public function getDuration();
}
use Doctrine\DBAL\Logging\SQLLogger;
+/**
+ * Interface IQueryLogger
+ *
+ * @package OCP\Diagnostics
+ * @since 8.0.0
+ */
interface IQueryLogger extends SQLLogger {
/**
* @param string $sql
* @param array $params
* @param array $types
+ * @since 8.0.0
*/
public function startQuery($sql, array $params = null, array $types = null);
+ /**
+ * @return mixed
+ * @since 8.0.0
+ */
public function stopQuery();
/**
* @return \OCP\Diagnostics\IQuery[]
+ * @since 8.0.0
*/
public function getQueries();
}
namespace OCP\Encryption\Exceptions;
-
+/**
+ * Class GenericEncryptionException
+ *
+ * @package OCP\Encryption\Exceptions
+ * @since 8.1.0
+ */
class GenericEncryptionException extends \Exception {
/**
* @param string $message
* @param int $code
* @param \Exception $previous
+ * @since 8.1.0
*/
public function __construct($message = '', $code = 0, \Exception $previous = null) {
if (empty($message)) {
namespace OCP\Encryption;
+/**
+ * Interface IEncryptionModule
+ *
+ * @package OCP\Encryption
+ * @since 8.1.0
+ */
interface IEncryptionModule {
/**
* @return string defining the technical unique id
+ * @since 8.1.0
*/
public function getId();
* In comparison to getKey() this function returns a human readable (maybe translated) name
*
* @return string
+ * @since 8.1.0
*/
public function getDisplayName();
* $return array $header contain data as key-value pairs which should be
* written to the header, in case of a write operation
* or if no additional data is needed return a empty array
+ * @since 8.1.0
*/
public function begin($path, $user, array $header, array $accessList);
* @param string $path to the file
* @return string remained data which should be written to the file in case
* of a write operation
+ * @since 8.1.0
*/
public function end($path);
*
* @param string $data you want to encrypt
* @return mixed encrypted data
+ * @since 8.1.0
*/
public function encrypt($data);
*
* @param string $data you want to decrypt
* @return mixed decrypted data
+ * @since 8.1.0
*/
public function decrypt($data);
* @param string $uid of the user who performs the operation
* @param array $accessList who has access to the file contains the key 'users' and 'public'
* @return boolean
+ * @since 8.1.0
*/
public function update($path, $uid, array $accessList);
*
* @param string $path
* @return boolean
+ * @since 8.1.0
*/
public function shouldEncrypt($path);
* ownCloud read/write files with a block size of 8192 byte
*
* @return integer
+ * @since 8.1.0
*/
public function getUnencryptedBlockSize();
}
namespace OCP\Encryption;
+/**
+ * Interface IFile
+ *
+ * @package OCP\Encryption
+ * @since 8.1.0
+ */
interface IFile {
/**
*
* @param string $path to the file
* @return array
+ * @since 8.1.0
*/
public function getAccessList($path);
/**
* This class provides access to files encryption apps.
*
+ * @since 8.1.0
*/
interface IManager {
* Check if encryption is available (at least one encryption module needs to be enabled)
*
* @return bool true if enabled, false if not
+ * @since 8.1.0
*/
function isEnabled();
*
* @param IEncryptionModule $module
* @throws ModuleAlreadyExistsException
+ * @since 8.1.0
*/
function registerEncryptionModule(IEncryptionModule $module);
* Unregisters an encryption module
*
* @param IEncryptionModule $module
+ * @since 8.1.0
*/
function unregisterEncryptionModule(IEncryptionModule $module);
* get a list of all encryption modules
*
* @return array
+ * @since 8.1.0
*/
function getEncryptionModules();
* @param string $moduleId
* @return IEncryptionModule
* @throws ModuleDoesNotExistsException
+ * @since 8.1.0
*/
function getEncryptionModule($moduleId);
*
* @return \OCP\Encryption\IEncryptionModule
* @throws ModuleDoesNotExistsException
+ * @since 8.1.0
*/
public function getDefaultEncryptionModule();
*
* @param string $moduleId
* @return string
+ * @since 8.1.0
*/
public function setDefaultEncryptionModule($moduleId);
namespace OCP\Encryption\Keys;
+/**
+ * Interface IStorage
+ *
+ * @package OCP\Encryption\Keys
+ * @since 8.1.0
+ */
interface IStorage {
/**
* @param string $keyId id of the key
*
* @return mixed key
+ * @since 8.1.0
*/
public function getUserKey($uid, $keyId);
* @param string $keyId id of the key
*
* @return mixed key
+ * @since 8.1.0
*/
public function getFileKey($path, $keyId);
* @param string $keyId id of the key
*
* @return mixed key
+ * @since 8.1.0
*/
public function getSystemUserKey($keyId);
* @param string $uid ID if the user for whom we want the key
* @param string $keyId id of the key
* @param mixed $key
+ * @since 8.1.0
*/
public function setUserKey($uid, $keyId, $key);
* @param string $path path to file
* @param string $keyId id of the key
* @param boolean
+ * @since 8.1.0
*/
public function setFileKey($path, $keyId, $key);
* @param mixed $key
*
* @return mixed key
+ * @since 8.1.0
*/
public function setSystemUserKey($keyId, $key);
* @param string $keyId id of the key
*
* @return boolean False when the key could not be deleted
+ * @since 8.1.0
*/
public function deleteUserKey($uid, $keyId);
* @param string $keyId id of the key
*
* @return boolean False when the key could not be deleted
+ * @since 8.1.0
*/
public function deleteFileKey($path, $keyId);
*
* @param string $path to the file
* @return boolean False when the keys could not be deleted
+ * @since 8.1.0
*/
public function deleteAllFileKeys($path);
* @param string $keyId id of the key
*
* @return boolean False when the key could not be deleted
+ * @since 8.1.0
*/
public function deleteSystemUserKey($keyId);
*
* @param string $source
* @param string $target
+ * @since 8.1.0
*/
public function renameKeys($source, $target);
*
* @param string $source
* @param string $target
+ * @since 8.1.0
*/
public function copyKeys($source, $target);
/**
* This class provides access to the internal filesystem abstraction layer. Use
* this class exlusively if you want to access files
+ * @since 5.0.0
*/
class Files {
/**
* Recusive deletion of folders
* @return bool
+ * @since 5.0.0
*/
static function rmdirr( $dir ) {
return \OC_Helper::rmdirr( $dir );
* @param string $path
* @return string
* does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead
+ * @since 5.0.0
*/
static function getMimeType( $path ) {
return(\OC_Helper::getMimeType( $path ));
* Search for files by mimetype
* @param string $mimetype
* @return array
+ * @since 6.0.0
*/
static public function searchByMime( $mimetype ) {
return(\OC\Files\Filesystem::searchByMime( $mimetype ));
* @param resource $source
* @param resource $target
* @return int the number of bytes copied
+ * @since 5.0.0
*/
public static function streamCopy( $source, $target ) {
list($count, $result) = \OC_Helper::streamCopy( $source, $target );
* @return string
*
* temporary files are automatically cleaned up after the script is finished
+ * @since 5.0.0
*/
public static function tmpFile( $postfix='' ) {
return(\OC_Helper::tmpFile( $postfix ));
* @return string
*
* temporary files are automatically cleaned up after the script is finished
+ * @since 5.0.0
*/
public static function tmpFolder() {
return(\OC_Helper::tmpFolder());
* @param string $path
* @param string $filename
* @return string
+ * @since 5.0.0
*/
public static function buildNotExistingFileName( $path, $filename ) {
return(\OC_Helper::buildNotExistingFileName( $path, $filename ));
* existant
* @param string $app
* @return \OC\Files\View
+ * @since 5.0.0
*/
public static function getStorage( $app ) {
return \OC_App::getStorage( $app );
/**
* Exception for already existing files/folders
+ * @since 6.0.0
*/
class AlreadyExistsException extends \Exception {}
/**
* Provides
+ * @since 8.0.0
*/
interface IMountProvider {
/**
* @param \OCP\IUser $user
* @param \OCP\Files\Storage\IStorageFactory $loader
* @return \OCP\Files\Mount\IMountPoint[]
+ * @since 8.0.0
*/
public function getMountsForUser(IUser $user, IStorageFactory $loader);
}
/**
* Manages the different mount providers
+ * @since 8.0.0
*/
interface IMountProviderCollection {
/**
*
* @param \OCP\IUser $user
* @return \OCP\Files\Mount\IMountPoint[]
+ * @since 8.0.0
*/
public function getMountsForUser(IUser $user);
* Add a provider for mount points
*
* @param \OCP\Files\Config\IMountProvider $provider
+ * @since 8.0.0
*/
public function registerProvider(IMountProvider $provider);
}
/**
* Exception for too large entity
+ * @since 6.0.0
*/
class EntityTooLargeException extends \Exception {}
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
+/**
+ * Interface File
+ *
+ * @package OCP\Files
+ * @since 6.0.0
+ */
interface File extends Node {
/**
* Get the content of the file as string
*
* @return string
* @throws \OCP\Files\NotPermittedException
+ * @since 6.0.0
*/
public function getContent();
* @param string $data
* @throws \OCP\Files\NotPermittedException
* @return void
+ * @since 6.0.0
*/
public function putContent($data);
* Get the mimetype of the file
*
* @return string
+ * @since 6.0.0
*/
public function getMimeType();
* @param string $mode
* @return resource
* @throws \OCP\Files\NotPermittedException
+ * @since 6.0.0
*/
public function fopen($mode);
* @param string $type
* @param bool $raw
* @return string
+ * @since 6.0.0
*/
public function hash($type, $raw = false);
}
*/
namespace OCP\Files;
+/**
+ * Interface FileInfo
+ *
+ * @package OCP\Files
+ * @since 7.0.0
+ */
interface FileInfo {
+ /**
+ * @since 7.0.0
+ */
const TYPE_FILE = 'file';
+ /**
+ * @since 7.0.0
+ */
const TYPE_FOLDER = 'dir';
- /*
+ /**
* @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value
+ * @since 8.0.0
*/
const SPACE_NOT_COMPUTED = -1;
- /*
+ /**
* @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value
+ * @since 8.0.0
*/
const SPACE_UNKNOWN = -2;
- /*
+ /**
* @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unlimited space
+ * @since 8.0.0
*/
const SPACE_UNLIMITED = -3;
* Get the Etag of the file or folder
*
* @return string
+ * @since 7.0.0
*/
public function getEtag();
* Get the size in bytes for the file or folder
*
* @return int
+ * @since 7.0.0
*/
public function getSize();
* Get the last modified date as timestamp for the file or folder
*
* @return int
+ * @since 7.0.0
*/
public function getMtime();
* Get the name of the file or folder
*
* @return string
+ * @since 7.0.0
*/
public function getName();
* Get the path relative to the storage
*
* @return string
+ * @since 7.0.0
*/
public function getInternalPath();
* Get the absolute path
*
* @return string
+ * @since 7.0.0
*/
public function getPath();
* Get the full mimetype of the file or folder i.e. 'image/png'
*
* @return string
+ * @since 7.0.0
*/
public function getMimetype();
* Get the first part of the mimetype of the file or folder i.e. 'image'
*
* @return string
+ * @since 7.0.0
*/
public function getMimePart();
* Get the storage the file or folder is storage on
*
* @return \OCP\Files\Storage
+ * @since 7.0.0
*/
public function getStorage();
* Get the file id of the file or folder
*
* @return int
+ * @since 7.0.0
*/
public function getId();
* Check whether the file is encrypted
*
* @return bool
+ * @since 7.0.0
*/
public function isEncrypted();
* \OCP\Constants::PERMISSION_ALL
*
* @return int
+ * @since 7.0.0 - namespace of constants has changed in 8.0.0
*/
public function getPermissions();
* Check whether this is a file or a folder
*
* @return \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
+ * @since 7.0.0
*/
public function getType();
* Check if the file or folder is readable
*
* @return bool
+ * @since 7.0.0
*/
public function isReadable();
* Check if a file is writable
*
* @return bool
+ * @since 7.0.0
*/
public function isUpdateable();
* Check whether new files or folders can be created inside this folder
*
* @return bool
+ * @since 8.0.0
*/
public function isCreatable();
* Check if a file or folder can be deleted
*
* @return bool
+ * @since 7.0.0
*/
public function isDeletable();
* Check if a file or folder can be shared
*
* @return bool
+ * @since 7.0.0
*/
public function isShareable();
* Check if a file or folder is shared
*
* @return bool
+ * @since 7.0.0
*/
public function isShared();
* Check if a file or folder is mounted
*
* @return bool
+ * @since 7.0.0
*/
public function isMounted();
* Get the mountpoint the file belongs to
*
* @return \OCP\Files\Mount\IMountPoint
+ * @since 8.0.0
*/
public function getMountPoint();
}
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
-
+/**
+ * Class FileNameTooLongException
+ *
+ * @package OCP\Files
+ * @since 8.1.0
+ */
class FileNameTooLongException extends InvalidPathException {
}
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
+/**
+ * @since 6.0.0
+ */
interface Folder extends Node {
/**
* 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
* @return string
* @throws \OCP\Files\NotPermittedException
+ * @since 6.0.0
*/
public function getFullPath($path);
* @param string $path absolute path of an item in the folder
* @throws \OCP\Files\NotFoundException
* @return string
+ * @since 6.0.0
*/
public function getRelativePath($path);
*
* @param \OCP\Files\Node $node
* @return bool
+ * @since 6.0.0
*/
public function isSubNode($node);
*
* @throws \OCP\Files\NotFoundException
* @return \OCP\Files\Node[]
+ * @since 6.0.0
*/
public function getDirectoryListing();
* @param string $path relative path of the file or folder
* @return \OCP\Files\Node
* @throws \OCP\Files\NotFoundException
+ * @since 6.0.0
*/
public function get($path);
*
* @param string $path relative path of the file or folder
* @return bool
+ * @since 6.0.0
*/
public function nodeExists($path);
* @param string $path relative path of the new folder
* @return \OCP\Files\Folder
* @throws \OCP\Files\NotPermittedException
+ * @since 6.0.0
*/
public function newFolder($path);
*
* @param string $query
* @return \OCP\Files\Node[]
+ * @since 6.0.0
*/
public function search($query);
*
* @param string $mimetype
* @return \OCP\Files\Node[]
+ * @since 6.0.0
*/
public function searchByMime($mimetype);
* @param string|int $tag tag name or tag id
* @param string $userId owner of the tags
* @return \OCP\Files\Node[]
+ * @since 8.0.0
*/
public function searchByTag($tag, $userId);
*
* @param int $id
* @return \OCP\Files\Node[]
+ * @since 6.0.0
*/
public function getById($id);
* Get the amount of free space inside the folder
*
* @return int
+ * @since 6.0.0
*/
public function getFreeSpace();
* Check if new files or folders can be created within the folder
*
* @return bool
+ * @since 6.0.0
*/
public function isCreatable();
* @param string $name
* @return string
* @throws NotPermittedException
+ * @since 8.1.0
*/
public function getNonExistingName($name);
}
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
+/**
+ * Interface IHomeStorage
+ *
+ * @package OCP\Files
+ * @since 7.0.0
+ */
interface IHomeStorage {
}
/**
* Exception for invalid path
+ * @since 8.1.0
*/
class InvalidCharacterInPathException extends InvalidPathException {
/**
* Exception for invalid content
+ * @since 6.0.0
*/
class InvalidContentException extends \Exception {}
/**
* Exception for invalid path
+ * @since 6.0.0
*/
class InvalidPathException extends \Exception {}
use OC\Hooks\Emitter;
-
+/**
+ * Interface IRootFolder
+ *
+ * @package OCP\Files
+ * @since 8.0.0
+ */
interface IRootFolder extends Folder, Emitter {
}
/**
* Exception for a file that is locked
+ * @since 7.0.0
*/
class LockNotAcquiredException extends \Exception {
/** @var string $path The path that could not be locked */
/**
* A storage mounted to folder on the filesystem
+ * @since 8.0.0
*/
interface IMountPoint {
* get complete path to the mount point
*
* @return string
+ * @since 8.0.0
*/
public function getMountPoint();
* Set the mountpoint
*
* @param string $mountPoint new mount point
+ * @since 8.0.0
*/
public function setMountPoint($mountPoint);
* Get the storage that is mounted
*
* @return \OC\Files\Storage\Storage
+ * @since 8.0.0
*/
public function getStorage();
* Get the id of the storages
*
* @return string
+ * @since 8.0.0
*/
public function getStorageId();
*
* @param string $path absolute path to a file or folder
* @return string
+ * @since 8.0.0
*/
public function getInternalPath($path);
* Apply a storage wrapper to the mounted storage
*
* @param callable $wrapper
+ * @since 8.0.0
*/
public function wrapStorage($wrapper);
* @param string $name Name of the mount option to get
* @param mixed $default Default value for the mount option
* @return mixed
+ * @since 8.0.0
*/
public function getOption($name, $default);
* Get all options for the mount
*
* @return array
+ * @since 8.1.0
*/
public function getOptions();
}
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP\Files;
+/**
+ * Interface Node
+ *
+ * @package OCP\Files
+ * @since 6.0.0 - extends FileInfo was added in 8.0.0
+ */
interface Node extends FileInfo {
/**
* Move the file or folder to a new location
* @param string $targetPath the absolute target path
* @throws \OCP\Files\NotPermittedException
* @return \OCP\Files\Node
+ * @since 6.0.0
*/
public function move($targetPath);
/**
* Delete the file or folder
* @return void
+ * @since 6.0.0
*/
public function delete();
*
* @param string $targetPath the absolute target path
* @return \OCP\Files\Node
+ * @since 6.0.0
*/
public function copy($targetPath);
* @param int $mtime (optional) modified date as unix timestamp
* @throws \OCP\Files\NotPermittedException
* @return void
+ * @since 6.0.0
*/
public function touch($mtime = null);
*
* @return \OCP\Files\Storage
* @throws \OCP\Files\NotFoundException
+ * @since 6.0.0
*/
public function getStorage();
* Get the full path of the file or folder
*
* @return string
+ * @since 6.0.0
*/
public function getPath();
* Get the path of the file or folder relative to the mountpoint of it's storage
*
* @return string
+ * @since 6.0.0
*/
public function getInternalPath();
* @return int
* @throws InvalidPathException
* @throws NotFoundException
+ * @since 6.0.0
*/
public function getId();
* - size
*
* @return array
+ * @since 6.0.0
*/
public function stat();
* @return int
* @throws InvalidPathException
* @throws NotFoundException
+ * @since 6.0.0
*/
public function getMTime();
* @return int
* @throws InvalidPathException
* @throws NotFoundException
+ * @since 6.0.0
*/
public function getSize();
* @return string
* @throws InvalidPathException
* @throws NotFoundException
+ * @since 6.0.0
*/
public function getEtag();
* @return int
* @throws InvalidPathException
* @throws NotFoundException
+ * @since 6.0.0 - namespace of constants has changed in 8.0.0
*/
public function getPermissions();
* @return bool
* @throws InvalidPathException
* @throws NotFoundException
+ * @since 6.0.0
*/
public function isReadable();
* @return bool
* @throws InvalidPathException
* @throws NotFoundException
+ * @since 6.0.0
*/
public function isUpdateable();
* @return bool
* @throws InvalidPathException
* @throws NotFoundException
+ * @since 6.0.0
*/
public function isDeletable();
* @return bool
* @throws InvalidPathException
* @throws NotFoundException
+ * @since 6.0.0
*/
public function isShareable();
* Get the parent folder of the file or folder
*
* @return Folder
+ * @since 6.0.0
*/
public function getParent();
* Get the filename of the file or folder
*
* @return string
+ * @since 6.0.0
*/
public function getName();
}
/**
* Exception for not enough space
+ * @since 6.0.0
*/
class NotEnoughSpaceException extends \Exception {}
/**
* Exception for not found entity
+ * @since 6.0.0
*/
class NotFoundException extends \Exception {}
/**
* Exception for not permitted action
+ * @since 6.0.0
*/
class NotPermittedException extends \Exception {}
*/
namespace OCP\Files\ObjectStore;
+/**
+ * Interface IObjectStore
+ *
+ * @package OCP\Files\ObjectStore
+ * @since 7.0.0
+ */
interface IObjectStore {
/**
* @return string the container or bucket name where objects are stored
+ * @since 7.0.0
*/
function getStorageId();
/**
* @param string $urn the unified resource name used to identify the object
* @return resource stream with the read data
- * @throws Exception when something goes wrong, message will be logged
+ * @throws \Exception when something goes wrong, message will be logged
+ * @since 7.0.0
*/
function readObject($urn);
/**
* @param string $urn the unified resource name used to identify the object
* @param resource $stream stream with the data to write
- * @throws Exception when something goes wrong, message will be logged
+ * @throws \Exception when something goes wrong, message will be logged
+ * @since 7.0.0
*/
function writeObject($urn, $stream);
/**
* @param string $urn the unified resource name used to identify the object
* @return void
- * @throws Exception when something goes wrong, message will be logged
+ * @throws \Exception when something goes wrong, message will be logged
+ * @since 7.0.0
*/
function deleteObject($urn);
-}
\ No newline at end of file
+}
/**
* Exception for invalid path
+ * @since 8.1.0
*/
class ReservedWordException extends InvalidPathException {
* Provide a common interface to all different storage options
*
* All paths passed to the storage are relative to the storage and should NOT have a leading slash.
+ * @since 6.0.0
*/
interface Storage {
/**
*
* @param array $parameters
* @return void
+ * @since 6.0.0
*/
public function __construct($parameters);
* and two storage objects with the same id should refer to two storages that display the same files.
*
* @return string
+ * @since 6.0.0
*/
public function getId();
*
* @param string $path
* @return bool
+ * @since 6.0.0
*/
public function mkdir($path);
*
* @param string $path
* @return bool
+ * @since 6.0.0
*/
public function rmdir($path);
*
* @param string $path
* @return resource|false
+ * @since 6.0.0
*/
public function opendir($path);
*
* @param string $path
* @return bool
+ * @since 6.0.0
*/
public function is_dir($path);
*
* @param string $path
* @return bool
+ * @since 6.0.0
*/
public function is_file($path);
*
* @param string $path
* @return array|false
+ * @since 6.0.0
*/
public function stat($path);
*
* @param string $path
* @return string|false
+ * @since 6.0.0
*/
public function filetype($path);
*
* @param string $path
* @return int|false
+ * @since 6.0.0
*/
public function filesize($path);
*
* @param string $path
* @return bool
+ * @since 6.0.0
*/
public function isCreatable($path);
*
* @param string $path
* @return bool
+ * @since 6.0.0
*/
public function isReadable($path);
*
* @param string $path
* @return bool
+ * @since 6.0.0
*/
public function isUpdatable($path);
*
* @param string $path
* @return bool
+ * @since 6.0.0
*/
public function isDeletable($path);
*
* @param string $path
* @return bool
+ * @since 6.0.0
*/
public function isSharable($path);
*
* @param string $path
* @return int
+ * @since 6.0.0
*/
public function getPermissions($path);
*
* @param string $path
* @return bool
+ * @since 6.0.0
*/
public function file_exists($path);
*
* @param string $path
* @return int|false
+ * @since 6.0.0
*/
public function filemtime($path);
*
* @param string $path
* @return string|false
+ * @since 6.0.0
*/
public function file_get_contents($path);
* @param string $path
* @param string $data
* @return bool
+ * @since 6.0.0
*/
public function file_put_contents($path, $data);
*
* @param string $path
* @return bool
+ * @since 6.0.0
*/
public function unlink($path);
* @param string $path1
* @param string $path2
* @return bool
+ * @since 6.0.0
*/
public function rename($path1, $path2);
* @param string $path1
* @param string $path2
* @return bool
+ * @since 6.0.0
*/
public function copy($path1, $path2);
* @param string $path
* @param string $mode
* @return resource|false
+ * @since 6.0.0
*/
public function fopen($path, $mode);
*
* @param string $path
* @return string|false
+ * @since 6.0.0
*/
public function getMimeType($path);
* @param string $path
* @param bool $raw
* @return string|false
+ * @since 6.0.0
*/
public function hash($type, $path, $raw = false);
*
* @param string $path
* @return int|false
+ * @since 6.0.0
*/
public function free_space($path);
*
* @param string $query
* @return array|false
+ * @since 6.0.0
*/
public function search($query);
* @param string $path
* @param int $mtime
* @return bool
+ * @since 6.0.0
*/
public function touch($path, $mtime = null);
*
* @param string $path
* @return string|false
+ * @since 6.0.0
*/
public function getLocalFile($path);
*
* @param string $path
* @return string|false
+ * @since 6.0.0
*/
public function getLocalFolder($path);
/**
* @param string $path
* @param int $time
* @return bool
+ * @since 6.0.0
*
* hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
* returning true for other changes in the folder is optional
*
* @param string $path
* @return string|false
+ * @since 6.0.0
*/
public function getETag($path);
* it might return a temporary file.
*
* @return bool true if the files are stored locally, false otherwise
+ * @since 7.0.0
*/
public function isLocal();
*
* @param string $class
* @return bool
+ * @since 7.0.0
*/
public function instanceOfStorage($class);
*
* @param string $path
* @return array|false
+ * @since 8.0.0
*/
public function getDirectDownload($path);
* @param string $fileName the name of the file itself
* @return void
* @throws InvalidPathException
+ * @since 8.1.0
*/
public function verifyPath($path, $fileName);
* @param string $sourceInternalPath
* @param string $targetInternalPath
* @return bool
+ * @since 8.1.0
*/
public function copyFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath);
* @param string $sourceInternalPath
* @param string $targetInternalPath
* @return bool
+ * @since 8.1.0
*/
public function moveFromStorage(\OCP\Files\Storage $sourceStorage, $sourceInternalPath, $targetInternalPath);
}
/**
* Creates storage instances and manages and applies storage wrappers
+ * @since 8.0.0
*/
interface IStorageFactory {
/**
* @param callable $callback
* @return bool true if the wrapper was added, false if there was already a wrapper with this
* name registered
+ * @since 8.0.0
*/
public function addStorageWrapper($wrapperName, $callback);
* @param string $class
* @param array $arguments
* @return \OCP\Files\Storage
+ * @since 8.0.0
*/
public function getInstance(IMountPoint $mountPoint, $class, $arguments);
}
/**
* Storage has invalid configuration
+ * @since 7.0.0
*/
class StorageInvalidException extends \Exception {
}
/**
* Storage is temporarily not available
+ * @since 6.0.0
*/
class StorageNotAvailableException extends \Exception {
}
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
+/**
+ * Interface GroupInterface
+ *
+ * @package OCP
+ * @since 4.5.0
+ */
interface GroupInterface extends \OC_Group_Interface {}
* Interface IClient
*
* @package OCP\Http
+ * @since 8.1.0
*/
interface IClient {
* 'debug' => true,
* @return IResponse
* @throws \Exception If the request could not get completed
+ * @since 8.1.0
*/
public function get($uri, array $options = []);
* 'verify' => true, // bool or string to CA file
* 'debug' => true,
* @return IResponse
+ * @since 8.1.0
*/
public function head($uri, $options = []);
* 'verify' => true, // bool or string to CA file
* 'debug' => true,
* @return IResponse
+ * @since 8.1.0
*/
public function post($uri, array $options = []);
* 'verify' => true, // bool or string to CA file
* 'debug' => true,
* @return IResponse
+ * @since 8.1.0
*/
public function put($uri, array $options = []);
* 'verify' => true, // bool or string to CA file
* 'debug' => true,
* @return IResponse
+ * @since 8.1.0
*/
public function delete($uri, array $options = []);
* 'verify' => true, // bool or string to CA file
* 'debug' => true,
* @return IResponse
+ * @since 8.1.0
*/
public function options($uri, array $options = []);
}
* Interface IClientService
*
* @package OCP\Http
+ * @since 8.1.0
*/
interface IClientService {
/**
* @return IClient
+ * @since 8.1.0
*/
public function newClient();
}
* Interface IResponse
*
* @package OCP\Http
+ * @since 8.1.0
*/
interface IResponse {
/**
* @return string
+ * @since 8.1.0
*/
public function getBody();
/**
* @return int
+ * @since 8.1.0
*/
public function getStatusCode();
/**
* @param $key
* @return string
+ * @since 8.1.0
*/
public function getHeader($key);
/**
* @return array
+ * @since 8.1.0
*/
public function getHeaders();
}
// 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
namespace OCP {
+ /**
+ * Interface IAddressBook
+ *
+ * @package OCP
+ * @since 5.0.0
+ */
interface IAddressBook {
/**
* @return string defining the technical unique key
+ * @since 5.0.0
*/
public function getKey();
/**
* In comparison to getKey() this function returns a human readable (maybe translated) name
* @return mixed
+ * @since 5.0.0
*/
public function getDisplayName();
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options - for future use. One should always have options!
* @return array an array of contacts which are arrays of key-value-pairs
+ * @since 5.0.0
*/
public function search($pattern, $searchProperties, $options);
// // dummy results
/**
* @param array $properties this array if key-value-pairs defines a contact
* @return array an array representing the contact just created or updated
+ * @since 5.0.0
*/
public function createOrUpdate($properties);
// // dummy
/**
* @return mixed
+ * @since 5.0.0
*/
public function getPermissions();
/**
* @param object $id the unique identifier to a contact
* @return bool successful or not
+ * @since 5.0.0
*/
public function delete($id);
}
/**
* This class provides an easy way for apps to store config values in the
* database.
+ * @since 7.0.0
*/
interface IAppConfig {
/**
* @param string $app
* @param string $key
* @return bool
+ * @since 7.0.0
*/
public function hasKey($app, $key);
*
* This function gets a value from the appconfig table. If the key does
* not exist the default value will be returned
+ * @since 7.0.0
*/
public function getValue($app, $key, $default = null);
* @param string $key key
* @return bool
* @deprecated use method deleteAppValue of \OCP\IConfig
+ * @since 7.0.0
*/
public function deleteKey($app, $key);
*
* This function gets all keys of an app. Please note that the values are
* not returned.
+ * @since 7.0.0
*/
public function getKeys($app);
* @param string|false $key
* @param string|false $app
* @return array|false
+ * @since 7.0.0
*/
public function getValues($app, $key);
*
* Sets a value. If the key did not exist before it will be created.
* @return void
+ * @since 7.0.0
*/
public function setValue($app, $key, $value);
*
* This function returns a list of all apps that have at least one
* entry in the appconfig table.
+ * @since 7.0.0
*/
public function getApps();
* @deprecated use method deleteAppValue of \OCP\IConfig
*
* Removes all keys in appconfig belonging to the app.
+ * @since 7.0.0
*/
public function deleteApp($app);
}
/**
* This class provides avatar functionality
+ * @since 6.0.0
*/
-
interface IAvatar {
/**
* get the users avatar
* @param int $size size in px of the avatar, avatars are square, defaults to 64
* @return boolean|\OCP\IImage containing the avatar or false if there's no image
+ * @since 6.0.0
*/
function get($size = 64);
* Check if an avatar exists for the user
*
* @return bool
+ * @since 8.1.0
*/
public function exists();
* @throws \Exception if the provided image is not valid
* @throws \OC\NotSquareException if the image is not square
* @return void
+ * @since 6.0.0
*/
function set($data);
/**
* remove the users avatar
* @return void
+ * @since 6.0.0
*/
function remove();
}
/**
* This class provides avatar functionality
+ * @since 6.0.0
*/
interface IAvatarManager {
* @see \OCP\IAvatar
* @param string $user the ownCloud user id
* @return \OCP\IAvatar
+ * @since 6.0.0
*/
function getAvatar($user);
}
/**
* This interface defines method for accessing the file based user cache.
+ * @since 6.0.0
*/
interface ICache {
* Get a value from the user cache
* @param string $key
* @return mixed
+ * @since 6.0.0
*/
public function get($key);
* @param mixed $value
* @param int $ttl Time To Live in seconds. Defaults to 60*60*24
* @return bool
+ * @since 6.0.0
*/
public function set($key, $value, $ttl = 0);
* Check if a value is set in the user cache
* @param string $key
* @return bool
+ * @since 6.0.0
*/
public function hasKey($key);
* Remove an item from the user cache
* @param string $key
* @return bool
+ * @since 6.0.0
*/
public function remove($key);
* Clear the user cache of all entries starting with a prefix
* @param string $prefix (optional)
* @return bool
+ * @since 6.0.0
*/
public function clear($prefix = '');
}
namespace OCP;
+/**
+ * Interface ICacheFactory
+ *
+ * @package OCP
+ * @since 7.0.0
+ */
interface ICacheFactory{
/**
* Get a memory cache instance
*
* @param string $prefix
* @return \OCP\ICache
+ * @since 7.0.0
*/
public function create($prefix = '');
* Check if any memory cache backend is available
*
* @return bool
+ * @since 7.0.0
*/
public function isAvailable();
}
namespace OCP;
+/**
+ * Interface ICertificate
+ *
+ * @package OCP
+ * @since 8.0.0
+ */
interface ICertificate {
/**
* @return string
+ * @since 8.0.0
*/
public function getName();
/**
* @return string
+ * @since 8.0.0
*/
public function getCommonName();
/**
* @return string
+ * @since 8.0.0
*/
public function getOrganization();
/**
* @return \DateTime
+ * @since 8.0.0
*/
public function getIssueDate();
/**
* @return \DateTime
+ * @since 8.0.0
*/
public function getExpireDate();
/**
* @return bool
+ * @since 8.0.0
*/
public function isExpired();
/**
* @return string
+ * @since 8.0.0
*/
public function getIssuerName();
/**
* @return string
+ * @since 8.0.0
*/
public function getIssuerOrganization();
}
/**
* Manage trusted certificates for users
+ * @since 8.0.0
*/
interface ICertificateManager {
/**
* Returns all certificates trusted by the user
*
* @return \OCP\ICertificate[]
+ * @since 8.0.0
*/
public function listCertificates();
* @param string $certificate the certificate data
* @param string $name the filename for the certificate
* @return bool | \OCP\ICertificate
+ * @since 8.0.0
*/
public function addCertificate($certificate, $name);
/**
* @param string $name
+ * @since 8.0.0
*/
public function removeCertificate($name);
* Get the path to the certificate bundle for this user
*
* @return string
+ * @since 8.0.0
*/
public function getCertificateBundle();
}
/**
* Access to all the configuration options ownCloud offers
+ * @since 6.0.0
*/
interface IConfig {
/**
*
* @param array $configs Associative array with `key => value` pairs
* If value is null, the config key will be deleted
+ * @since 8.0.0
*/
public function setSystemValues(array $configs);
*
* @param string $key the key of the value, under which will be saved
* @param mixed $value the value that should be stored
+ * @since 8.0.0
*/
public function setSystemValue($key, $value);
* @param string $key the key of the value, under which it was saved
* @param mixed $default the default value to be returned if the value isn't set
* @return mixed the value or $default
+ * @since 6.0.0 - parameter $default was added in 7.0.0
*/
public function getSystemValue($key, $default = '');
* Delete a system wide defined value
*
* @param string $key the key of the value, under which it was saved
+ * @since 8.0.0
*/
public function deleteSystemValue($key);
*
* @param string $appName the appName that we stored the value under
* @return string[] the keys stored for the app
+ * @since 8.0.0
*/
public function getAppKeys($appName);
* @param string $key the key of the value, under which will be saved
* @param string $value the value that should be stored
* @return void
+ * @since 6.0.0
*/
public function setAppValue($appName, $key, $value);
* @param string $key the key of the value, under which it was saved
* @param string $default the default value to be returned if the value isn't set
* @return string the saved value
+ * @since 6.0.0 - parameter $default was added in 7.0.0
*/
public function getAppValue($appName, $key, $default = '');
*
* @param string $appName the appName that we stored the value under
* @param string $key the key of the value, under which it was saved
+ * @since 8.0.0
*/
public function deleteAppValue($appName, $key);
* Removes all keys in appconfig belonging to the app
*
* @param string $appName the appName the configs are stored under
+ * @since 8.0.0
*/
public function deleteAppValues($appName);
* @param string $value the value that you want to store
* @param string $preCondition only update if the config value was previously the value passed as $preCondition
* @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met
+ * @since 6.0.0 - parameter $precondition was added in 8.0.0
*/
public function setUserValue($userId, $appName, $key, $value, $preCondition = null);
* @param string $key the key under which the value is being stored
* @param mixed $default the default value to be returned if the value isn't set
* @return string
+ * @since 6.0.0 - parameter $default was added in 7.0.0
*/
public function getUserValue($userId, $appName, $key, $default = '');
* @param string $key the key to get the value for
* @param array $userIds the user IDs to fetch the values for
* @return array Mapped values: userId => value
+ * @since 8.0.0
*/
public function getUserValueForUsers($appName, $key, $userIds);
* @param string $userId the userId of the user that we want to store the value under
* @param string $appName the appName that we stored the value under
* @return string[]
+ * @since 8.0.0
*/
public function getUserKeys($userId, $appName);
* @param string $userId the userId of the user that we want to store the value under
* @param string $appName the appName that we stored the value under
* @param string $key the key under which the value is being stored
+ * @since 8.0.0
*/
public function deleteUserValue($userId, $appName, $key);
* Delete all user values
*
* @param string $userId the userId of the user that we want to remove all values from
+ * @since 8.0.0
*/
public function deleteAllUserValues($userId);
* Delete all user related values of one app
*
* @param string $appName the appName of the app that we want to remove all values from
+ * @since 8.0.0
*/
public function deleteAppFromAllUsers($appName);
* @param string $key the key to get the user for
* @param string $value the value to get the user for
* @return array of user IDs
+ * @since 8.0.0
*/
public function getUsersForUserValue($appName, $key, $value);
}
* IContainer is the basic interface to be used for any internal dependency injection mechanism
*
* @package OCP
+ * @since 6.0.0
*/
interface IContainer {
*
* @param string $name
* @return mixed
+ * @since 6.0.0
*/
function query($name);
* @param string $name
* @param mixed $value
* @return void
+ * @since 6.0.0
*/
function registerParameter($name, $value);
* @param \Closure $closure
* @param bool $shared
* @return void
+ * @since 6.0.0
*/
function registerService($name, \Closure $closure, $shared = true);
}
namespace OCP;
+/**
+ * Interface IDateTimeFormatter
+ *
+ * @package OCP
+ * @since 8.0.0
+ */
interface IDateTimeFormatter {
/**
* Formats the date of the given timestamp
* @param \DateTimeZone $timeZone The timezone to use
* @param \OCP\IL10N $l The locale to use
* @return string Formatted date string
+ * @since 8.0.0
*/
public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
* @param \DateTimeZone $timeZone The timezone to use
* @param \OCP\IL10N $l The locale to use
* @return string Formatted relative date string
+ * @since 8.0.0
*/
public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
* >= 13 month => last year, n years ago
* @param \OCP\IL10N $l The locale to use
* @return string Formatted date span
+ * @since 8.0.0
*/
public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null);
* @param \DateTimeZone $timeZone The timezone to use
* @param \OCP\IL10N $l The locale to use
* @return string Formatted time string
+ * @since 8.0.0
*/
public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
* >= 13 month => last year, n years ago
* @param \OCP\IL10N $l The locale to use
* @return string Formatted time span
+ * @since 8.0.0
*/
public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null);
* @param \DateTimeZone $timeZone The timezone to use
* @param \OCP\IL10N $l The locale to use
* @return string Formatted date and time string
+ * @since 8.0.0
*/
public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
* @param \DateTimeZone $timeZone The timezone to use
* @param \OCP\IL10N $l The locale to use
* @return string Formatted relative date and time string
+ * @since 8.0.0
*/
public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
}
namespace OCP;
-
+/**
+ * Interface IDateTimeZone
+ *
+ * @package OCP
+ * @since 8.0.0
+ */
interface IDateTimeZone {
/**
* @param bool|int $timestamp
* @return \DateTimeZone
+ * @since 8.0.0 - parameter $timestamp was added in 8.1.0
*/
public function getTimeZone($timestamp = false);
}
/**
* Small Facade for being able to inject the database connection for tests
+ * @since 7.0.0 - extends IDBConnection was added in 8.1.0
*/
interface IDb extends IDBConnection {
* @param int $limit the maximum number of rows
* @param int $offset from which row we want to start
* @return \OC_DB_StatementWrapper prepared SQL query
+ * @since 7.0.0
*/
public function prepareQuery($sql, $limit=null, $offset=null);
* Used to get the id of the just inserted element
* @param string $tableName the name of the table where we inserted the item
* @return int the id of the inserted element
+ * @since 7.0.0
*/
public function getInsertId($tableName);
namespace OCP;
/**
- * TODO: Description
+ * Interface IDBConnection
+ *
+ * @package OCP
+ * @since 6.0.0
*/
interface IDBConnection {
/**
* @param int $limit the maximum number of rows
* @param int $offset from which row we want to start
* @return \Doctrine\DBAL\Driver\Statement The prepared statement.
+ * @since 6.0.0
*/
public function prepare($sql, $limit=null, $offset=null);
* @param string[] $params The parameters to bind to the query, if any.
* @param array $types The types the previous parameters are in.
* @return \Doctrine\DBAL\Driver\Statement The executed statement.
+ * @since 8.0.0
*/
public function executeQuery($query, array $params = array(), $types = array());
* @param array $params The query parameters.
* @param array $types The parameter types.
* @return integer The number of affected rows.
+ * @since 8.0.0
*/
public function executeUpdate($query, array $params = array(), array $types = array());
* Used to get the id of the just inserted element
* @param string $table the name of the table where we inserted the item
* @return int the id of the inserted element
+ * @since 6.0.0
*/
public function lastInsertId($table = null);
* Please note: text fields (clob) must not be used in the compare array
* @return int number of inserted rows
* @throws \Doctrine\DBAL\DBALException
+ * @since 6.0.0 - parameter $compare was added in 8.1.0, return type changed from boolean in 8.1.0
*/
public function insertIfNotExist($table, $input, array $compare = null);
/**
* Start a transaction
+ * @since 6.0.0
*/
public function beginTransaction();
/**
* Commit the database changes done during a transaction that is in progress
+ * @since 6.0.0
*/
public function commit();
/**
* Rollback the database changes done during a transaction that is in progress
+ * @since 6.0.0
*/
public function rollBack();
/**
* Gets the error code and message as a string for logging
* @return string
+ * @since 6.0.0
*/
public function getError();
* Fetch the SQLSTATE associated with the last database operation.
*
* @return integer The last error code.
+ * @since 8.0.0
*/
public function errorCode();
* Fetch extended error information associated with the last database operation.
*
* @return array The last error information.
+ * @since 8.0.0
*/
public function errorInfo();
* Establishes the connection with the database.
*
* @return bool
+ * @since 8.0.0
*/
public function connect();
/**
* Close the database connection
+ * @since 8.0.0
*/
public function close();
* @param mixed $input Parameter to be quoted.
* @param int $type Type of the parameter.
* @return string The quoted parameter.
+ * @since 8.0.0
*/
public function quote($input, $type = \PDO::PARAM_STR);
* the platform this driver connects to.
*
* @return \Doctrine\DBAL\Platforms\AbstractPlatform The database platform.
+ * @since 8.0.0
*/
public function getDatabasePlatform();
* Drop a table from the database if it exists
*
* @param string $table table name without the prefix
+ * @since 8.0.0
*/
public function dropTable($table);
*
* @param string $table table name without the prefix
* @return bool
+ * @since 8.0.0
*/
public function tableExists($table);
}
* use server side events with caution, to many open requests can hang the server
*
* The event source will initialize the connection to the client when the first data is sent
+ * @since 8.0.0
*/
interface IEventSource {
/**
* @param mixed $data
*
* if only one parameter is given, a typeless message will be send with that parameter as data
+ * @since 8.0.0
*/
public function send($type, $data = null);
/**
* close the connection of the event source
+ * @since 8.0.0
*/
public function close();
}
namespace OCP;
+/**
+ * Interface IGroup
+ *
+ * @package OCP
+ * @since 8.0.0
+ */
interface IGroup {
/**
* @return string
+ * @since 8.0.0
*/
public function getGID();
* get all users in the group
*
* @return \OCP\IUser[]
+ * @since 8.0.0
*/
public function getUsers();
*
* @param \OCP\IUser $user
* @return bool
+ * @since 8.0.0
*/
public function inGroup($user);
* add a user to the group
*
* @param \OCP\IUser $user
+ * @since 8.0.0
*/
public function addUser($user);
* remove a user from the group
*
* @param \OCP\IUser $user
+ * @since 8.0.0
*/
public function removeUser($user);
* @param int $limit
* @param int $offset
* @return \OCP\IUser[]
+ * @since 8.0.0
*/
public function searchUsers($search, $limit = null, $offset = null);
*
* @param string $search
* @return int|bool
+ * @since 8.0.0
*/
public function count($search = '');
* @param int $limit
* @param int $offset
* @return \OCP\IUser[]
+ * @since 8.0.0
*/
public function searchDisplayName($search, $limit = null, $offset = null);
* delete the group
*
* @return bool
+ * @since 8.0.0
*/
public function delete();
}
* - postCreate(\OC\Group\Group $group)
*
* @package OC\Group
+ * @since 8.0.0
*/
interface IGroupManager {
/**
* @param \OCP\UserInterface $backend
+ * @since 8.0.0
*/
public function addBackend($backend);
+ /**
+ * @since 8.0.0
+ */
public function clearBackends();
/**
* @param string $gid
* @return \OCP\IGroup
+ * @since 8.0.0
*/
public function get($gid);
/**
* @param string $gid
* @return bool
+ * @since 8.0.0
*/
public function groupExists($gid);
/**
* @param string $gid
* @return \OCP\IGroup
+ * @since 8.0.0
*/
public function createGroup($gid);
* @param int $limit
* @param int $offset
* @return \OCP\IGroup[]
+ * @since 8.0.0
*/
public function search($search, $limit = null, $offset = null);
/**
* @param \OCP\IUser $user
* @return \OCP\IGroup[]
+ * @since 8.0.0
*/
public function getUserGroups($user);
/**
* @param \OCP\IUser $user
* @return array with group names
+ * @since 8.0.0
*/
public function getUserGroupIds($user);
* @param int $limit
* @param int $offset
* @return array an array of display names (value) and user ids (key)
+ * @since 8.0.0
*/
public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0);
* Checks if a userId is in the admin group
* @param string $userId
* @return bool if admin
+ * @since 8.0.0
*/
public function isAdmin($userId);
* @param string $userId
* @param group $group
* @return bool if in group
+ * @since 8.0.0
*/
public function isInGroup($userId, $group);
}
/**
* Functions that don't have any specific interface to place
+ * @since 6.0.0
*/
interface IHelper {
/**
* installed
* @param string $url the url that should be fetched
* @return string the content of the webpage
+ * @since 6.0.0
*/
public function getUrlContent($url);
}
/**
* Class for basic image manipulation
+ * @since 8.1.0
*/
interface IImage {
/**
* Determine whether the object contains an image resource.
*
* @return bool
+ * @since 8.1.0
*/
public function valid();
* Returns the MIME type of the image or an empty string if no image is loaded.
*
* @return string
+ * @since 8.1.0
*/
public function mimeType();
* Returns the width of the image or -1 if no image is loaded.
*
* @return int
+ * @since 8.1.0
*/
public function width();
* Returns the height of the image or -1 if no image is loaded.
*
* @return int
+ * @since 8.1.0
*/
public function height();
* Returns the width when the image orientation is top-left.
*
* @return int
+ * @since 8.1.0
*/
public function widthTopLeft();
* Returns the height when the image orientation is top-left.
*
* @return int
+ * @since 8.1.0
*/
public function heightTopLeft();
*
* @param string $mimeType
* @return bool
+ * @since 8.1.0
*/
public function show($mimeType = null);
* @param string $filePath
* @param string $mimeType
* @return bool
+ * @since 8.1.0
*/
public function save($filePath = null, $mimeType = null);
/**
* @return resource Returns the image resource in any.
+ * @since 8.1.0
*/
public function resource();
/**
* @return string Returns the raw image data.
+ * @since 8.1.0
*/
public function data();
* Get the orientation based on EXIF data.
*
* @return int The orientation or -1 if no EXIF data is available.
+ * @since 8.1.0
*/
public function getOrientation();
* (I'm open for suggestions on better method name ;)
* Fixes orientation based on EXIF data.
*
- * @return bool.
+ * @return bool
+ * @since 8.1.0
*/
public function fixOrientation();
*
* @param integer $maxSize The maximum size of either the width or height.
* @return bool
+ * @since 8.1.0
*/
public function resize($maxSize);
* @param int $width
* @param int $height
* @return bool
+ * @since 8.1.0
*/
public function preciseResize($width, $height);
*
* @param int $size maximum size for the result (optional)
* @return bool for success or failure
+ * @since 8.1.0
*/
public function centerCrop($size = 0);
* @param int $w Width
* @param int $h Height
* @return bool for success or failure
+ * @since 8.1.0
*/
public function crop($x, $y, $w, $h);
* @param integer $maxWidth
* @param integer $maxHeight
* @return bool
+ * @since 8.1.0
*/
public function fitIn($maxWidth, $maxHeight);
}
namespace OCP;
/**
- * TODO: Description
+ * Interface IL10N
+ *
+ * @package OCP
+ * @since 6.0.0
*/
interface IL10N {
/**
*
* Returns the translation. If no translation is found, $text will be
* returned.
+ * @since 6.0.0
*/
public function t($text, $parameters = array());
*
* The correct plural is determined by the plural_forms-function
* provided by the po file.
+ * @since 6.0.0
*
*/
public function n($text_singular, $text_plural, $count, $parameters = array());
* - Creates a time
* - l10n-field: time
* - params: timestamp (int/string)
+ * @since 6.0.0
*/
public function l($type, $data);
* The code (en, de, ...) of the language that is used for this OC_L10N object
*
* @return string language
+ * @since 7.0.0
*/
public function getLanguageCode();
}
/**
* Interface ILogger
* @package OCP
+ * @since 7.0.0
*
* This logger interface follows the design guidelines of PSR-3
* https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#3-psrlogloggerinterface
* @param string $message
* @param array $context
* @return null
+ * @since 7.0.0
*/
function emergency($message, array $context = array());
* @param string $message
* @param array $context
* @return null
+ * @since 7.0.0
*/
function alert($message, array $context = array());
* @param string $message
* @param array $context
* @return null
+ * @since 7.0.0
*/
function critical($message, array $context = array());
* @param string $message
* @param array $context
* @return null
+ * @since 7.0.0
*/
function error($message, array $context = array());
* @param string $message
* @param array $context
* @return null
+ * @since 7.0.0
*/
function warning($message, array $context = array());
* @param string $message
* @param array $context
* @return null
+ * @since 7.0.0
*/
function notice($message, array $context = array());
* @param string $message
* @param array $context
* @return null
+ * @since 7.0.0
*/
function info($message, array $context = array());
* @param string $message
* @param array $context
* @return null
+ * @since 7.0.0
*/
function debug($message, array $context = array());
* @param string $message
* @param array $context
* @return mixed
+ * @since 7.0.0
*/
function log($level, $message, array $context = array());
}
/**
* This class provides functions to handle images
+ * @since 6.0.0
*/
class Image extends \OC_Image {
}
/**
* Manages the ownCloud navigation
+ * @since 6.0.0
*/
interface INavigationManager {
/**
* The use of a closure is preferred, because it will avoid
* loading the routing of your app, unless required.
* @return void
+ * @since 6.0.0
*/
public function add($entry);
* Sets the current navigation entry of the currently running app
* @param string $appId id of the app entry to activate (from added $entry)
* @return void
+ * @since 6.0.0
*/
public function setActiveEntry($appId);
}
/**
* This class provides functions to render and show thumbnails and previews of files
+ * @since 6.0.0
*/
interface IPreview {
/**
* @param string $mimeTypeRegex Regex with the mime types that are supported by this provider
* @param \Closure $callable
* @return void
+ * @since 8.1.0
*/
public function registerProvider($mimeTypeRegex, \Closure $callable);
/**
* Get all providers
* @return array
+ * @since 8.1.0
*/
public function getProviders();
/**
* Does the manager have any providers
* @return bool
+ * @since 8.1.0
*/
public function hasProviders();
* @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
* @param boolean $scaleUp Scale smaller images up to the thumbnail size or not. Might look ugly
* @return \OCP\IImage
+ * @since 6.0.0
*/
public function createPreview($file, $maxX = 100, $maxY = 75, $scaleUp = false);
* Returns true if the passed mime type is supported
* @param string $mimeType
* @return boolean
+ * @since 6.0.0
*/
public function isMimeSupported($mimeType = '*');
*
* @param \OCP\Files\FileInfo $file
* @return bool
+ * @since 8.0.0
*/
public function isAvailable(\OCP\Files\FileInfo $file);
}
*
* @property-read string[] $server
* @property-read string[] $urlParams
+ * @since 6.0.0
*/
interface IRequest {
* @param string $name
*
* @return string
+ * @since 6.0.0
*/
function getHeader($name);
* 3. GET parameters
* @param mixed $default If the key is not found, this value will be returned
* @return mixed the content of the array
+ * @since 6.0.0
*/
public function getParam($key, $default = null);
*
* (as GET or POST) or through the URL by the route
* @return array the array with all parameters
+ * @since 6.0.0
*/
public function getParams();
* Returns the method of the request
*
* @return string the method of the request (POST, GET, etc)
+ * @since 6.0.0
*/
public function getMethod();
*
* @param string $key the key that will be taken from the $_FILES array
* @return array the file in the $_FILES element
+ * @since 6.0.0
*/
public function getUploadedFile($key);
*
* @param string $key the key that will be taken from the $_ENV array
* @return array the value in the $_ENV element
+ * @since 6.0.0
*/
public function getEnv($key);
*
* @param string $key the key that will be taken from the $_COOKIE array
* @return array the value in the $_COOKIE element
+ * @since 6.0.0
*/
function getCookie($key);
/**
* Checks if the CSRF check was correct
* @return bool true if CSRF check passed
+ * @since 6.0.0
*/
public function passesCSRFCheck();
* Returns an ID for the request, value is not guaranteed to be unique and is mostly meant for logging
* If `mod_unique_id` is installed this value will be taken.
* @return string
+ * @since 8.1.0
*/
public function getId();
* specified in this header will be returned instead.
* Do always use this instead of $_SERVER['REMOTE_ADDR']
* @return string IP address
+ * @since 8.1.0
*/
public function getRemoteAddress();
* Returns the server protocol. It respects reverse proxy servers and load
* balancers.
* @return string Server protocol (http or https)
+ * @since 8.1.0
*/
public function getServerProtocol();
* Returns the request uri, even if the website uses one or more
* reverse proxies
* @return string
+ * @since 8.1.0
*/
public function getRequestUri();
* Get raw PathInfo from request (not urldecoded)
* @throws \Exception
* @return string Path info
+ * @since 8.1.0
*/
public function getRawPathInfo();
* Get PathInfo from request
* @throws \Exception
* @return string|false Path info or false when not found
+ * @since 8.1.0
*/
public function getPathInfo();
* Returns the script name, even if the website uses one or more
* reverse proxies
* @return string the script name
+ * @since 8.1.0
*/
public function getScriptName();
* Checks whether the user agent matches a given regex
* @param array $agent array of agent names
* @return bool true if at least one of the given agent matches, false otherwise
+ * @since 8.1.0
*/
public function isUserAgent(array $agent);
* Returns the unverified server host from the headers without checking
* whether it is a trusted domain
* @return string Server host
+ * @since 8.1.0
*/
public function getInsecureServerHost();
* Returns the server host from the headers, or the first configured
* trusted domain if the host isn't in the trusted list
* @return string Server host
+ * @since 8.1.0
*/
public function getServerHost();
}
/**
* Small Interface for Search
+ * @since 7.0.0
*/
interface ISearch {
* @param string[] $inApps optionally limit results to the given apps
* @return array An array of OCP\Search\Result's
* @deprecated use searchPaged() with page and size
+ * @since 7.0.0 - parameter $inApps was added in 8.0.0
*/
public function search($query, array $inApps = array());
* @param int $page pages start at page 1
* @param int $size
* @return array An array of OCP\Search\Result's
+ * @since 8.0.0
*/
public function searchPaged($query, array $inApps = array(), $page = 1, $size = 30);
* Register a new search provider to search with
* @param string $class class name of a OCP\Search\Provider
* @param array $options optional
+ * @since 7.0.0
*/
public function registerProvider($class, array $options = array());
/**
* Remove one existing search provider
* @param string $provider class name of a OCP\Search\Provider
+ * @since 7.0.0
*/
public function removeProvider($provider);
/**
* Remove all registered search providers
+ * @since 7.0.0
*/
public function clearProviders();
* @package OCP
*
* This container holds all ownCloud services
+ * @since 6.0.0
*/
interface IServerContainer {
* providers which actual deliver the contact information.
*
* @return \OCP\Contacts\IManager
+ * @since 6.0.0
*/
function getContactsManager();
* In case the current execution was not initiated by a web request null is returned
*
* @return \OCP\IRequest
+ * @since 6.0.0
*/
function getRequest();
* Returns the preview manager which can create preview images for a given file
*
* @return \OCP\IPreview
+ * @since 6.0.0
*/
function getPreviewManager();
*
* @see \OCP\ITagManager::load()
* @return \OCP\ITagManager
+ * @since 6.0.0
*/
function getTagManager();
* Returns the root folder of ownCloud's data directory
*
* @return \OCP\Files\Folder
+ * @since 6.0.0
*/
function getRootFolder();
*
* @param string $userId user ID
* @return \OCP\Files\Folder
+ * @since 6.0.0 - parameter $userId was added in 8.0.0
*/
function getUserFolder($userId = null);
* Returns an app-specific view in ownClouds data directory
*
* @return \OCP\Files\Folder
+ * @since 6.0.0
*/
function getAppFolder();
* Returns a user manager
*
* @return \OCP\IUserManager
+ * @since 8.0.0
*/
function getUserManager();
* Returns a group manager
*
* @return \OCP\IGroupManager
+ * @since 8.0.0
*/
function getGroupManager();
* Returns the user session
*
* @return \OCP\IUserSession
+ * @since 6.0.0
*/
function getUserSession();
* Returns the navigation manager
*
* @return \OCP\INavigationManager
+ * @since 6.0.0
*/
function getNavigationManager();
* Returns the config manager
*
* @return \OCP\IConfig
+ * @since 6.0.0
*/
function getConfig();
* Returns a Crypto instance
*
* @return \OCP\Security\ICrypto
+ * @since 8.0.0
*/
function getCrypto();
* Returns a Hasher instance
*
* @return \OCP\Security\IHasher
+ * @since 8.0.0
*/
function getHasher();
* Returns a SecureRandom instance
*
* @return \OCP\Security\ISecureRandom
+ * @since 8.1.0
*/
function getSecureRandom();
* Returns an instance of the db facade
* @deprecated use getDatabaseConnection, will be removed in ownCloud 10
* @return \OCP\IDb
+ * @since 7.0.0
*/
function getDb();
* Returns the app config manager
*
* @return \OCP\IAppConfig
+ * @since 7.0.0
*/
function getAppConfig();
* @param string $app appid
* @param string $lang
* @return \OCP\IL10N
+ * @since 6.0.0 - parameter $lang was added in 8.0.0
*/
function getL10N($app, $lang = null);
/**
* @return \OC\Encryption\Manager
+ * @since 8.1.0
*/
function getEncryptionManager();
/**
* @return \OC\Encryption\File
+ * @since 8.1.0
*/
function getEncryptionFilesHelper();
* @param string $encryptionModuleId encryption module ID
*
* @return \OCP\Encryption\Keys\IStorage
+ * @since 8.1.0
*/
function getEncryptionKeyStorage($encryptionModuleId);
* Returns the URL generator
*
* @return \OCP\IURLGenerator
+ * @since 6.0.0
*/
function getURLGenerator();
* Returns the Helper
*
* @return \OCP\IHelper
+ * @since 6.0.0
*/
function getHelper();
* Returns an ICache instance
*
* @return \OCP\ICache
+ * @since 6.0.0
*/
function getCache();
* Returns an \OCP\CacheFactory instance
*
* @return \OCP\ICacheFactory
+ * @since 7.0.0
*/
function getMemCacheFactory();
* Returns the current session
*
* @return \OCP\ISession
+ * @since 6.0.0
*/
function getSession();
* Returns the activity manager
*
* @return \OCP\Activity\IManager
+ * @since 6.0.0
*/
function getActivityManager();
* Returns the current session
*
* @return \OCP\IDBConnection
+ * @since 6.0.0
*/
function getDatabaseConnection();
* Returns an avatar manager, used for avatar functionality
*
* @return \OCP\IAvatarManager
+ * @since 6.0.0
*/
function getAvatarManager();
* Returns an job list for controlling background jobs
*
* @return \OCP\BackgroundJob\IJobList
+ * @since 7.0.0
*/
function getJobList();
* Returns a logger instance
*
* @return \OCP\ILogger
+ * @since 8.0.0
*/
function getLogger();
* Returns a router for generating and matching urls
*
* @return \OCP\Route\IRouter
+ * @since 7.0.0
*/
function getRouter();
* Returns a search instance
*
* @return \OCP\ISearch
+ * @since 7.0.0
*/
function getSearch();
*
* @param \OCP\IUser $user (optional) if not specified the current loggedin user is used
* @return \OCP\ICertificateManager
+ * @since 8.0.0
*/
function getCertificateManager($user = null);
* Create a new event source
*
* @return \OCP\IEventSource
+ * @since 8.0.0
*/
function createEventSource();
* Returns an instance of the HTTP helper class
* @return \OC\HTTPHelper
* @deprecated Use \OCP\Http\Client\IClientService
+ * @since 8.0.0
*/
function getHTTPHelper();
* Returns an instance of the HTTP client service
*
* @return \OCP\Http\Client\IClientService
+ * @since 8.1.0
*/
function getHTTPClientService();
* Get the active event logger
*
* @return \OCP\Diagnostics\IEventLogger
+ * @since 8.0.0
*/
function getEventLogger();
* The returned logger only logs data when debug mode is enabled
*
* @return \OCP\Diagnostics\IQueryLogger
+ * @since 8.0.0
*/
function getQueryLogger();
* Get the manager for temporary files and folders
*
* @return \OCP\ITempManager
+ * @since 8.0.0
*/
function getTempManager();
* Get the app manager
*
* @return \OCP\App\IAppManager
+ * @since 8.0.0
*/
function getAppManager();
* Get the webroot
*
* @return string
+ * @since 8.0.0
*/
function getWebRoot();
/**
* @return \OCP\Files\Config\IMountProviderCollection
+ * @since 8.0.0
*/
function getMountProviderCollection();
* Get the IniWrapper
*
* @return \bantu\IniGetWrapper\IniGetWrapper
+ * @since 8.0.0
*/
function getIniWrapper();
/**
* @return \OCP\Command\IBus
+ * @since 8.1.0
*/
function getCommandBus();
* Creates a new mailer
*
* @return \OCP\Mail\IMailer
+ * @since 8.1.0
*/
function getMailer();
}
* Interface ISession
*
* wrap PHP's internal session handling into the ISession interface
+ * @since 6.0.0
*/
interface ISession {
*
* @param string $key
* @param mixed $value
+ * @since 6.0.0
*/
public function set($key, $value);
*
* @param string $key
* @return mixed should return null if $key does not exist
+ * @since 6.0.0
*/
public function get($key);
*
* @param string $key
* @return bool
+ * @since 6.0.0
*/
public function exists($key);
* Remove a $key/$value pair from the session
*
* @param string $key
+ * @since 6.0.0
*/
public function remove($key);
/**
* Reset and recreate the session
+ * @since 6.0.0
*/
public function clear();
/**
* Close the session and release the lock
+ * @since 7.0.0
*/
public function close();
* Tag names are not case-sensitive, but will be saved with the case they
* are entered in. If a user already has a tag 'family' for a type, and
* tries to add a tag named 'Family' it will be silently ignored.
+ * @since 6.0.0
*/
interface ITagManager {
/**
- * Create a new \OCP\ITags instance and load tags from db for the current user.
- *
- * @see \OCP\ITags
- * @param string $type The type identifier e.g. 'contact' or 'event'.
- * @param array $defaultTags An array of default tags to be used if none are stored.
- * @param boolean $includeShared Whether to include tags for items shared with this user by others.
- * @param string $userId user for which to retrieve the tags, defaults to the currently
- * logged in user
- * @return \OCP\ITags
+ * Create a new \OCP\ITags instance and load tags from db for the current user.
+ *
+ * @see \OCP\ITags
+ * @param string $type The type identifier e.g. 'contact' or 'event'.
+ * @param array $defaultTags An array of default tags to be used if none are stored.
+ * @param boolean $includeShared Whether to include tags for items shared with this user by others.
+ * @param string $userId user for which to retrieve the tags, defaults to the currently
+ * logged in user
+ * @return \OCP\ITags
+ * @since 6.0.0 - parameter $includeShared and $userId were added in 8.0.0
*/
public function load($type, $defaultTags = array(), $includeShared = false, $userId = null);
}
* Tag names are not case-sensitive, but will be saved with the case they
* are entered in. If a user already has a tag 'family' for a type, and
* tries to add a tag named 'Family' it will be silently ignored.
+ * @since 6.0.0
*/
interface ITags {
/**
- * Check if any tags are saved for this type and user.
- *
- * @return boolean
- */
+ * Check if any tags are saved for this type and user.
+ *
+ * @return boolean
+ * @since 6.0.0
+ */
public function isEmpty();
/**
- * Returns an array mapping a given tag's properties to its values:
- * ['id' => 0, 'name' = 'Tag', 'owner' = 'User', 'type' => 'tagtype']
- *
- * @param string $id The ID of the tag that is going to be mapped
- * @return array|false
- */
+ * Returns an array mapping a given tag's properties to its values:
+ * ['id' => 0, 'name' = 'Tag', 'owner' = 'User', 'type' => 'tagtype']
+ *
+ * @param string $id The ID of the tag that is going to be mapped
+ * @return array|false
+ * @since 8.0.0
+ */
public function getTag($id);
/**
- * Get the tags for a specific user.
- *
- * This returns an array with id/name maps:
- * [
- * ['id' => 0, 'name' = 'First tag'],
- * ['id' => 1, 'name' = 'Second tag'],
- * ]
- *
- * @return array
- */
+ * Get the tags for a specific user.
+ *
+ * This returns an array with id/name maps:
+ * [
+ * ['id' => 0, 'name' = 'First tag'],
+ * ['id' => 1, 'name' = 'Second tag'],
+ * ]
+ *
+ * @return array
+ * @since 6.0.0
+ */
public function getTags();
/**
* @param array $objIds item ids
* @return array|boolean with object id as key and an array
* of tag names as value or false if an error occurred
+ * @since 8.0.0
*/
public function getTagsForObjects(array $objIds);
/**
- * Get a list of items tagged with $tag.
- *
- * Throws an exception if the tag could not be found.
- *
- * @param string|integer $tag Tag id or name.
- * @return array|false An array of object ids or false on error.
- */
+ * Get a list of items tagged with $tag.
+ *
+ * Throws an exception if the tag could not be found.
+ *
+ * @param string|integer $tag Tag id or name.
+ * @return array|false An array of object ids or false on error.
+ * @since 6.0.0
+ */
public function getIdsForTag($tag);
/**
- * Checks whether a tag is already saved.
- *
- * @param string $name The name to check for.
- * @return bool
- */
+ * Checks whether a tag is already saved.
+ *
+ * @param string $name The name to check for.
+ * @return bool
+ * @since 6.0.0
+ */
public function hasTag($name);
/**
- * Checks whether a tag is saved for the given user,
- * disregarding the ones shared with him or her.
- *
- * @param string $name The tag name to check for.
- * @param string $user The user whose tags are to be checked.
- * @return bool
- */
+ * Checks whether a tag is saved for the given user,
+ * disregarding the ones shared with him or her.
+ *
+ * @param string $name The tag name to check for.
+ * @param string $user The user whose tags are to be checked.
+ * @return bool
+ * @since 8.0.0
+ */
public function userHasTag($name, $user);
/**
- * Add a new tag.
- *
- * @param string $name A string with a name of the tag
- * @return int|false the id of the added tag or false if it already exists.
- */
+ * Add a new tag.
+ *
+ * @param string $name A string with a name of the tag
+ * @return int|false the id of the added tag or false if it already exists.
+ * @since 6.0.0
+ */
public function add($name);
/**
- * Rename tag.
- *
- * @param string|integer $from The name or ID of the existing tag
- * @param string $to The new name of the tag.
- * @return bool
- */
+ * Rename tag.
+ *
+ * @param string|integer $from The name or ID of the existing tag
+ * @param string $to The new name of the tag.
+ * @return bool
+ * @since 6.0.0
+ */
public function rename($from, $to);
/**
- * Add a list of new tags.
- *
- * @param string[] $names A string with a name or an array of strings containing
- * the name(s) of the to add.
- * @param bool $sync When true, save the tags
- * @param int|null $id int Optional object id to add to this|these tag(s)
- * @return bool Returns false on error.
- */
+ * Add a list of new tags.
+ *
+ * @param string[] $names A string with a name or an array of strings containing
+ * the name(s) of the to add.
+ * @param bool $sync When true, save the tags
+ * @param int|null $id int Optional object id to add to this|these tag(s)
+ * @return bool Returns false on error.
+ * @since 6.0.0
+ */
public function addMultiple($names, $sync=false, $id = null);
/**
- * Delete tag/object relations from the db
- *
- * @param array $ids The ids of the objects
- * @return boolean Returns false on error.
- */
+ * Delete tag/object relations from the db
+ *
+ * @param array $ids The ids of the objects
+ * @return boolean Returns false on error.
+ * @since 6.0.0
+ */
public function purgeObjects(array $ids);
/**
- * Get favorites for an object type
- *
- * @return array|false An array of object ids.
- */
+ * Get favorites for an object type
+ *
+ * @return array|false An array of object ids.
+ * @since 6.0.0
+ */
public function getFavorites();
/**
- * Add an object to favorites
- *
- * @param int $objid The id of the object
- * @return boolean
- */
+ * Add an object to favorites
+ *
+ * @param int $objid The id of the object
+ * @return boolean
+ * @since 6.0.0
+ */
public function addToFavorites($objid);
/**
- * Remove an object from favorites
- *
- * @param int $objid The id of the object
- * @return boolean
- */
+ * Remove an object from favorites
+ *
+ * @param int $objid The id of the object
+ * @return boolean
+ * @since 6.0.0
+ */
public function removeFromFavorites($objid);
/**
- * Creates a tag/object relation.
- *
- * @param int $objid The id of the object
- * @param string $tag The id or name of the tag
- * @return boolean Returns false on database error.
- */
+ * Creates a tag/object relation.
+ *
+ * @param int $objid The id of the object
+ * @param string $tag The id or name of the tag
+ * @return boolean Returns false on database error.
+ * @since 6.0.0
+ */
public function tagAs($objid, $tag);
/**
- * Delete single tag/object relation from the db
- *
- * @param int $objid The id of the object
- * @param string $tag The id or name of the tag
- * @return boolean
- */
+ * Delete single tag/object relation from the db
+ *
+ * @param int $objid The id of the object
+ * @param string $tag The id or name of the tag
+ * @return boolean
+ * @since 6.0.0
+ */
public function unTag($objid, $tag);
/**
- * Delete tags from the database
- *
- * @param string[]|integer[] $names An array of tags (names or IDs) to delete
- * @return bool Returns false on error
- */
+ * Delete tags from the database
+ *
+ * @param string[]|integer[] $names An array of tags (names or IDs) to delete
+ * @return bool Returns false on error
+ * @since 6.0.0
+ */
public function delete($names);
}
namespace OCP;
+/**
+ * Interface ITempManager
+ *
+ * @package OCP
+ * @since 8.0.0
+ */
interface ITempManager {
/**
* Create a temporary file and return the path
*
* @param string $postFix
* @return string
+ * @since 8.0.0
*/
public function getTemporaryFile($postFix = '');
*
* @param string $postFix
* @return string
+ * @since 8.0.0
*/
public function getTemporaryFolder($postFix = '');
/**
* Remove the temporary files and folders generated during this request
+ * @since 8.0.0
*/
public function clean();
/**
* Remove old temporary files and folders that were failed to be cleaned
+ * @since 8.0.0
*/
public function cleanOld();
}
/**
* Class to generate URLs
+ * @since 6.0.0
*/
interface IURLGenerator {
/**
* @param string $routeName the name of the route
* @param array $arguments an array with arguments which will be filled into the url
* @return string the url
+ * @since 6.0.0
*/
public function linkToRoute($routeName, $arguments = array());
* @param string $routeName the name of the route
* @param array $arguments an array with arguments which will be filled into the url
* @return string the absolute url
+ * @since 8.0.0
*/
public function linkToRouteAbsolute($routeName, $arguments = array());
* @param string $appName the name of the app
* @param string $file the name of the file
* @return string the url
+ * @since 6.0.0
*/
public function linkTo($appName, $file);
* @param string $appName the name of the app
* @param string $file the name of the file
* @return string the url
+ * @since 6.0.0
*/
public function imagePath($appName, $file);
* Makes an URL absolute
* @param string $url the url in the ownCloud host
* @return string the absolute version of the url
+ * @since 6.0.0
*/
public function getAbsoluteURL($url);
/**
* @param string $key
* @return string url to the online documentation
+ * @since 8.0.0
*/
public function linkToDocs($key);
}
namespace OCP;
+/**
+ * Interface IUser
+ *
+ * @package OCP
+ * @since 8.0.0
+ */
interface IUser {
/**
* get the user id
*
* @return string
+ * @since 8.0.0
*/
public function getUID();
* get the display name for the user, if no specific display name is set it will fallback to the user id
*
* @return string
+ * @since 8.0.0
*/
public function getDisplayName();
*
* @param string $displayName
* @return bool
+ * @since 8.0.0
*/
public function setDisplayName($displayName);
* login
*
* @return int
+ * @since 8.0.0
*/
public function getLastLogin();
/**
* updates the timestamp of the most recent login of this user
+ * @since 8.0.0
*/
public function updateLastLoginTimestamp();
* Delete the user
*
* @return bool
+ * @since 8.0.0
*/
public function delete();
* @param string $password
* @param string $recoveryPassword for the encryption app to reset encryption keys
* @return bool
+ * @since 8.0.0
*/
public function setPassword($password, $recoveryPassword = null);
* Get the name of the backend class the user is connected with
*
* @return string
+ * @since 8.0.0
*/
public function getBackendClassName();
* check if the backend allows the user to change his avatar on Personal page
*
* @return bool
+ * @since 8.0.0
*/
public function canChangeAvatar();
* check if the backend supports changing display names
*
* @return bool
+ * @since 8.0.0
*/
public function canChangeDisplayName();
* check if the user is enabled
*
* @return bool
+ * @since 8.0.0
*/
public function isEnabled();
* set the enabled status for the user
*
* @param bool $enabled
+ * @since 8.0.0
*/
public function setEnabled($enabled);
}
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
+/**
+ * Interface IUserBackend
+ *
+ * @package OCP
+ * @since 8.0.0
+ */
interface IUserBackend {
/**
* Backend name to be shown in user management
* @return string the name of the backend to be shown
+ * @since 8.0.0
*/
public function getBackendName();
* - postCreateUser(\OC\User\User $user, string $password)
*
* @package OC\User
+ * @since 8.0.0
*/
interface IUserManager {
/**
* register a user backend
*
* @param \OCP\UserInterface $backend
+ * @since 8.0.0
*/
public function registerBackend($backend);
/**
* Get the active backends
* @return \OCP\UserInterface[]
+ * @since 8.0.0
*/
public function getBackends();
* remove a user backend
*
* @param \OCP\UserInterface $backend
+ * @since 8.0.0
*/
public function removeBackend($backend);
*
* @param string $uid
* @return \OCP\IUser|null Either the user or null if the specified user does not exist
+ * @since 8.0.0
*/
public function get($uid);
*
* @param string $uid
* @return bool
+ * @since 8.0.0
*/
public function userExists($uid);
* @param string $loginname
* @param string $password
* @return mixed the User object on success, false otherwise
+ * @since 8.0.0
*/
public function checkPassword($loginname, $password);
* @param int $limit
* @param int $offset
* @return \OCP\IUser[]
+ * @since 8.0.0
*/
public function search($pattern, $limit = null, $offset = null);
* @param int $limit
* @param int $offset
* @return \OCP\IUser[]
+ * @since 8.0.0
*/
public function searchDisplayName($pattern, $limit = null, $offset = null);
* @param string $password
* @throws \Exception
* @return bool|\OCP\IUser the created user of false
+ * @since 8.0.0
*/
public function createUser($uid, $password);
* returns how many users per backend exist (if supported by backend)
*
* @return array an array of backend class as key and count number as value
+ * @since 8.0.0
*/
public function countUsers();
}
/**
* User session
+ * @since 6.0.0
*/
interface IUserSession {
/**
* @param string $user the username
* @param string $password the password
* @return bool true if successful
+ * @since 6.0.0
*/
public function login($user, $password);
* Logs the user out including all the session data
* Logout, destroys session
* @return void
+ * @since 6.0.0
*/
public function logout();
* set the currently active user
*
* @param \OCP\IUser|null $user
+ * @since 8.0.0
*/
public function setUser($user);
* get the current active user
*
* @return \OCP\IUser|null Current user, otherwise null
+ * @since 8.0.0
*/
public function getUser();
* Checks whether the user is logged in
*
* @return bool if logged in
+ * @since 8.0.0
*/
public function isLoggedIn();
}
* This message can then be passed to send() of \OC\Mail\Mailer
*
* @package OCP\Mail
+ * @since 8.1.0
*/
interface IMailer {
/**
* Creates a new message object that can be passed to send()
*
* @return Message
+ * @since 8.1.0
*/
public function createMessage();
* therefore should be considered
* @throws \Exception In case it was not possible to send the message. (for example if an invalid mail address
* has been supplied.)
+ * @since 8.1.0
*/
public function send(Message $message);
*
* @param string $email Email address to be validated
* @return bool True if the mail address is valid, false otherwise
+ * @since 8.1.0
*/
public function validateMailAddress($email);
}
/**
* Exception if the precondition of the config update method isn't met
+ * @since 8.0.0
*/
class PreConditionNotMetException extends \Exception {}
*/
namespace OCP\Preview;
+/**
+ * Interface IProvider
+ *
+ * @package OCP\Preview
+ * @since 8.1.0
+ */
interface IProvider {
/**
* @return string Regex with the mimetypes that are supported by this provider
+ * @since 8.1.0
*/
public function getMimeType();
*
* @param \OCP\Files\FileInfo $file
* @return bool
+ * @since 8.1.0
*/
public function isAvailable(\OCP\Files\FileInfo $file);
* @param bool $scalingup Disable/Enable upscaling of previews
* @param \OC\Files\View $fileview fileview object of user folder
* @return bool|\OCP\IImage false if no preview was generated
+ * @since 8.1.0
*/
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview);
}
/**
* This class provides convenient functions to send the correct http response headers
+ * @since 4.0.0
*/
class Response {
/**
* >0 cache time in seconds
* 0 and <0 enable default browser caching
* null cache indefinitly
+ * @since 4.0.0
*/
static public function enableCaching( $cache_time = null ) {
\OC_Response::enableCaching( $cache_time );
* Checks and set Last-Modified header, when the request matches sends a
* 'not modified' response
* @param string $lastModified time when the reponse was last modified
+ * @since 4.0.0
*/
static public function setLastModifiedHeader( $lastModified ) {
\OC_Response::setLastModifiedHeader( $lastModified );
* Sets the content disposition header (with possible workarounds)
* @param string $filename file name
* @param string $type disposition type, either 'attachment' or 'inline'
+ * @since 7.0.0
*/
static public function setContentDispositionHeader( $filename, $type = 'attachment' ) {
\OC_Response::setContentDispositionHeader( $filename, $type );
/**
* Sets the content length header (with possible workarounds)
* @param string|int|float $length Length to be sent
+ * @since 8.1.0
*/
static public function setContentLengthHeader($length) {
\OC_Response::setContentLengthHeader($length);
/**
* Disable browser caching
* @see enableCaching with cache_time = 0
+ * @since 4.0.0
*/
static public function disableCaching() {
\OC_Response::disableCaching();
* Checks and set ETag header, when the request matches sends a
* 'not modified' response
* @param string $etag token to use for modification check
+ * @since 4.0.0
*/
static public function setETagHeader( $etag ) {
\OC_Response::setETagHeader( $etag );
/**
* Send file as response, checking and setting caching headers
* @param string $filepath of file to send
+ * @since 4.0.0
*/
static public function sendFile( $filepath ) {
\OC_Response::sendFile( $filepath );
* @param string|\DateTime $expires date-time when the response expires
* string for DateInterval from now
* DateTime object when to expire response
+ * @since 4.0.0
*/
static public function setExpiresHeader( $expires ) {
\OC_Response::setExpiresHeader( $expires );
/**
* Send redirect response
* @param string $location to redirect to
+ * @since 4.0.0
*/
static public function redirect( $location ) {
\OC_Response::redirect( $location );
*/
namespace OCP\Route;
+/**
+ * Interface IRoute
+ *
+ * @package OCP\Route
+ * @since 7.0.0
+ */
interface IRoute {
/**
* Specify PATCH as the method to use with this route
* @return \OCP\Route\IRoute
+ * @since 7.0.0
*/
public function patch();
*
* @param string $method HTTP method (uppercase)
* @return \OCP\Route\IRoute
+ * @since 7.0.0
*/
public function method($method);
*
* @param string $file
* @return void
+ * @since 7.0.0
*/
public function actionInclude($file);
/**
* Specify GET as the method to use with this route
* @return \OCP\Route\IRoute
+ * @since 7.0.0
*/
public function get();
/**
* Specify POST as the method to use with this route
* @return \OCP\Route\IRoute
+ * @since 7.0.0
*/
public function post();
/**
* Specify DELETE as the method to use with this route
* @return \OCP\Route\IRoute
+ * @since 7.0.0
*/
public function delete();
*
* This function is called with $class set to a callable or
* to the class with $function
+ * @since 7.0.0
*/
public function action($class, $function = null);
*
* @param array $defaults The defaults
* @return \OCP\Route\IRoute
+ * @since 7.0.0
*/
public function defaults($defaults);
*
* @param array $requirements The requirements
* @return \OCP\Route\IRoute
+ * @since 7.0.0
*/
public function requirements($requirements);
/**
* Specify PUT as the method to use with this route
* @return \OCP\Route\IRoute
+ * @since 7.0.0
*/
public function put();
}
namespace OCP\Route;
+/**
+ * Interface IRouter
+ *
+ * @package OCP\Route
+ * @since 7.0.0
+ */
interface IRouter {
/**
* Get the files to load the routes from
*
* @return string[]
+ * @since 7.0.0
*/
public function getRoutingFiles();
/**
* @return string
+ * @since 7.0.0
*/
public function getCacheKey();
/**
* loads the api routes
* @return void
+ * @since 7.0.0
*/
public function loadRoutes($app = null);
*
* @param string $name Name of the collection to use.
* @return void
+ * @since 7.0.0
*/
public function useCollection($name);
* returns the current collection name in use for adding routes
*
* @return string the collection name
+ * @since 8.0.0
*/
public function getCurrentCollection();
* @param array $defaults An array of default parameter values
* @param array $requirements An array of requirements for parameters (regexes)
* @return \OCP\Route\IRoute
+ * @since 7.0.0
*/
public function create($name, $pattern, array $defaults = array(), array $requirements = array());
* @param string $url The url to find
* @throws \Exception
* @return void
+ * @since 7.0.0
*/
public function match($url);
/**
* Get the url generator
*
+ * @since 7.0.0
*/
public function getGenerator();
* @param array $parameters Parameters for the route
* @param bool $absolute
* @return string
+ * @since 7.0.0
*/
public function generate($name, $parameters = array(), $absolute = false);
namespace OCP\Search;
/**
- * Provides a template for search functionality throughout ownCloud;
+ * Provides a template for search functionality throughout ownCloud;
+ * @since 8.0.0
*/
abstract class PagedProvider extends Provider {
/**
* show all results
+ * @since 8.0.0
*/
const SIZE_ALL = 0;
/**
* Constructor
* @param array $options
+ * @since 8.0.0
*/
public function __construct($options) {
$this->options = $options;
* Search for $query
* @param string $query
* @return array An array of OCP\Search\Result's
+ * @since 8.0.0
*/
public function search($query) {
// old apps might assume they get all results, so we use SIZE_ALL
* @param int $page pages start at page 1
* @param int $size, 0 = SIZE_ALL
* @return array An array of OCP\Search\Result's
+ * @since 8.0.0
*/
abstract public function searchPaged($query, $page, $size);
}
namespace OCP\Search;
/**
- * Provides a template for search functionality throughout ownCloud;
+ * Provides a template for search functionality throughout ownCloud;
+ * @since 7.0.0
*/
abstract class Provider {
+ /**
+ * @since 8.0.0
+ */
const OPTION_APPS = 'apps';
/**
* List of options
* @var array
+ * @since 7.0.0
*/
protected $options;
/**
* Constructor
* @param array $options as key => value
+ * @since 7.0.0 - default value for $options was added in 8.0.0
*/
public function __construct($options = array()) {
$this->options = $options;
* get a value from the options array or null
* @param string $key
* @return mixed
+ * @since 8.0.0
*/
public function getOption($key) {
if (is_array($this->options) && isset($this->options[$key])) {
* or if the two above arrays have elements in common (intersect)
* @param string[] $apps
* @return bool
+ * @since 8.0.0
*/
public function providesResultsFor(array $apps = array()) {
$forApps = $this->getOption(self::OPTION_APPS);
* Search for $query
* @param string $query
* @return array An array of OCP\Search\Result's
+ * @since 7.0.0
*/
abstract public function search($query);
}
/**
* The generic result of a search
+ * @since 7.0.0
*/
class Result {
* A unique identifier for the result, usually given as the item ID in its
* corresponding application.
* @var string
+ * @since 7.0.0
*/
public $id;
* The name of the item returned; this will be displayed in the search
* results.
* @var string
+ * @since 7.0.0
*/
public $name;
/**
* URL to the application item.
* @var string
+ * @since 7.0.0
*/
public $link;
* The type of search result returned; for consistency, name this the same
* as the class name (e.g. \OC\Search\File -> 'file') in lowercase.
* @var string
+ * @since 7.0.0
*/
public $type = 'generic';
* @param string $id unique identifier from application: '[app_name]/[item_identifier_in_app]'
* @param string $name displayed text of result
* @param string $link URL to the result within its app
+ * @since 7.0.0
*/
public function __construct($id = null, $name = null, $link = null) {
$this->id = $id;
* $encryptWithCustomPassword = \OC::$server->getCrypto()->encrypt('EncryptedText', 'password');
*
* @package OCP\Security
+ * @since 8.0.0
*/
interface ICrypto {
* @param string $message The message to authenticate
* @param string $password Password to use (defaults to `secret` in config.php)
* @return string Calculated HMAC
+ * @since 8.0.0
*/
public function calculateHMAC($message, $password = '');
* @param string $plaintext
* @param string $password Password to encrypt, if not specified the secret from config.php will be taken
* @return string Authenticated ciphertext
+ * @since 8.0.0
*/
public function encrypt($plaintext, $password = '');
* @param string $password Password to encrypt, if not specified the secret from config.php will be taken
* @return string plaintext
* @throws \Exception If the HMAC does not match
+ * @since 8.0.0
*/
public function decrypt($authenticatedCiphertext, $password = '');
}
* var_dump($newHash);
*
* @package OCP\Security
+ * @since 8.0.0
*/
interface IHasher {
/**
*
* @param string $message Message to generate hash from
* @return string Hash of the message with appended version parameter
+ * @since 8.0.0
*/
public function hash($message);
* @param string $hash Assumed hash of the message
* @param null|string &$newHash Reference will contain the updated hash if necessary. Update the existing hash with this one.
* @return bool Whether $hash is a valid hash of $message
+ * @since 8.0.0
*/
public function verify($message, $hash, &$newHash = null);
}
* $randomString = $rng->getMediumStrengthGenerator()->generateString(30);
*
* @package OCP\Security
+ * @since 8.0.0
*/
interface ISecureRandom {
* used as keys or salts. They are however useful for one-time use tokens.
*
* @return $this
+ * @since 8.0.0
*/
public function getLowStrengthGenerator();
* take some time and resources to generate, so they should not be over-used
*
* @return $this
+ * @since 8.0.0
*/
public function getMediumStrengthGenerator();
* specified all valid base64 characters are used.
* @return string
* @throws \Exception If the generator is not initialized.
+ * @since 8.0.0
*/
public function generate($length, $characters = '');
}
namespace OCP\Security;
+/**
+ * Class StringUtils
+ *
+ * @package OCP\Security
+ * @since 8.0.0
+ */
class StringUtils {
/**
* Compares whether two strings are equal. To prevent guessing of the string
* @param string $expected The expected value
* @param string $input The input to compare against
* @return bool True if the two strings are equal, otherwise false.
+ * @since 8.0.0
*/
public static function equals($expected, $input) {
return \OC\Security\StringUtils::equals($expected, $input);
*
* It provides the following hooks:
* - post_shared
+ * @since 5.0.0
*/
class Share extends \OC\Share\Constants {
* @param string $collectionOf (optional) Depends on item type
* @param array $supportedFileExtensions (optional) List of supported file extensions if this item type depends on files
* @return boolean true if backend is registered or false if error
+ * @since 5.0.0
*/
public static function registerBackend($itemType, $class, $collectionOf = null, $supportedFileExtensions = null) {
return \OC\Share\Share::registerBackend($itemType, $class, $collectionOf, $supportedFileExtensions);
* @return boolean true if enabled or false
*
* The Share API is enabled by default if not configured
+ * @since 5.0.0
*/
public static function isEnabled() {
return \OC\Share\Share::isEnabled();
* @return array
* @note $path needs to be relative to user data dir, e.g. 'file.txt'
* not '/admin/data/file.txt'
+ * @since 5.0.0
*/
public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false) {
return \OC\Share\Share::getUsersSharingFile($path, $ownerUser, $includeOwner, $returnUserPaths);
* @param int $limit Number of items to return (optional) Returns all by default
* @param bool $includeCollections (optional)
* @return mixed Return depends on format
+ * @since 5.0.0
*/
public static function getItemsSharedWith($itemType, $format = self::FORMAT_NONE,
$parameters = null, $limit = -1, $includeCollections = false) {
* @param int $limit Number of items to return (optional) Returns all by default
* @param bool $includeCollections (optional)
* @return mixed Return depends on format
+ * @since 7.0.0
*/
public static function getItemsSharedWithUser($itemType, $user, $format = self::FORMAT_NONE,
$parameters = null, $limit = -1, $includeCollections = false) {
* @param mixed $parameters (optional)
* @param bool $includeCollections (optional)
* @return mixed Return depends on format
+ * @since 5.0.0
*/
public static function getItemSharedWith($itemType, $itemTarget, $format = self::FORMAT_NONE,
$parameters = null, $includeCollections = false) {
* @param string $user User to whom the item was shared
* @param string $owner Owner of the share
* @return array Return list of items with file_target, permissions and expiration
+ * @since 6.0.0 - parameter $owner was added in 8.0.0
*/
public static function getItemSharedWithUser($itemType, $itemSource, $user, $owner = null) {
return \OC\Share\Share::getItemSharedWithUser($itemType, $itemSource, $user, $owner);
* @param mixed $parameters
* @param bool $includeCollections
* @return array
+ * @since 5.0.0
*/
public static function getItemSharedWithBySource($itemType, $itemSource, $format = self::FORMAT_NONE,
$parameters = null, $includeCollections = false) {
* @param string $itemSource
* @param string $uidOwner Owner of link
* @return Item
+ * @since 5.0.0
*/
public static function getItemSharedWithByLink($itemType, $itemSource, $uidOwner) {
return \OC\Share\Share::getItemSharedWithByLink($itemType, $itemSource, $uidOwner);
* Based on the given token the share information will be returned - password protected shares will be verified
* @param string $token
* @return array|bool false will be returned in case the token is unknown or unauthorized
+ * @since 5.0.0 - parameter $checkPasswordProtection was added in 7.0.0
*/
public static function getShareByToken($token, $checkPasswordProtection = true) {
return \OC\Share\Share::getShareByToken($token, $checkPasswordProtection);
* resolves reshares down to the last real share
* @param array $linkItem
* @return array file owner
+ * @since 6.0.0
*/
public static function resolveReShare($linkItem) {
return \OC\Share\Share::resolveReShare($linkItem);
* @param int $limit Number of items to return (optional) Returns all by default
* @param bool $includeCollections
* @return mixed Return depends on format
+ * @since 5.0.0
*/
public static function getItemsShared($itemType, $format = self::FORMAT_NONE, $parameters = null,
$limit = -1, $includeCollections = false) {
* @param mixed $parameters
* @param bool $includeCollections
* @return mixed Return depends on format
+ * @since 5.0.0
*/
public static function getItemShared($itemType, $itemSource, $format = self::FORMAT_NONE,
$parameters = null, $includeCollections = false) {
* @param bool $includeCollections
* @param bool $checkExpireDate
* @return array Return array of users
+ * @since 5.0.0 - parameter $checkExpireDate was added in 7.0.0
*/
public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false, $checkExpireDate = true) {
return \OC\Share\Share::getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections, $checkExpireDate);
* @param \DateTime $expirationDate
* @return bool|string Returns true on success or false on failure, Returns token on success for links
* @throws \Exception
+ * @since 5.0.0 - parameter $itemSourceName was added in 6.0.0, parameter $expirationDate was added in 7.0.0
*/
public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null) {
return \OC\Share\Share::shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName, $expirationDate);
* @param string $shareWith User or group the item is being shared with
* @param string $owner owner of the share, if null the current user is used
* @return boolean true on success or false on failure
+ * @since 5.0.0 - parameter $owner was added in 8.0.0
*/
public static function unshare($itemType, $itemSource, $shareType, $shareWith, $owner = null) {
return \OC\Share\Share::unshare($itemType, $itemSource, $shareType, $shareWith, $owner);
* @param string $itemType
* @param string $itemSource
* @return boolean true on success or false on failure
+ * @since 5.0.0
*/
public static function unshareAll($itemType, $itemSource) {
return \OC\Share\Share::unshareAll($itemType, $itemSource);
* @return boolean true on success or false on failure
*
* Unsharing from self is not allowed for items inside collections
+ * @since 5.0.0 - parameter $originIsSource was added in 8.0.0
*/
public static function unshareFromSelf($itemType, $itemOrigin, $originIsSource = false) {
return \OC\Share\Share::unshareFromSelf($itemType, $itemOrigin, $originIsSource);
* @param int $shareType SHARE_TYPE_USER, SHARE_TYPE_GROUP, or SHARE_TYPE_LINK
* @param string $recipient with whom was the item shared
* @param bool $status
+ * @since 6.0.0 - parameter $originIsSource was added in 8.0.0
*/
public static function setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status) {
return \OC\Share\Share::setSendMailStatus($itemType, $itemSource, $shareType, $recipient, $status);
* @param string $shareWith User or group the item is being shared with
* @param int $permissions CRUDS permissions
* @return boolean true on success or false on failure
+ * @since 5.0.0
*/
public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) {
return \OC\Share\Share::setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions);
* @param string $date expiration date
* @param int $shareTime timestamp from when the file was shared
* @return boolean
+ * @since 5.0.0 - parameter $shareTime was added in 8.0.0
*/
public static function setExpirationDate($itemType, $itemSource, $date, $shareTime = null) {
return \OC\Share\Share::setExpirationDate($itemType, $itemSource, $date, $shareTime);
* @param int $shareId
* @param string $password
* @return boolean
+ * @since 8.1.0
*/
public static function setPassword($shareId, $password) {
$userSession = \OC::$server->getUserSession();
* Get the backend class for the specified item type
* @param string $itemType
* @return Share_Backend
+ * @since 5.0.0
*/
public static function getBackend($itemType) {
return \OC\Share\Share::getBackend($itemType);
/**
* Delete all shares with type SHARE_TYPE_LINK
+ * @since 6.0.0
*/
public static function removeAllLinkShares() {
return \OC\Share\Share::removeAllLinkShares();
*
* @param array $linkItem
* @return bool
+ * @since 7.0.0
*/
public static function checkPasswordProtectedShare(array $linkItem) {
return \OC\Share\Share::checkPasswordProtectedShare($linkItem);
* Check if resharing is allowed
*
* @return boolean true if allowed or false
+ * @since 5.0.0
*/
public static function isResharingAllowed() {
return \OC\Share\Share::isResharingAllowed();
/**
* Interface that apps must implement to share content.
+ * @since 5.0.0
*/
interface Share_Backend {
* @return boolean|null Source
*
* Return false if the item does not exist for the user
+ * @since 5.0.0
*/
public function isValidSource($itemSource, $uidOwner);
*
* This function needs to verify that the user does not already have an item with this name.
* If it does generate a new name e.g. name_#
+ * @since 5.0.0
*/
public function generateTarget($itemSource, $shareWith, $exclude = null);
*
* This function allows the backend to control the output of shared items with custom formats.
* It is only called through calls to the public getItem(s)Shared(With) functions.
+ * @since 5.0.0
*/
public function formatItems($items, $format, $parameters = null);
* The back-end can enable/disable specific share types. Just return true if
* the back-end doesn't provide any specific settings for it and want to allow
* all share types defined by the share API
+ * @since 8.0.0
*/
public function isShareTypeAllowed($shareType);
/**
* Interface for collections of of items implemented by another share backend.
* Extends the Share_Backend interface.
+ * @since 5.0.0
*/
interface Share_Backend_Collection extends Share_Backend {
/**
* Get the sources of the children of the item
* @param string $itemSource
* @return array Returns an array of children each inside an array with the keys: source, target, and file_path if applicable
+ * @since 5.0.0
*/
public function getChildren($itemSource);
}
/**
* Interface for share backends that share content that is dependent on files.
* Extends the Share_Backend interface.
+ * @since 5.0.0
*/
interface Share_Backend_File_Dependent extends Share_Backend {
/**
* @param string $itemSource
* @param string $uidOwner User that is the owner of shared item
* @return string|false
+ * @since 5.0.0
*/
public function getFilePath($itemSource, $uidOwner);
* @param string $app
* @param string $image
* @return string to the image
+ * @since 8.0.0
*/
public static function image_path($app, $image) {
return \image_path($app, $image);
*
* @param string $mimetype
* @return string to the image of this file type.
+ * @since 8.0.0
*/
public static function mimetype_icon($mimetype) {
return \mimetype_icon($mimetype);
*
* @param string $path path to file
* @return string to the preview of the image
+ * @since 8.0.0
*/
public static function preview_icon($path) {
return \preview_icon($path);
* @param string $path of file
* @param string $token
* @return string link to the preview
+ * @since 8.0.0
*/
public static function publicPreview_icon($path, $token) {
return \publicPreview_icon($path, $token);
*
* @param int $bytes in bytes
* @return string size as string
+ * @since 8.0.0
*/
public static function human_file_size($bytes) {
return \human_file_size($bytes);
}
/**
- * Return the relative date in relation to today. Returns something like "last hour" or "two month ago"
- *
- * @param int $timestamp unix timestamp
- * @param boolean $dateOnly
- * @return string human readable interpretation of the timestamp
- */
+ * Return the relative date in relation to today. Returns something like "last hour" or "two month ago"
+ *
+ * @param int $timestamp unix timestamp
+ * @param boolean $dateOnly
+ * @return string human readable interpretation of the timestamp
+ * @since 8.0.0
+ */
public static function relative_modified_date($timestamp, $dateOnly = false) {
return \relative_modified_date($timestamp, null, $dateOnly);
}
* @param mixed $selected which one is selected?
* @param array $params the parameters
* @return string html options
+ * @since 8.0.0
*/
public static function html_select_options($options, $selected, $params=array()) {
return \html_select_options($options, $selected, $params);
/**
* This class provides access to the user management. You can get information
* about the currently logged in user and the permissions for example
+ * @since 5.0.0
*/
class User {
/**
* Get the user id of the user currently logged in.
* @return string uid or false
* @deprecated Use \OC::$server->getUserSession()->getUser()->getUID()
+ * @since 5.0.0
*/
public static function getUser() {
return \OC_User::getUser();
* @param int|null $limit
* @param int|null $offset
* @return array an array of all uids
+ * @since 5.0.0
*/
public static function getUsers( $search = '', $limit = null, $offset = null ) {
return \OC_User::getUsers( $search, $limit, $offset );
* Get the user display name of the user currently logged in.
* @param string|null $user user id or null for current user
* @return string display name
+ * @since 5.0.0
*/
public static function getDisplayName( $user = null ) {
return \OC_User::getDisplayName( $user );
* @param int|null $limit
* @param int|null $offset
* @return array an array of all display names (value) and the correspondig uids (key)
+ * @since 5.0.0
*/
public static function getDisplayNames( $search = '', $limit = null, $offset = null ) {
return \OC_User::getDisplayNames( $search, $limit, $offset );
/**
* Check if the user is logged in
* @return boolean
+ * @since 5.0.0
*/
public static function isLoggedIn() {
return \OC_User::isLoggedIn();
* @param string $uid the username
* @param string $excludingBackend (default none)
* @return boolean
+ * @since 5.0.0
*/
public static function userExists( $uid, $excludingBackend = null ) {
return \OC_User::userExists( $uid, $excludingBackend );
* Logs the user out including all the session data
* Logout, destroys session
* @deprecated Use \OC::$server->getUserSession()->logout();
+ * @since 5.0.0
*/
public static function logout() {
\OC_User::logout();
*
* Check if the password is correct without logging in the user
* @deprecated Use \OC::$server->getUserManager()->checkPassword();
+ * @since 5.0.0
*/
public static function checkPassword( $uid, $password ) {
return \OC_User::checkPassword( $uid, $password );
}
/**
- * Check if the user is a admin, redirects to home if not
- */
+ * Check if the user is a admin, redirects to home if not
+ * @since 5.0.0
+ */
public static function checkAdminUser() {
\OC_Util::checkAdminUser();
}
/**
- * Check if the user is logged in, redirects to home if not. With
- * redirect URL parameter to the request URI.
- */
+ * Check if the user is logged in, redirects to home if not. With
+ * redirect URL parameter to the request URI.
+ * @since 5.0.0
+ */
public static function checkLoggedIn() {
\OC_Util::checkLoggedIn();
}
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
+/**
+ * Interface UserInterface
+ *
+ * @package OCP
+ * @since 4.5.0
+ */
interface UserInterface extends \OC_User_Interface {}
/**
* This class provides different helper functions to make the life of a developer easier
+ * @since 4.0.0
*/
class Util {
// consts for Logging
/**
* get the current installed version of ownCloud
* @return array
+ * @since 4.0.0
*/
public static function getVersion() {
return(\OC_Util::getVersion());
* @param string $ccname
* @param string $bcc
* @deprecated Use \OCP\Mail\IMailer instead
+ * @since 4.0.0
*/
public static function sendMail($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname,
$html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '') {
* @param string $app
* @param string $message
* @param int $level
+ * @since 4.0.0
*/
public static function writeLog( $app, $message, $level ) {
// call the internal log class
* @param string $app app name
* @param \Exception $ex exception to log
* @param int $level log level, defaults to \OCP\Util::FATAL
+ * @since ....0.0 - parameter $level was added in 7.0.0
*/
public static function logException( $app, \Exception $ex, $level = \OCP\Util::FATAL ) {
$exception = array(
* check if sharing is disabled for the current user
*
* @return boolean
+ * @since 7.0.0
*/
public static function isSharingDisabledForUser() {
return \OC_Util::isSharingDisabledForUser();
* @param string $application
* @param string|null $language
* @return \OC_L10N
+ * @since 6.0.0 - parameter $language was added in 8.0.0
*/
public static function getL10N($application, $language = null) {
return \OC::$server->getL10N($application, $language);
* add a css file
* @param string $application
* @param string $file
+ * @since 4.0.0
*/
public static function addStyle( $application, $file = null ) {
\OC_Util::addStyle( $application, $file );
* add a javascript file
* @param string $application
* @param string $file
+ * @since 4.0.0
*/
public static function addScript( $application, $file = null ) {
\OC_Util::addScript( $application, $file );
* Add a translation JS file
* @param string $application application id
* @param string $languageCode language code, defaults to the current locale
+ * @since 8.0.0
*/
public static function addTranslations($application, $languageCode = null) {
\OC_Util::addTranslations($application, $languageCode);
* @param string $tag tag name of the element
* @param array $attributes array of attributes for the element
* @param string $text the text content for the element
+ * @since 4.0.0
*/
public static function addHeader($tag, $attributes, $text=null) {
\OC_Util::addHeader($tag, $attributes, $text);
* @return string timestamp
*
* @deprecated Use \OC::$server->query('DateTimeFormatter') instead
+ * @since 4.0.0
*/
public static function formatDate($timestamp, $dateOnly=false, $timeZone = null) {
return(\OC_Util::formatDate($timestamp, $dateOnly, $timeZone));
* @return bool
*
* @deprecated No longer required
+ * @since 6.0.0
*/
public static function encryptedFiles() {
return false;
* @param array $args array with param=>value, will be appended to the returned url
* The value of $args will be urlencoded
* @return string the url
+ * @since 4.0.0 - parameter $args was added in 4.5.0
*/
public static function linkToAbsolute( $app, $file, $args = array() ) {
return(\OC_Helper::linkToAbsolute( $app, $file, $args ));
* Creates an absolute url for remote use.
* @param string $service id
* @return string the url
+ * @since 4.0.0
*/
public static function linkToRemote( $service ) {
return(\OC_Helper::linkToRemote( $service ));
* Creates an absolute url for public use
* @param string $service id
* @return string the url
+ * @since 4.5.0
*/
public static function linkToPublic($service) {
return \OC_Helper::linkToPublic($service);
* @internal param array $args with param=>value, will be appended to the returned url
* @return string the url
* @deprecated Use \OC::$server->getURLGenerator()->linkToRoute($route, $parameters)
+ * @since 5.0.0
*/
public static function linkToRoute( $route, $parameters = array() ) {
return \OC_Helper::linkToRoute($route, $parameters);
}
/**
- * Creates an url to the given app and file
- * @param string $app app
- * @param string $file file
- * @param array $args array with param=>value, will be appended to the returned url
- * The value of $args will be urlencoded
- * @return string the url
- * @deprecated Use \OC::$server->getURLGenerator()->linkTo($app, $file, $args)
- */
+ * Creates an url to the given app and file
+ * @param string $app app
+ * @param string $file file
+ * @param array $args array with param=>value, will be appended to the returned url
+ * The value of $args will be urlencoded
+ * @return string the url
+ * @deprecated Use \OC::$server->getURLGenerator()->linkTo($app, $file, $args)
+ * @since 4.0.0 - parameter $args was added in 4.5.0
+ */
public static function linkTo( $app, $file, $args = array() ) {
return(\OC_Helper::linkTo( $app, $file, $args ));
}
* Returns the server host, even if the website uses one or more reverse proxy
* @return string the server host
* @deprecated Use \OCP\IRequest::getServerHost
+ * @since 4.0.0
*/
public static function getServerHost() {
return \OC::$server->getRequest()->getServerHost();
/**
* Returns the server host name without an eventual port number
* @return string the server hostname
+ * @since 5.0.0
*/
public static function getServerHostName() {
$host_name = self::getServerHost();
* If the configuration value 'mail_from_address' is set in
* config.php, this value will override the $user_part that
* is passed to this function
+ * @since 5.0.0
*/
public static function getDefaultEmailAddress($user_part) {
$user_part = \OC_Config::getValue('mail_from_address', $user_part);
* Returns the server protocol. It respects reverse proxy servers and load balancers
* @return string the server protocol
* @deprecated Use \OCP\IRequest::getServerProtocol
+ * @since 4.5.0
*/
public static function getServerProtocol() {
return \OC::$server->getRequest()->getServerProtocol();
* Returns the request uri, even if the website uses one or more reverse proxies
* @return string the request uri
* @deprecated Use \OCP\IRequest::getRequestUri
+ * @since 5.0.0
*/
public static function getRequestUri() {
return \OC::$server->getRequest()->getRequestUri();
* Returns the script name, even if the website uses one or more reverse proxies
* @return string the script name
* @deprecated Use \OCP\IRequest::getScriptName
+ * @since 5.0.0
*/
public static function getScriptName() {
return \OC::$server->getRequest()->getScriptName();
* @param string $image image name
* @return string the url
* @deprecated Use \OC::$server->getURLGenerator()->imagePath($app, $image)
+ * @since 4.0.0
*/
public static function imagePath( $app, $image ) {
return(\OC_Helper::imagePath( $app, $image ));
* Make a human file size (2048 to 2 kB)
* @param int $bytes file size in bytes
* @return string a human readable file size
+ * @since 4.0.0
*/
public static function humanFileSize( $bytes ) {
return(\OC_Helper::humanFileSize( $bytes ));
* @return int a file size in bytes
*
* Inspired by: http://www.php.net/manual/en/function.filesize.php#92418
+ * @since 4.0.0
*/
public static function computerFileSize( $str ) {
return(\OC_Helper::computerFileSize( $str ));
* This function makes it very easy to connect to use hooks.
*
* TODO: write example
+ * @since 4.0.0
*/
static public function connectHook($signalClass, $signalName, $slotClass, $slotName ) {
return(\OC_Hook::connect($signalClass, $signalName, $slotClass, $slotName ));
* @return bool true if slots exists or false if not
*
* TODO: write example
+ * @since 4.0.0
*/
static public function emitHook( $signalclass, $signalname, $params = array()) {
return(\OC_Hook::emit( $signalclass, $signalname, $params ));
/**
* Register an get/post call. This is important to prevent CSRF attacks
* TODO: write example
+ * @since 4.5.0
*/
public static function callRegister() {
return(\OC_Util::callRegister());
/**
* Check an ajax get/post call if the request token is valid. exit if not.
* Todo: Write howto
+ * @since 4.5.0
*/
public static function callCheck() {
\OC_Util::callCheck();
*
* @param string|array $value
* @return string|array an array of sanitized strings or a single sinitized string, depends on the input parameter.
+ * @since 4.5.0
*/
public static function sanitizeHTML( $value ) {
return(\OC_Util::sanitizeHTML($value));
*
* @param string $component part of URI to encode
* @return string
+ * @since 6.0.0
*/
public static function encodePath($component) {
return(\OC_Util::encodePath($component));
* @param int $case Either MB_CASE_UPPER or MB_CASE_LOWER (default)
* @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @return array
+ * @since 4.5.0
*/
public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $encoding = 'UTF-8') {
return(\OC_Helper::mb_array_change_key_case($input, $case, $encoding));
* @param int $length Length of the part to be replaced
* @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @return string
+ * @since 4.5.0
*/
public static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = 'UTF-8') {
return(\OC_Helper::mb_substr_replace($string, $replacement, $start, $length, $encoding));
* @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8
* @param int $count If passed, this will be set to the number of replacements performed.
* @return string
+ * @since 4.5.0
*/
public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) {
return(\OC_Helper::mb_str_replace($search, $replace, $subject, $encoding, $count));
* @param string $needle the search string
* @param int $index optional, only search this key name
* @return mixed the key of the matching field, otherwise false
+ * @since 4.5.0
*/
public static function recursiveArraySearch($haystack, $needle, $index = null) {
return(\OC_Helper::recursiveArraySearch($haystack, $needle, $index));
* @param string $dir the current folder where the user currently operates
* @param int $free the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly
* @return int number of bytes representing
+ * @since 5.0.0
*/
public static function maxUploadFilesize($dir, $free = null) {
return \OC_Helper::maxUploadFilesize($dir, $free);
* Calculate free space left within user quota
* @param string $dir the current folder where the user currently operates
* @return int number of bytes representing
+ * @since 7.0.0
*/
public static function freeSpace($dir) {
return \OC_Helper::freeSpace($dir);
* Calculate PHP upload limit
*
* @return int number of bytes representing
+ * @since 7.0.0
*/
public static function uploadLimit() {
return \OC_Helper::uploadLimit();
* @param string $file file name to check
* @return bool true if the file name is valid, false otherwise
* @deprecated use \OC\Files\View::verifyPath()
+ * @since 7.0.0
*/
public static function isValidFileName($file) {
return \OC_Util::isValidFileName($file);
* @param int $length of the random string
* @return string
* @deprecated Use \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate($length); instead
+ * @since 7.0.0
*/
public static function generateRandomBytes($length = 30) {
return \OC_Util::generateRandomBytes($length);
* @param string $b second string to compare
* @return -1 if $b comes before $a, 1 if $a comes before $b
* or 0 if the strings are identical
+ * @since 7.0.0
*/
public static function naturalSortCompare($a, $b) {
return \OC\NaturalSort::getInstance()->compare($a, $b);
/**
* check if a password is required for each public link
* @return boolean
+ * @since 7.0.0
*/
public static function isPublicLinkPasswordRequired() {
return \OC_Util::isPublicLinkPasswordRequired();
/**
* check if share API enforces a default expire date
* @return boolean
+ * @since 8.0.0
*/
public static function isDefaultExpireDateEnforced() {
return \OC_Util::isDefaultExpireDateEnforced();
* Checks whether the current version needs upgrade.
*
* @return bool true if upgrade is needed, false otherwise
+ * @since 7.0.0
*/
public static function needUpgrade() {
return \OC_Util::needUpgrade(\OC::$server->getConfig());