fix(OC): Remove doc blocks for OCP implementations

Signed-off-by: provokateurin <kate@provokateurin.de>
This commit is contained in:
provokateurin 2024-09-06 09:44:04 +02:00
parent fc10fa5926
commit 007be83a96
No known key found for this signature in database
243 changed files with 0 additions and 11031 deletions

View file

@ -24,22 +24,10 @@ class CoreNotifier implements INotifier {
) {
}
/**
* Identifier of the notifier, only use [a-z0-9_]
*
* @return string
* @since 17.0.0
*/
public function getID(): string {
return 'core';
}
/**
* Human readable name describing the notifier
*
* @return string
* @since 17.0.0
*/
public function getName(): string {
return $this->factory->get('core')->t('Nextcloud Server');
}

View file

@ -105,7 +105,6 @@ class Account implements IAccount {
return $result;
}
/** @return array<string, IAccountProperty|array<int, IAccountProperty>> */
public function jsonSerialize(): array {
$properties = $this->properties;
foreach ($properties as $propertyName => $propertyObject) {

View file

@ -39,21 +39,11 @@ class AccountProperty implements IAccountProperty {
];
}
/**
* Set the value of a property
*
* @since 15.0.0
*/
public function setValue(string $value): IAccountProperty {
$this->value = $value;
return $this;
}
/**
* Set the scope of a property
*
* @since 15.0.0
*/
public function setScope(string $scope): IAccountProperty {
$newScope = $this->mapScopeToV2($scope);
if (!in_array($newScope, [
@ -68,39 +58,19 @@ class AccountProperty implements IAccountProperty {
return $this;
}
/**
* Set the verification status of a property
*
* @since 15.0.0
*/
public function setVerified(string $verified): IAccountProperty {
$this->verified = $verified;
return $this;
}
/**
* Get the name of a property
*
* @since 15.0.0
*/
public function getName(): string {
return $this->name;
}
/**
* Get the value of a property
*
* @since 15.0.0
*/
public function getValue(): string {
return $this->value;
}
/**
* Get the scope of a property
*
* @since 15.0.0
*/
public function getScope(): string {
return $this->scope;
}
@ -118,11 +88,6 @@ class AccountProperty implements IAccountProperty {
};
}
/**
* Get the verification status of a property
*
* @since 15.0.0
*/
public function getVerified(): string {
return $this->verified;
}

View file

@ -70,9 +70,6 @@ class Event implements IEvent {
$this->richValidator = $richValidator;
}
/**
* {@inheritDoc}
*/
public function setApp(string $app): IEvent {
if ($app === '' || isset($app[32])) {
throw new InvalidValueException('app');
@ -81,16 +78,10 @@ class Event implements IEvent {
return $this;
}
/**
* @return string
*/
public function getApp(): string {
return $this->app;
}
/**
* {@inheritDoc}
*/
public function setType(string $type): IEvent {
if ($type === '' || isset($type[255])) {
throw new InvalidValueException('type');
@ -99,16 +90,10 @@ class Event implements IEvent {
return $this;
}
/**
* @return string
*/
public function getType(): string {
return $this->type;
}
/**
* {@inheritDoc}
*/
public function setAffectedUser(string $affectedUser): IEvent {
if ($affectedUser === '' || isset($affectedUser[64])) {
throw new InvalidValueException('affectedUser');
@ -117,16 +102,10 @@ class Event implements IEvent {
return $this;
}
/**
* @return string
*/
public function getAffectedUser(): string {
return $this->affectedUser;
}
/**
* {@inheritDoc}
*/
public function setAuthor(string $author): IEvent {
if (isset($author[64])) {
throw new InvalidValueException('author');
@ -135,16 +114,10 @@ class Event implements IEvent {
return $this;
}
/**
* @return string
*/
public function getAuthor(): string {
return $this->author;
}
/**
* {@inheritDoc}
*/
public function setTimestamp(int $timestamp): IEvent {
if ($timestamp < 0) {
throw new InvalidValueException('timestamp');
@ -153,16 +126,10 @@ class Event implements IEvent {
return $this;
}
/**
* @return int
*/
public function getTimestamp(): int {
return $this->timestamp;
}
/**
* {@inheritDoc}
*/
public function setSubject(string $subject, array $parameters = []): IEvent {
if (isset($subject[255])) {
throw new InvalidValueException('subject');
@ -172,23 +139,14 @@ class Event implements IEvent {
return $this;
}
/**
* @return string
*/
public function getSubject(): string {
return $this->subject;
}
/**
* @return array
*/
public function getSubjectParameters(): array {
return $this->subjectParameters;
}
/**
* {@inheritDoc}
*/
public function setParsedSubject(string $subject): IEvent {
if ($subject === '') {
throw new InvalidValueException('parsedSubject');
@ -197,17 +155,10 @@ class Event implements IEvent {
return $this;
}
/**
* @return string
* @since 11.0.0
*/
public function getParsedSubject(): string {
return $this->subjectParsed;
}
/**
* {@inheritDoc}
*/
public function setRichSubject(string $subject, array $parameters = []): IEvent {
if ($subject === '') {
throw new InvalidValueException('richSubject');
@ -250,25 +201,14 @@ class Event implements IEvent {
return str_replace($placeholders, $replacements, $message);
}
/**
* @return string
* @since 11.0.0
*/
public function getRichSubject(): string {
return $this->subjectRich;
}
/**
* @return array[]
* @since 11.0.0
*/
public function getRichSubjectParameters(): array {
return $this->subjectRichParameters;
}
/**
* {@inheritDoc}
*/
public function setMessage(string $message, array $parameters = []): IEvent {
if (isset($message[255])) {
throw new InvalidValueException('message');
@ -278,39 +218,23 @@ class Event implements IEvent {
return $this;
}
/**
* @return string
*/
public function getMessage(): string {
return $this->message;
}
/**
* @return array
*/
public function getMessageParameters(): array {
return $this->messageParameters;
}
/**
* {@inheritDoc}
*/
public function setParsedMessage(string $message): IEvent {
$this->messageParsed = $message;
return $this;
}
/**
* @return string
* @since 11.0.0
*/
public function getParsedMessage(): string {
return $this->messageParsed;
}
/**
* {@inheritDoc}
*/
public function setRichMessage(string $message, array $parameters = []): IEvent {
$this->messageRich = $message;
$this->messageRichParameters = $parameters;
@ -326,25 +250,14 @@ class Event implements IEvent {
return $this;
}
/**
* @return string
* @since 11.0.0
*/
public function getRichMessage(): string {
return $this->messageRich;
}
/**
* @return array[]
* @since 11.0.0
*/
public function getRichMessageParameters(): array {
return $this->messageRichParameters;
}
/**
* {@inheritDoc}
*/
public function setObject(string $objectType, int $objectId, string $objectName = ''): IEvent {
if (isset($objectType[255])) {
throw new InvalidValueException('objectType');
@ -358,30 +271,18 @@ class Event implements IEvent {
return $this;
}
/**
* @return string
*/
public function getObjectType(): string {
return $this->objectType;
}
/**
* @return int
*/
public function getObjectId(): int {
return $this->objectId;
}
/**
* @return string
*/
public function getObjectName(): string {
return $this->objectName;
}
/**
* {@inheritDoc}
*/
public function setLink(string $link): IEvent {
if (isset($link[4000])) {
throw new InvalidValueException('link');
@ -390,16 +291,10 @@ class Event implements IEvent {
return $this;
}
/**
* @return string
*/
public function getLink(): string {
return $this->link;
}
/**
* {@inheritDoc}
*/
public function setIcon(string $icon): IEvent {
if (isset($icon[4000])) {
throw new InvalidValueException('icon');
@ -408,36 +303,19 @@ class Event implements IEvent {
return $this;
}
/**
* @return string
* @since 11.0.0
*/
public function getIcon(): string {
return $this->icon;
}
/**
* @param IEvent $child
* @return $this
* @since 11.0.0 - Since 15.0.0 returns $this
*/
public function setChildEvent(IEvent $child): IEvent {
$this->child = $child;
return $this;
}
/**
* @return IEvent|null
* @since 11.0.0
*/
public function getChildEvent() {
return $this->child;
}
/**
* @return bool
* @since 8.2.0
*/
public function isValid(): bool {
return
$this->isValidCommon()
@ -446,10 +324,6 @@ class Event implements IEvent {
;
}
/**
* @return bool
* @since 8.2.0
*/
public function isValidParsed(): bool {
if ($this->getRichSubject() !== '' || !empty($this->getRichSubjectParameters())) {
try {

View file

@ -20,34 +20,6 @@ class EventMerger implements IEventMerger {
$this->l10n = $l10n;
}
/**
* Combines two events when possible to have grouping:
*
* Example1: Two events with subject '{user} created {file}' and
* $mergeParameter file with different file and same user will be merged
* to '{user} created {file1} and {file2}' and the childEvent on the return
* will be set, if the events have been merged.
*
* Example2: Two events with subject '{user} created {file}' and
* $mergeParameter file with same file and same user will be merged to
* '{user} created {file1}' and the childEvent on the return will be set, if
* the events have been merged.
*
* The following requirements have to be met, in order to be merged:
* - Both events need to have the same `getApp()`
* - Both events must not have a message `getMessage()`
* - Both events need to have the same subject `getSubject()`
* - Both events need to have the same object type `getObjectType()`
* - The time difference between both events must not be bigger then 3 hours
* - Only up to 5 events can be merged.
* - All parameters apart from such starting with $mergeParameter must be
* the same for both events.
*
* @param string $mergeParameter
* @param IEvent $event
* @param IEvent|null $previousEvent
* @return IEvent
*/
public function mergeEvents($mergeParameter, IEvent $event, ?IEvent $previousEvent = null) {
// No second event => can not combine
if (!$previousEvent instanceof IEvent) {

View file

@ -91,25 +91,10 @@ class Manager implements IManager {
return $this->consumers;
}
/**
* Generates a new IEvent object
*
* Make sure to call at least the following methods before sending it to the
* app with via the publish() method:
* - setApp()
* - setType()
* - setAffectedUser()
* - setSubject()
*
* @return IEvent
*/
public function generateEvent(): IEvent {
return new Event($this->validator);
}
/**
* {@inheritDoc}
*/
public function publish(IEvent $event): void {
if ($event->getAuthor() === '') {
if ($this->session->getUser() instanceof IUser) {
@ -130,14 +115,6 @@ class Manager implements IManager {
}
}
/**
* In order to improve lazy loading a closure can be registered which will be called in case
* activity consumers are actually requested
*
* $callable has to return an instance of OCA\Activity\IConsumer
*
* @param \Closure $callable
*/
public function registerConsumer(\Closure $callable): void {
$this->consumersClosures[] = $callable;
$this->consumers = [];
@ -149,18 +126,10 @@ class Manager implements IManager {
/** @var IFilter[] */
protected $filters = [];
/**
* @param string $filter Class must implement OCA\Activity\IFilter
* @return void
*/
public function registerFilter(string $filter): void {
$this->filterClasses[$filter] = false;
}
/**
* @return IFilter[]
* @throws \InvalidArgumentException
*/
public function getFilters(): array {
foreach ($this->filterClasses as $class => $false) {
/** @var IFilter $filter */
@ -177,9 +146,6 @@ class Manager implements IManager {
return $this->filters;
}
/**
* {@inheritDoc}
*/
public function getFilterById(string $id): IFilter {
$filters = $this->getFilters();
@ -196,18 +162,10 @@ class Manager implements IManager {
/** @var IProvider[] */
protected $providers = [];
/**
* @param string $provider Class must implement OCA\Activity\IProvider
* @return void
*/
public function registerProvider(string $provider): void {
$this->providerClasses[$provider] = false;
}
/**
* @return IProvider[]
* @throws \InvalidArgumentException
*/
public function getProviders(): array {
foreach ($this->providerClasses as $class => $false) {
/** @var IProvider $provider */
@ -230,18 +188,10 @@ class Manager implements IManager {
/** @var ISetting[] */
protected $settings = [];
/**
* @param string $setting Class must implement OCA\Activity\ISetting
* @return void
*/
public function registerSetting(string $setting): void {
$this->settingsClasses[$setting] = false;
}
/**
* @return ActivitySettings[]
* @throws \InvalidArgumentException
*/
public function getSettings(): array {
foreach ($this->settingsClasses as $class => $false) {
/** @var ISetting $setting */
@ -262,9 +212,6 @@ class Manager implements IManager {
return $this->settings;
}
/**
* {@inheritDoc}
*/
public function getSettingById(string $id): ActivitySettings {
$settings = $this->getSettings();
@ -276,55 +223,29 @@ class Manager implements IManager {
}
/**
* @param string $type
* @param int $id
*/
public function setFormattingObject(string $type, int $id): void {
$this->formattingObjectType = $type;
$this->formattingObjectId = $id;
}
/**
* @return bool
*/
public function isFormattingFilteredObject(): bool {
return $this->formattingObjectType !== null && $this->formattingObjectId !== null
&& $this->formattingObjectType === $this->request->getParam('object_type')
&& $this->formattingObjectId === (int)$this->request->getParam('object_id');
}
/**
* @param bool $status Set to true, when parsing events should not use SVG icons
*/
public function setRequirePNG(bool $status): void {
$this->requirePNG = $status;
}
/**
* @return bool
*/
public function getRequirePNG(): bool {
return $this->requirePNG;
}
/**
* Set the user we need to use
*
* @param string|null $currentUserId
*/
public function setCurrentUserId(?string $currentUserId = null): void {
$this->currentUserId = $currentUserId;
}
/**
* Get the user we need to use
*
* Either the user is logged in, or we try to get it from the token
*
* @return string
* @throws \UnexpectedValueException If the token is invalid, does not exist or is not unique
*/
public function getCurrentUserId(): string {
if ($this->currentUserId !== null) {
return $this->currentUserId;

View file

@ -65,168 +65,59 @@ class AllConfig implements IConfig {
}
}
/**
* Sets and deletes system wide values
*
* @param array $configs Associative array with `key => value` pairs
* If value is null, the config key will be deleted
*/
public function setSystemValues(array $configs) {
$this->systemConfig->setValues($configs);
}
/**
* Sets a new system wide value
*
* @param string $key the key of the value, under which will be saved
* @param mixed $value the value that should be stored
*/
public function setSystemValue($key, $value) {
$this->systemConfig->setValue($key, $value);
}
/**
* Looks up a system wide defined 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
*/
public function getSystemValue($key, $default = '') {
return $this->systemConfig->getValue($key, $default);
}
/**
* Looks up a boolean system wide defined value
*
* @param string $key the key of the value, under which it was saved
* @param bool $default the default value to be returned if the value isn't set
*
* @return bool
*
* @since 16.0.0
*/
public function getSystemValueBool(string $key, bool $default = false): bool {
return (bool)$this->getSystemValue($key, $default);
}
/**
* Looks up an integer system wide defined value
*
* @param string $key the key of the value, under which it was saved
* @param int $default the default value to be returned if the value isn't set
*
* @return int
*
* @since 16.0.0
*/
public function getSystemValueInt(string $key, int $default = 0): int {
return (int)$this->getSystemValue($key, $default);
}
/**
* Looks up a string system wide defined 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
*
* @since 16.0.0
*/
public function getSystemValueString(string $key, string $default = ''): string {
return (string)$this->getSystemValue($key, $default);
}
/**
* Looks up a system wide defined value and filters out sensitive data
*
* @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
*/
public function getFilteredSystemValue($key, $default = '') {
return $this->systemConfig->getFilteredValue($key, $default);
}
/**
* Delete a system wide defined value
*
* @param string $key the key of the value, under which it was saved
*/
public function deleteSystemValue($key) {
$this->systemConfig->deleteValue($key);
}
/**
* Get all keys stored for an app
*
* @param string $appName the appName that we stored the value under
* @return string[] the keys stored for the app
* @deprecated 29.0.0 Use {@see IAppConfig} directly
*/
public function getAppKeys($appName) {
return \OC::$server->get(AppConfig::class)->getKeys($appName);
}
/**
* Writes a new app wide value
*
* @param string $appName the appName that we want to store the value under
* @param string $key the key of the value, under which will be saved
* @param string|float|int $value the value that should be stored
* @deprecated 29.0.0 Use {@see IAppConfig} directly
*/
public function setAppValue($appName, $key, $value) {
\OC::$server->get(AppConfig::class)->setValue($appName, $key, $value);
}
/**
* Looks up an app wide defined value
*
* @param string $appName the appName that we stored the value under
* @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
* @deprecated 29.0.0 Use {@see IAppConfig} directly
*/
public function getAppValue($appName, $key, $default = '') {
return \OC::$server->get(AppConfig::class)->getValue($appName, $key, $default);
}
/**
* Delete an app wide defined value
*
* @param string $appName the appName that we stored the value under
* @param string $key the key of the value, under which it was saved
* @deprecated 29.0.0 Use {@see IAppConfig} directly
*/
public function deleteAppValue($appName, $key) {
\OC::$server->get(AppConfig::class)->deleteKey($appName, $key);
}
/**
* Removes all keys in appconfig belonging to the app
*
* @param string $appName the appName the configs are stored under
* @deprecated 29.0.0 Use {@see IAppConfig} directly
*/
public function deleteAppValues($appName) {
\OC::$server->get(AppConfig::class)->deleteApp($appName);
}
/**
* Set a user defined value
*
* @param string $userId the userId of the user that we want to store the value under
* @param string $appName the appName that we want to store the value under
* @param string $key the key under which the value is being stored
* @param string|float|int $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
* @throws \UnexpectedValueException when trying to store an unexpected value
*/
public function setUserValue($userId, $appName, $key, $value, $preCondition = null) {
if (!is_int($value) && !is_float($value) && !is_string($value)) {
throw new \UnexpectedValueException('Only integers, floats and strings are allowed as value');
@ -284,15 +175,6 @@ class AllConfig implements IConfig {
}
}
/**
* Getting a user defined value
*
* @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
* @param mixed $default the default value to be returned if the value isn't set
* @return string
*/
public function getUserValue($userId, $appName, $key, $default = '') {
$data = $this->getAllUserValues($userId);
if (isset($data[$appName][$key])) {
@ -302,13 +184,6 @@ class AllConfig implements IConfig {
}
}
/**
* Get the keys of all stored by an app for the user
*
* @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[]
*/
public function getUserKeys($userId, $appName) {
$data = $this->getAllUserValues($userId);
if (isset($data[$appName])) {
@ -318,13 +193,6 @@ class AllConfig implements IConfig {
}
}
/**
* Delete a user value
*
* @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
*/
public function deleteUserValue($userId, $appName, $key) {
// TODO - FIXME
$this->fixDIInit();
@ -341,11 +209,6 @@ class AllConfig implements IConfig {
}
}
/**
* Delete all user values
*
* @param string $userId the userId of the user that we want to remove all values from
*/
public function deleteAllUserValues($userId) {
// TODO - FIXME
$this->fixDIInit();
@ -357,11 +220,6 @@ class AllConfig implements IConfig {
unset($this->userCache[$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
*/
public function deleteAppFromAllUsers($appName) {
// TODO - FIXME
$this->fixDIInit();
@ -376,16 +234,6 @@ class AllConfig implements IConfig {
}
}
/**
* Returns all user configs sorted by app of one user
*
* @param ?string $userId the user ID to get the app configs from
* @psalm-return array<string, array<string, string>>
* @return array[] - 2 dimensional array with the following structure:
* [ $appId =>
* [ $key => $value ]
* ]
*/
public function getAllUserValues(?string $userId): array {
if (isset($this->userCache[$userId])) {
return $this->userCache[$userId];
@ -416,14 +264,6 @@ class AllConfig implements IConfig {
return $data;
}
/**
* Fetches a mapped list of userId -> value, for a specified app and key and a list of user IDs.
*
* @param string $appName app to get the value for
* @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
*/
public function getUserValueForUsers($appName, $key, $userIds) {
// TODO - FIXME
$this->fixDIInit();
@ -456,14 +296,6 @@ class AllConfig implements IConfig {
return $userValues;
}
/**
* Determines the users that have the given value set for a specific app-key-pair
*
* @param string $appName the app to get the user for
* @param string $key the key to get the user for
* @param string $value the value to get the user for
* @return list<string> of user IDs
*/
public function getUsersForUserValue($appName, $key, $value) {
// TODO - FIXME
$this->fixDIInit();

View file

@ -138,21 +138,10 @@ class AppManager implements IAppManager {
return $this->installedAppsCache;
}
/**
* List all installed apps
*
* @return string[]
*/
public function getInstalledApps() {
return array_keys($this->getInstalledAppsValues());
}
/**
* List all apps enabled for a user
*
* @param \OCP\IUser $user
* @return string[]
*/
public function getEnabledAppsForUser(IUser $user) {
$apps = $this->getInstalledAppsValues();
$appsForUser = array_filter($apps, function ($enabled) use ($user) {
@ -161,10 +150,6 @@ class AppManager implements IAppManager {
return array_keys($appsForUser);
}
/**
* @param IGroup $group
* @return array
*/
public function getEnabledAppsForGroup(IGroup $group): array {
$apps = $this->getInstalledAppsValues();
$appsForGroups = array_filter($apps, function ($enabled) use ($group) {
@ -173,18 +158,6 @@ class AppManager implements IAppManager {
return array_keys($appsForGroups);
}
/**
* Loads all apps
*
* @param string[] $types
* @return bool
*
* This function walks through the Nextcloud directory and loads all apps
* it can find. A directory contains an app if the file /appinfo/info.xml
* exists.
*
* if $types is set to non-empty array, only apps of those types will be loaded
*/
public function loadApps(array $types = []): bool {
if ($this->config->getSystemValueBool('maintenance', false)) {
return false;
@ -222,13 +195,6 @@ class AppManager implements IAppManager {
return true;
}
/**
* check if an app is of a specific type
*
* @param string $app
* @param array $types
* @return bool
*/
public function isType(string $app, array $types): bool {
$appTypes = $this->getAppTypes($app);
foreach ($types as $type) {
@ -265,10 +231,6 @@ class AppManager implements IAppManager {
return $this->autoDisabledApps;
}
/**
* @param string $appId
* @return array
*/
public function getAppRestriction(string $appId): array {
$values = $this->getInstalledAppsValues();
@ -283,13 +245,6 @@ class AppManager implements IAppManager {
}
/**
* Check if an app is enabled for user
*
* @param string $appId
* @param \OCP\IUser|null $user (optional) if not defined, the currently logged in user will be used
* @return bool
*/
public function isEnabledForUser($appId, $user = null) {
if ($this->isAlwaysEnabled($appId)) {
return true;
@ -357,15 +312,6 @@ class AppManager implements IAppManager {
}
}
/**
* Check if an app is enabled in the instance
*
* Notice: This actually checks if the app is enabled and not only if it is installed.
*
* @param string $appId
* @param IGroup[]|String[] $groups
* @return bool
*/
public function isInstalled($appId) {
$installedApps = $this->getInstalledAppsValues();
return isset($installedApps[$appId]);
@ -502,11 +448,6 @@ class AppManager implements IAppManager {
$eventLogger->end("bootstrap:load_app:$app");
}
/**
* Check if an app is loaded
* @param string $app app id
* @since 26.0.0
*/
public function isAppLoaded(string $app): bool {
return isset($this->loadedApps[$app]);
}
@ -522,13 +463,6 @@ class AppManager implements IAppManager {
require_once $app . '/appinfo/app.php';
}
/**
* Enable an app for every user
*
* @param string $appId
* @param bool $forceEnable
* @throws AppPathNotFoundException
*/
public function enableApp(string $appId, bool $forceEnable = false): void {
// Check if app exists
$this->getAppPath($appId);
@ -546,12 +480,6 @@ class AppManager implements IAppManager {
$this->clearAppsCache();
}
/**
* Whether a list of types contains a protected app type
*
* @param string[] $types
* @return bool
*/
public function hasProtectedAppType($types) {
if (empty($types)) {
return false;
@ -561,15 +489,6 @@ class AppManager implements IAppManager {
return !empty($protectedTypes);
}
/**
* Enable an app only for specific groups
*
* @param string $appId
* @param IGroup[] $groups
* @param bool $forceEnable
* @throws \InvalidArgumentException if app can't be enabled for groups
* @throws AppPathNotFoundException
*/
public function enableAppForGroups(string $appId, array $groups, bool $forceEnable = false): void {
// Check if app exists
$this->getAppPath($appId);
@ -600,13 +519,6 @@ class AppManager implements IAppManager {
$this->clearAppsCache();
}
/**
* Disable an app for every user
*
* @param string $appId
* @param bool $automaticDisabled
* @throws \Exception if app can't be disabled
*/
public function disableApp($appId, $automaticDisabled = false) {
if ($this->isAlwaysEnabled($appId)) {
throw new \Exception("$appId can't be disabled.");
@ -636,13 +548,6 @@ class AppManager implements IAppManager {
$this->clearAppsCache();
}
/**
* Get the directory for the given app.
*
* @param string $appId
* @return string
* @throws AppPathNotFoundException if app folder can't be found
*/
public function getAppPath($appId) {
$appPath = \OC_App::getAppPath($appId);
if ($appPath === false) {
@ -651,13 +556,6 @@ class AppManager implements IAppManager {
return $appPath;
}
/**
* Get the web path for the given app.
*
* @param string $appId
* @return string
* @throws AppPathNotFoundException if app path can't be found
*/
public function getAppWebPath(string $appId): string {
$appWebPath = \OC_App::getAppWebPath($appId);
if ($appWebPath === false) {
@ -666,9 +564,6 @@ class AppManager implements IAppManager {
return $appWebPath;
}
/**
* Clear the cached list of apps when enabling/disabling an app
*/
public function clearAppsCache() {
$this->appInfos = [];
}
@ -699,12 +594,6 @@ class AppManager implements IAppManager {
return $appsToUpgrade;
}
/**
* Returns the app information from "appinfo/info.xml".
*
* @param string|null $lang
* @return array|null app info
*/
public function getAppInfo(string $appId, bool $path = false, $lang = null) {
if ($path) {
$file = $appId;
@ -765,10 +654,6 @@ class AppManager implements IAppManager {
return $incompatibleApps;
}
/**
* @inheritdoc
* In case you change this method, also change \OC\App\CodeChecker\InfoChecker::isShipped()
*/
public function isShipped($appId) {
$this->loadShippedJson();
return in_array($appId, $this->shippedApps, true);
@ -796,24 +681,15 @@ class AppManager implements IAppManager {
}
}
/**
* @inheritdoc
*/
public function getAlwaysEnabledApps() {
$this->loadShippedJson();
return $this->alwaysEnabled;
}
/**
* @inheritdoc
*/
public function isDefaultEnabled(string $appId): bool {
return (in_array($appId, $this->getDefaultEnabledApps()));
}
/**
* @inheritdoc
*/
public function getDefaultEnabledApps(): array {
$this->loadShippedJson();

View file

@ -73,12 +73,6 @@ class AppConfig implements IAppConfig {
) {
}
/**
* @inheritDoc
*
* @return string[] list of app ids
* @since 7.0.0
*/
public function getApps(): array {
$this->loadConfigAll();
$apps = array_merge(array_keys($this->fastCache), array_keys($this->lazyCache));
@ -87,14 +81,6 @@ class AppConfig implements IAppConfig {
return array_values(array_unique($apps));
}
/**
* @inheritDoc
*
* @param string $app id of the app
*
* @return string[] list of stored config keys
* @since 29.0.0
*/
public function getKeys(string $app): array {
$this->assertParams($app);
$this->loadConfigAll();
@ -104,17 +90,6 @@ class AppConfig implements IAppConfig {
return array_values(array_unique($keys));
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config
*
* @return bool TRUE if key exists
* @since 7.0.0
* @since 29.0.0 Added the $lazy argument
*/
public function hasKey(string $app, string $key, ?bool $lazy = false): bool {
$this->assertParams($app, $key);
$this->loadConfig($lazy);
@ -131,15 +106,6 @@ class AppConfig implements IAppConfig {
return isset($this->fastCache[$app][$key]);
}
/**
* @param string $app id of the app
* @param string $key config key
* @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config
*
* @return bool
* @throws AppConfigUnknownKeyException if config key is not known
* @since 29.0.0
*/
public function isSensitive(string $app, string $key, ?bool $lazy = false): bool {
$this->assertParams($app, $key);
$this->loadConfig($lazy);
@ -151,17 +117,6 @@ class AppConfig implements IAppConfig {
return $this->isTyped(self::VALUE_SENSITIVE, $this->valueTypes[$app][$key]);
}
/**
* @inheritDoc
*
* @param string $app if of the app
* @param string $key config key
*
* @return bool TRUE if config is lazy loaded
* @throws AppConfigUnknownKeyException if config key is not known
* @see IAppConfig for details about lazy loading
* @since 29.0.0
*/
public function isLazy(string $app, string $key): bool {
// there is a huge probability the non-lazy config are already loaded
if ($this->hasKey($app, $key, false)) {
@ -177,16 +132,6 @@ class AppConfig implements IAppConfig {
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $prefix config keys prefix to search
* @param bool $filtered TRUE to hide sensitive config values. Value are replaced by {@see IConfig::SENSITIVE_VALUE}
*
* @return array<string, string|int|float|bool|array> [configKey => configValue]
* @since 29.0.0
*/
public function getAllValues(string $app, string $prefix = '', bool $filtered = false): array {
$this->assertParams($app, $prefix);
// if we want to filter values, we need to get sensitivity
@ -222,16 +167,6 @@ class AppConfig implements IAppConfig {
return $result;
}
/**
* @inheritDoc
*
* @param string $key config key
* @param bool $lazy search within lazy loaded config
* @param int|null $typedAs enforce type for the returned values ({@see self::VALUE_STRING} and others)
*
* @return array<string, string|int|float|bool|array> [appId => configValue]
* @since 29.0.0
*/
public function searchValues(string $key, bool $lazy = false, ?int $typedAs = null): array {
$this->assertParams('', $key, true);
$this->loadConfig($lazy);
@ -298,20 +233,6 @@ class AppConfig implements IAppConfig {
);
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param string $default default value
* @param bool $lazy search within lazy loaded config
*
* @return string stored config value or $default if not set in database
* @throws InvalidArgumentException if one of the argument format is invalid
* @throws AppConfigTypeConflictException in case of conflict with the value type set in database
* @since 29.0.0
* @see IAppConfig for explanation about lazy loading
*/
public function getValueString(
string $app,
string $key,
@ -321,20 +242,6 @@ class AppConfig implements IAppConfig {
return $this->getTypedValue($app, $key, $default, $lazy, self::VALUE_STRING);
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param int $default default value
* @param bool $lazy search within lazy loaded config
*
* @return int stored config value or $default if not set in database
* @throws InvalidArgumentException if one of the argument format is invalid
* @throws AppConfigTypeConflictException in case of conflict with the value type set in database
* @since 29.0.0
* @see IAppConfig for explanation about lazy loading
*/
public function getValueInt(
string $app,
string $key,
@ -344,57 +251,15 @@ class AppConfig implements IAppConfig {
return (int)$this->getTypedValue($app, $key, (string)$default, $lazy, self::VALUE_INT);
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param float $default default value
* @param bool $lazy search within lazy loaded config
*
* @return float stored config value or $default if not set in database
* @throws InvalidArgumentException if one of the argument format is invalid
* @throws AppConfigTypeConflictException in case of conflict with the value type set in database
* @since 29.0.0
* @see IAppConfig for explanation about lazy loading
*/
public function getValueFloat(string $app, string $key, float $default = 0, bool $lazy = false): float {
return (float)$this->getTypedValue($app, $key, (string)$default, $lazy, self::VALUE_FLOAT);
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param bool $default default value
* @param bool $lazy search within lazy loaded config
*
* @return bool stored config value or $default if not set in database
* @throws InvalidArgumentException if one of the argument format is invalid
* @throws AppConfigTypeConflictException in case of conflict with the value type set in database
* @since 29.0.0
* @see IAppConfig for explanation about lazy loading
*/
public function getValueBool(string $app, string $key, bool $default = false, bool $lazy = false): bool {
$b = strtolower($this->getTypedValue($app, $key, $default ? 'true' : 'false', $lazy, self::VALUE_BOOL));
return in_array($b, ['1', 'true', 'yes', 'on']);
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param array $default default value
* @param bool $lazy search within lazy loaded config
*
* @return array stored config value or $default if not set in database
* @throws InvalidArgumentException if one of the argument format is invalid
* @throws AppConfigTypeConflictException in case of conflict with the value type set in database
* @since 29.0.0
* @see IAppConfig for explanation about lazy loading
*/
public function getValueArray(
string $app,
string $key,
@ -470,21 +335,6 @@ class AppConfig implements IAppConfig {
return $value;
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
*
* @return int type of the value
* @throws AppConfigUnknownKeyException if config key is not known
* @since 29.0.0
* @see VALUE_STRING
* @see VALUE_INT
* @see VALUE_FLOAT
* @see VALUE_BOOL
* @see VALUE_ARRAY
*/
public function getValueType(string $app, string $key, ?bool $lazy = null): int {
$this->assertParams($app, $key);
$this->loadConfig($lazy);
@ -538,20 +388,6 @@ class AppConfig implements IAppConfig {
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param string $value config value
* @param bool $lazy set config as lazy loaded
* @param bool $sensitive if TRUE value will be hidden when listing config values.
*
* @return bool TRUE if value was different, therefor updated in database
* @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
* @since 29.0.0
* @see IAppConfig for explanation about lazy loading
*/
public function setValueString(
string $app,
string $key,
@ -568,20 +404,6 @@ class AppConfig implements IAppConfig {
);
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param int $value config value
* @param bool $lazy set config as lazy loaded
* @param bool $sensitive if TRUE value will be hidden when listing config values.
*
* @return bool TRUE if value was different, therefor updated in database
* @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
* @since 29.0.0
* @see IAppConfig for explanation about lazy loading
*/
public function setValueInt(
string $app,
string $key,
@ -602,20 +424,6 @@ class AppConfig implements IAppConfig {
);
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param float $value config value
* @param bool $lazy set config as lazy loaded
* @param bool $sensitive if TRUE value will be hidden when listing config values.
*
* @return bool TRUE if value was different, therefor updated in database
* @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
* @since 29.0.0
* @see IAppConfig for explanation about lazy loading
*/
public function setValueFloat(
string $app,
string $key,
@ -632,19 +440,6 @@ class AppConfig implements IAppConfig {
);
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param bool $value config value
* @param bool $lazy set config as lazy loaded
*
* @return bool TRUE if value was different, therefor updated in database
* @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
* @since 29.0.0
* @see IAppConfig for explanation about lazy loading
*/
public function setValueBool(
string $app,
string $key,
@ -660,21 +455,6 @@ class AppConfig implements IAppConfig {
);
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param array $value config value
* @param bool $lazy set config as lazy loaded
* @param bool $sensitive if TRUE value will be hidden when listing config values.
*
* @return bool TRUE if value was different, therefor updated in database
* @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
* @throws JsonException
* @since 29.0.0
* @see IAppConfig for explanation about lazy loading
*/
public function setValueArray(
string $app,
string $key,
@ -879,16 +659,6 @@ class AppConfig implements IAppConfig {
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param bool $sensitive TRUE to set as sensitive, FALSE to unset
*
* @return bool TRUE if entry was found in database and an update was necessary
* @since 29.0.0
*/
public function updateSensitive(string $app, string $key, bool $sensitive): bool {
$this->assertParams($app, $key);
$this->loadConfigAll();
@ -938,16 +708,6 @@ class AppConfig implements IAppConfig {
return true;
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
* @param bool $lazy TRUE to set as lazy loaded, FALSE to unset
*
* @return bool TRUE if entry was found in database and an update was necessary
* @since 29.0.0
*/
public function updateLazy(string $app, string $key, bool $lazy): bool {
$this->assertParams($app, $key);
$this->loadConfigAll();
@ -973,16 +733,6 @@ class AppConfig implements IAppConfig {
return true;
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
*
* @return array
* @throws AppConfigUnknownKeyException if config key is not known in database
* @since 29.0.0
*/
public function getDetails(string $app, string $key): array {
$this->assertParams($app, $key);
$this->loadConfigAll();
@ -1023,13 +773,6 @@ class AppConfig implements IAppConfig {
];
}
/**
* @param string $type
*
* @return int
* @throws AppConfigIncorrectTypeException
* @since 29.0.0
*/
public function convertTypeToInt(string $type): int {
return match (strtolower($type)) {
'mixed' => IAppConfig::VALUE_MIXED,
@ -1042,13 +785,6 @@ class AppConfig implements IAppConfig {
};
}
/**
* @param int $type
*
* @return string
* @throws AppConfigIncorrectTypeException
* @since 29.0.0
*/
public function convertTypeToString(int $type): string {
$type &= ~self::VALUE_SENSITIVE;
@ -1063,14 +799,6 @@ class AppConfig implements IAppConfig {
};
}
/**
* @inheritDoc
*
* @param string $app id of the app
* @param string $key config key
*
* @since 29.0.0
*/
public function deleteKey(string $app, string $key): void {
$this->assertParams($app, $key);
$qb = $this->connection->getQueryBuilder();
@ -1083,13 +811,6 @@ class AppConfig implements IAppConfig {
unset($this->fastCache[$app][$key]);
}
/**
* @inheritDoc
*
* @param string $app id of the app
*
* @since 29.0.0
*/
public function deleteApp(string $app): void {
$this->assertParams($app);
$qb = $this->connection->getQueryBuilder();
@ -1100,13 +821,6 @@ class AppConfig implements IAppConfig {
$this->clearCache();
}
/**
* @inheritDoc
*
* @param bool $reload set to TRUE to refill cache instantly after clearing it
*
* @since 29.0.0
*/
public function clearCache(bool $reload = false): void {
$this->lazyLoaded = $this->fastLoaded = false;
$this->lazyCache = $this->fastCache = $this->valueTypes = [];
@ -1332,15 +1046,6 @@ class AppConfig implements IAppConfig {
}
/**
* get multiple values, either the app or key can be used as wildcard by setting it to false
*
* @param string|false $app
* @param string|false $key
*
* @return array|false
* @deprecated 29.0.0 use {@see getAllValues()}
*/
public function getValues($app, $key) {
if (($app !== false) === ($key !== false)) {
return false;
@ -1354,14 +1059,6 @@ class AppConfig implements IAppConfig {
}
}
/**
* get all values of the app or and filters out sensitive data
*
* @param string $app
*
* @return array
* @deprecated 29.0.0 use {@see getAllValues()}
*/
public function getFilteredValues($app) {
return $this->getAllValues($app, filtered: true);
}

View file

@ -336,17 +336,10 @@ class DIContainer extends SimpleContainer implements IAppContainer {
});
}
/**
* @return \OCP\IServerContainer
*/
public function getServer() {
return $this->server;
}
/**
* @param string $middleWare
* @return boolean|null
*/
public function registerMiddleWare($middleWare) {
if (in_array($middleWare, $this->middleWares, true) !== false) {
return false;
@ -354,10 +347,6 @@ class DIContainer extends SimpleContainer implements IAppContainer {
$this->middleWares[] = $middleWare;
}
/**
* used to return the appname of the set application
* @return string the name of your application
*/
public function getAppName() {
return $this->query('AppName');
}
@ -383,11 +372,6 @@ class DIContainer extends SimpleContainer implements IAppContainer {
return $this->getServer()->getSession()->get('user_id');
}
/**
* Register a capability
*
* @param string $serviceName e.g. 'OCA\Files\Capabilities'
*/
public function registerCapability($serviceName) {
$this->query('OC\CapabilitiesManager')->registerCapability(function () use ($serviceName) {
return $this->query($serviceName);

View file

@ -23,18 +23,10 @@ class Output implements IOutput {
$this->webRoot = $webRoot;
}
/**
* @param string $out
*/
public function setOutput($out) {
print($out);
}
/**
* @param string|resource $path or file handle
*
* @return bool false if an error occurred
*/
public function setReadfile($path) {
if (is_resource($path)) {
$output = fopen('php://output', 'w');
@ -44,36 +36,18 @@ class Output implements IOutput {
}
}
/**
* @param string $header
*/
public function setHeader($header) {
header($header);
}
/**
* @param int $code sets the http status code
*/
public function setHttpResponseCode($code) {
http_response_code($code);
}
/**
* @return int returns the current http response code
*/
public function getHttpResponseCode() {
return http_response_code();
}
/**
* @param string $name
* @param string $value
* @param int $expire
* @param string $path
* @param string $domain
* @param bool $secure
* @param bool $httpOnly
*/
public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax') {
$path = $this->webRoot ? : '/';

View file

@ -250,14 +250,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
throw new \RuntimeException('You cannot change the contents of the request object');
}
/**
* Returns the value for a specific http header.
*
* This method returns an empty string if the header did not exist.
*
* @param string $name
* @return string
*/
public function getHeader(string $name): string {
$name = strtoupper(str_replace('-', '_', $name));
if (isset($this->server['HTTP_' . $name])) {
@ -279,65 +271,28 @@ class Request implements \ArrayAccess, \Countable, IRequest {
return '';
}
/**
* Lets you access post and get parameters by the index
* In case of json requests the encoded json body is accessed
*
* @param string $key the key which you want to access in the URL Parameter
* placeholder, $_POST or $_GET array.
* The priority how they're returned is the following:
* 1. URL parameters
* 2. POST parameters
* 3. GET parameters
* @param mixed $default If the key is not found, this value will be returned
* @return mixed the content of the array
*/
public function getParam(string $key, $default = null) {
return isset($this->parameters[$key])
? $this->parameters[$key]
: $default;
}
/**
* Returns all params that were received, be it from the request
* (as GET or POST) or through the URL by the route
* @return array the array with all parameters
*/
public function getParams(): array {
return is_array($this->parameters) ? $this->parameters : [];
}
/**
* Returns the method of the request
* @return string the method of the request (POST, GET, etc)
*/
public function getMethod(): string {
return $this->method;
}
/**
* Shortcut for accessing an uploaded file through the $_FILES array
* @param string $key the key that will be taken from the $_FILES array
* @return array the file in the $_FILES element
*/
public function getUploadedFile(string $key) {
return isset($this->files[$key]) ? $this->files[$key] : null;
}
/**
* Shortcut for getting env variables
* @param string $key the key that will be taken from the $_ENV array
* @return array the value in the $_ENV element
*/
public function getEnv(string $key) {
return isset($this->env[$key]) ? $this->env[$key] : null;
}
/**
* Shortcut for getting cookie variables
* @param string $key the key that will be taken from the $_COOKIE array
* @return string the value in the $_COOKIE element
*/
public function getCookie(string $key) {
return isset($this->cookies[$key]) ? $this->cookies[$key] : null;
}
@ -414,10 +369,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
}
/**
* Checks if the CSRF check was correct
* @return bool true if CSRF check passed
*/
public function passesCSRFCheck(): bool {
if ($this->csrfTokenManager === null) {
return false;
@ -487,13 +438,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
return $prefix.$name;
}
/**
* Checks if the strict cookie has been sent with the request if the request
* is including any cookies.
*
* @return bool
* @since 9.1.0
*/
public function passesStrictCookieCheck(): bool {
if (!$this->cookieCheckRequired()) {
return true;
@ -507,13 +451,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
return false;
}
/**
* Checks if the lax cookie has been sent with the request if the request
* is including any cookies.
*
* @return bool
* @since 9.1.0
*/
public function passesLaxCookieCheck(): bool {
if (!$this->cookieCheckRequired()) {
return true;
@ -527,11 +464,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
}
/**
* 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
*/
public function getId(): string {
return $this->requestId->getId();
}
@ -552,13 +484,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
}
}
/**
* Returns the remote address, if the connection came from a trusted proxy
* and `forwarded_for_headers` has been configured then the IP address
* specified in this header will be returned instead.
* Do always use this instead of $_SERVER['REMOTE_ADDR']
* @return string IP address
*/
public function getRemoteAddress(): string {
$remoteAddress = isset($this->server['REMOTE_ADDR']) ? $this->server['REMOTE_ADDR'] : '';
$trustedProxies = $this->config->getSystemValue('trusted_proxies', []);
@ -611,11 +536,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
return $regex === '//' || preg_match($regex, $remoteAddr) === 1;
}
/**
* Returns the server protocol. It respects one or more reverse proxies servers
* and load balancers
* @return string Server protocol (http or https)
*/
public function getServerProtocol(): string {
if ($this->config->getSystemValueString('overwriteprotocol') !== ''
&& $this->isOverwriteCondition()) {
@ -645,11 +565,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
return 'http';
}
/**
* Returns the used HTTP protocol.
*
* @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
*/
public function getHttpProtocol(): string {
$claimedProtocol = $this->server['SERVER_PROTOCOL'];
@ -670,11 +585,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
return 'HTTP/1.1';
}
/**
* Returns the request uri, even if the website uses one or more
* reverse proxies
* @return string
*/
public function getRequestUri(): string {
$uri = isset($this->server['REQUEST_URI']) ? $this->server['REQUEST_URI'] : '';
if ($this->config->getSystemValueString('overwritewebroot') !== '' && $this->isOverwriteCondition()) {
@ -683,11 +593,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
return $uri;
}
/**
* Get raw PathInfo from request (not urldecoded)
* @throws \Exception
* @return string Path info
*/
public function getRawPathInfo(): string {
$requestUri = isset($this->server['REQUEST_URI']) ? $this->server['REQUEST_URI'] : '';
// remove too many slashes - can be caused by reverse proxy configuration
@ -728,21 +633,11 @@ class Request implements \ArrayAccess, \Countable, IRequest {
}
}
/**
* Get PathInfo from request
* @throws \Exception
* @return string|false Path info or false when not found
*/
public function getPathInfo() {
$pathInfo = $this->getRawPathInfo();
return \Sabre\HTTP\decodePath($pathInfo);
}
/**
* Returns the script name, even if the website uses one or more
* reverse proxies
* @return string the script name
*/
public function getScriptName(): string {
$name = $this->server['SCRIPT_NAME'];
$overwriteWebRoot = $this->config->getSystemValueString('overwritewebroot');
@ -755,11 +650,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
return $name;
}
/**
* 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
*/
public function isUserAgent(array $agent): bool {
if (!isset($this->server['HTTP_USER_AGENT'])) {
return false;
@ -772,11 +662,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
return false;
}
/**
* Returns the unverified server host from the headers without checking
* whether it is a trusted domain
* @return string Server host
*/
public function getInsecureServerHost(): string {
if ($this->fromTrustedProxy() && $this->getOverwriteHost() !== null) {
return $this->getOverwriteHost();
@ -802,11 +687,6 @@ class Request implements \ArrayAccess, \Countable, IRequest {
}
/**
* 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
*/
public function getServerHost(): string {
// overwritehost is always trusted
$host = $this->getOverwriteHost();

View file

@ -20,11 +20,6 @@ class RequestId implements IRequestId {
$this->secureRandom = $secureRandom;
}
/**
* 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
*/
public function getId(): string {
if (empty($this->requestId)) {
$validChars = ISecureRandom::CHAR_ALPHANUMERIC;

View file

@ -36,72 +36,42 @@ class Logger implements ILogger {
return $context;
}
/**
* @deprecated
*/
public function emergency(string $message, array $context = []) {
$this->logger->emergency($message, $this->extendContext($context));
}
/**
* @deprecated
*/
public function alert(string $message, array $context = []) {
$this->logger->alert($message, $this->extendContext($context));
}
/**
* @deprecated
*/
public function critical(string $message, array $context = []) {
$this->logger->critical($message, $this->extendContext($context));
}
/**
* @deprecated
*/
public function error(string $message, array $context = []) {
$this->logger->emergency($message, $this->extendContext($context));
}
/**
* @deprecated
*/
public function warning(string $message, array $context = []) {
$this->logger->warning($message, $this->extendContext($context));
}
/**
* @deprecated
*/
public function notice(string $message, array $context = []) {
$this->logger->notice($message, $this->extendContext($context));
}
/**
* @deprecated
*/
public function info(string $message, array $context = []) {
$this->logger->info($message, $this->extendContext($context));
}
/**
* @deprecated
*/
public function debug(string $message, array $context = []) {
$this->logger->debug($message, $this->extendContext($context));
}
/**
* @deprecated
*/
public function log(int $level, string $message, array $context = []) {
$this->logger->log($level, $message, $this->extendContext($context));
}
/**
* @deprecated
*/
public function logException(\Throwable $exception, array $context = []) {
$this->logger->logException($exception, $this->extendContext($context));
}

View file

@ -8,11 +8,7 @@ declare(strict_types=1);
*/
namespace OC\AppFramework\Services;
use InvalidArgumentException;
use JsonException;
use OCP\AppFramework\Services\IAppConfig;
use OCP\Exceptions\AppConfigTypeConflictException;
use OCP\Exceptions\AppConfigUnknownKeyException;
use OCP\IConfig;
class AppConfig implements IAppConfig {
@ -24,94 +20,31 @@ class AppConfig implements IAppConfig {
) {
}
/**
* @inheritDoc
*
* @return string[] list of stored config keys
* @since 20.0.0
*/
public function getAppKeys(): array {
return $this->appConfig->getKeys($this->appName);
}
/**
* @inheritDoc
*
* @param string $key config key
* @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config
*
* @return bool TRUE if key exists
* @since 29.0.0
*/
public function hasAppKey(string $key, ?bool $lazy = false): bool {
return $this->appConfig->hasKey($this->appName, $key, $lazy);
}
/**
* @param string $key config key
* @param bool|null $lazy TRUE to search within lazy loaded config, NULL to search within all config
*
* @return bool
* @throws AppConfigUnknownKeyException if config key is not known
* @since 29.0.0
*/
public function isSensitive(string $key, ?bool $lazy = false): bool {
return $this->appConfig->isSensitive($this->appName, $key, $lazy);
}
/**
* @inheritDoc
*
* @param string $key config key
*
* @return bool TRUE if config is lazy loaded
* @throws AppConfigUnknownKeyException if config key is not known
* @see \OCP\IAppConfig for details about lazy loading
* @since 29.0.0
*/
public function isLazy(string $key): bool {
return $this->appConfig->isLazy($this->appName, $key);
}
/**
* @inheritDoc
*
* @param string $key config keys prefix to search
* @param bool $filtered TRUE to hide sensitive config values. Value are replaced by {@see IConfig::SENSITIVE_VALUE}
*
* @return array<string, string|int|float|bool|array> [configKey => configValue]
* @since 29.0.0
*/
public function getAllAppValues(string $key = '', bool $filtered = false): array {
return $this->appConfig->getAllValues($this->appName, $key, $filtered);
}
/**
* @inheritDoc
*
* @param string $key the key of the value, under which will be saved
* @param string $value the value that should be stored
* @since 20.0.0
* @deprecated 29.0.0 use {@see setAppValueString()}
*/
public function setAppValue(string $key, string $value): void {
/** @psalm-suppress InternalMethod */
$this->appConfig->setValueMixed($this->appName, $key, $value);
}
/**
* @inheritDoc
*
* @param string $key config key
* @param string $value config value
* @param bool $lazy set config as lazy loaded
* @param bool $sensitive if TRUE value will be hidden when listing config values.
*
* @return bool TRUE if value was different, therefor updated in database
* @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
* @since 29.0.0
* @see \OCP\IAppConfig for explanation about lazy loading
*/
public function setAppValueString(
string $key,
string $value,
@ -121,19 +54,6 @@ class AppConfig implements IAppConfig {
return $this->appConfig->setValueString($this->appName, $key, $value, $lazy, $sensitive);
}
/**
* @inheritDoc
*
* @param string $key config key
* @param int $value config value
* @param bool $lazy set config as lazy loaded
* @param bool $sensitive if TRUE value will be hidden when listing config values.
*
* @return bool TRUE if value was different, therefor updated in database
* @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
* @since 29.0.0
* @see \OCP\IAppConfig for explanation about lazy loading
*/
public function setAppValueInt(
string $key,
int $value,
@ -143,19 +63,6 @@ class AppConfig implements IAppConfig {
return $this->appConfig->setValueInt($this->appName, $key, $value, $lazy, $sensitive);
}
/**
* @inheritDoc
*
* @param string $key config key
* @param float $value config value
* @param bool $lazy set config as lazy loaded
* @param bool $sensitive if TRUE value will be hidden when listing config values.
*
* @return bool TRUE if value was different, therefor updated in database
* @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
* @since 29.0.0
* @see \OCP\IAppConfig for explanation about lazy loading
*/
public function setAppValueFloat(
string $key,
float $value,
@ -165,18 +72,6 @@ class AppConfig implements IAppConfig {
return $this->appConfig->setValueFloat($this->appName, $key, $value, $lazy, $sensitive);
}
/**
* @inheritDoc
*
* @param string $key config key
* @param bool $value config value
* @param bool $lazy set config as lazy loaded
*
* @return bool TRUE if value was different, therefor updated in database
* @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
* @since 29.0.0
* @see \OCP\IAppConfig for explanation about lazy loading
*/
public function setAppValueBool(
string $key,
bool $value,
@ -185,20 +80,6 @@ class AppConfig implements IAppConfig {
return $this->appConfig->setValueBool($this->appName, $key, $value, $lazy);
}
/**
* @inheritDoc
*
* @param string $key config key
* @param array $value config value
* @param bool $lazy set config as lazy loaded
* @param bool $sensitive if TRUE value will be hidden when listing config values.
*
* @return bool TRUE if value was different, therefor updated in database
* @throws AppConfigTypeConflictException if type from database is not VALUE_MIXED and different from the requested one
* @throws JsonException
* @since 29.0.0
* @see \OCP\IAppConfig for explanation about lazy loading
*/
public function setAppValueArray(
string $key,
array $value,
@ -208,120 +89,36 @@ class AppConfig implements IAppConfig {
return $this->appConfig->setValueArray($this->appName, $key, $value, $lazy, $sensitive);
}
/**
* @param string $key
* @param string $default
*
* @since 20.0.0
* @deprecated 29.0.0 use {@see getAppValueString()}
* @return string
*/
public function getAppValue(string $key, string $default = ''): string {
/** @psalm-suppress InternalMethod */
/** @psalm-suppress UndefinedInterfaceMethod */
return $this->appConfig->getValueMixed($this->appName, $key, $default);
}
/**
* @inheritDoc
*
* @param string $key config key
* @param string $default default value
* @param bool $lazy search within lazy loaded config
*
* @return string stored config value or $default if not set in database
* @throws InvalidArgumentException if one of the argument format is invalid
* @throws AppConfigTypeConflictException in case of conflict with the value type set in database
* @since 29.0.0
* @see \OCP\IAppConfig for explanation about lazy loading
*/
public function getAppValueString(string $key, string $default = '', bool $lazy = false): string {
return $this->appConfig->getValueString($this->appName, $key, $default, $lazy);
}
/**
* @inheritDoc
*
* @param string $key config key
* @param int $default default value
* @param bool $lazy search within lazy loaded config
*
* @return int stored config value or $default if not set in database
* @throws InvalidArgumentException if one of the argument format is invalid
* @throws AppConfigTypeConflictException in case of conflict with the value type set in database
* @since 29.0.0
* @see \OCP\IAppConfig for explanation about lazy loading
*/
public function getAppValueInt(string $key, int $default = 0, bool $lazy = false): int {
return $this->appConfig->getValueInt($this->appName, $key, $default, $lazy);
}
/**
* @inheritDoc
*
* @param string $key config key
* @param float $default default value
* @param bool $lazy search within lazy loaded config
*
* @return float stored config value or $default if not set in database
* @throws InvalidArgumentException if one of the argument format is invalid
* @throws AppConfigTypeConflictException in case of conflict with the value type set in database
* @since 29.0.0
* @see \OCP\IAppConfig for explanation about lazy loading
*/
public function getAppValueFloat(string $key, float $default = 0, bool $lazy = false): float {
return $this->appConfig->getValueFloat($this->appName, $key, $default, $lazy);
}
/**
* @inheritDoc
*
* @param string $key config key
* @param bool $default default value
* @param bool $lazy search within lazy loaded config
*
* @return bool stored config value or $default if not set in database
* @throws InvalidArgumentException if one of the argument format is invalid
* @throws AppConfigTypeConflictException in case of conflict with the value type set in database
* @since 29.0.0
* @see \OCP\IAppConfig for explanation about lazy loading
*/
public function getAppValueBool(string $key, bool $default = false, bool $lazy = false): bool {
return $this->appConfig->getValueBool($this->appName, $key, $default, $lazy);
}
/**
* @inheritDoc
*
* @param string $key config key
* @param array $default default value
* @param bool $lazy search within lazy loaded config
*
* @return array stored config value or $default if not set in database
* @throws InvalidArgumentException if one of the argument format is invalid
* @throws AppConfigTypeConflictException in case of conflict with the value type set in database
* @since 29.0.0
* @see \OCP\IAppConfig for explanation about lazy loading
*/
public function getAppValueArray(string $key, array $default = [], bool $lazy = false): array {
return $this->appConfig->getValueArray($this->appName, $key, $default, $lazy);
}
/**
* @inheritDoc
*
* @param string $key the key of the value, under which it was saved
* @since 20.0.0
*/
public function deleteAppValue(string $key): void {
$this->appConfig->deleteKey($this->appName, $key);
}
/**
* @inheritDoc
*
* @since 20.0.0
*/
public function deleteAppValues(): void {
$this->appConfig->deleteApp($this->appName);
}

View file

@ -19,10 +19,6 @@ class ControllerMethodReflector implements IControllerMethodReflector {
private $parameters = [];
private array $ranges = [];
/**
* @param object $object an object or classname
* @param string $method the method which we want to inspect
*/
public function reflect($object, string $method) {
$reflection = new \ReflectionMethod($object, $method);
$docs = $reflection->getDocComment();
@ -79,13 +75,6 @@ class ControllerMethodReflector implements IControllerMethodReflector {
}
}
/**
* Inspects the PHPDoc parameters for types
* @param string $parameter the parameter whose type comments should be
* parsed
* @return string|null type in the type parameters (@param int $something)
* would return int or null if not existing
*/
public function getType(string $parameter) {
if (array_key_exists($parameter, $this->types)) {
return $this->types[$parameter];
@ -102,18 +91,10 @@ class ControllerMethodReflector implements IControllerMethodReflector {
return null;
}
/**
* @return array the arguments of the method with key => default value
*/
public function getParameters(): array {
return $this->parameters;
}
/**
* Check if a method contains an annotation
* @param string $name the name of the annotation
* @return bool true if the annotation is found
*/
public function hasAnnotation(string $name): bool {
$name = strtolower($name);
return array_key_exists($name, $this->annotations);

View file

@ -30,14 +30,6 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
$this->container = new Container();
}
/**
* @template T
* @param class-string<T>|string $id
* @return T|mixed
* @psalm-template S as class-string<T>|string
* @psalm-param S $id
* @psalm-return (S is class-string<T> ? T : mixed)
*/
public function get(string $id): mixed {
return $this->query($id);
}
@ -131,23 +123,10 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
throw new QueryNotFoundException('Could not resolve ' . $name . '!');
}
/**
* @param string $name
* @param mixed $value
*/
public function registerParameter($name, $value) {
$this[$name] = $value;
}
/**
* The given closure is call the first time the given service is queried.
* The closure has to return the instance for the given service.
* Created instance will be cached in case $shared is true.
*
* @param string $name name of the service to register another backend for
* @param Closure $closure the closure to be called on service creation
* @param bool $shared
*/
public function registerService($name, Closure $closure, $shared = true) {
$wrapped = function () use ($closure) {
return $closure($this);
@ -163,13 +142,6 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
}
}
/**
* Shortcut for returning a service from a service under a different key,
* e.g. to tell the container to return a class when queried for an
* interface
* @param string $alias the alias that should be registered
* @param string $target the target that should be resolved instead
*/
public function registerAlias($alias, $target) {
$this->registerService($alias, function (ContainerInterface $container) use ($target) {
return $container->get($target);

View file

@ -24,22 +24,10 @@ class TimeFactory implements ITimeFactory {
$this->timezone = new \DateTimeZone('UTC');
}
/**
* @return int the result of a call to time()
* @since 8.0.0
* @deprecated 26.0.0 {@see ITimeFactory::now()}
*/
public function getTime(): int {
return time();
}
/**
* @param string $time
* @param \DateTimeZone $timezone
* @return \DateTime
* @since 15.0.0
* @deprecated 26.0.0 {@see ITimeFactory::now()}
*/
public function getDateTime(string $time = 'now', ?\DateTimeZone $timezone = null): \DateTime {
return new \DateTime($time, $timezone);
}

View file

@ -48,9 +48,6 @@ class RemoteWipeEmailListener implements IEventListener {
$this->logger = $logger;
}
/**
* @param Event $event
*/
public function handle(Event $event): void {
if ($event instanceof RemoteWipeStarted) {
$uid = $event->getToken()->getUID();

View file

@ -28,23 +28,14 @@ class Credentials implements ICredentials {
$this->password = $password;
}
/**
* @return string
*/
public function getUID() {
return $this->uid;
}
/**
* @return string
*/
public function getLoginName() {
return $this->loginName;
}
/**
* @return string
*/
public function getPassword() {
return $this->password;
}

View file

@ -57,12 +57,6 @@ class Store implements IStore {
$this->session = $session;
}
/**
* @since 12
*
* @return ICredentials the login credentials of the current user
* @throws CredentialsUnavailableException
*/
public function getLoginCredentials(): ICredentials {
if ($this->tokenProvider === null) {
throw new CredentialsUnavailableException();

View file

@ -21,9 +21,6 @@ class Notifier implements INotifier {
$this->factory = $l10nFactory;
}
/**
* @inheritDoc
*/
public function prepare(INotification $notification, string $languageCode): INotification {
if ($notification->getApp() !== 'auth') {
// Not my app => throw
@ -56,22 +53,10 @@ class Notifier implements INotifier {
}
}
/**
* Identifier of the notifier, only use [a-z0-9_]
*
* @return string
* @since 17.0.0
*/
public function getID(): string {
return 'auth';
}
/**
* Human readable name describing the notifier
*
* @return string
* @since 17.0.0
*/
public function getName(): string {
return $this->factory->get('lib')->t('Authentication');
}

View file

@ -105,14 +105,6 @@ class Manager implements IProvider, OCPIProvider {
return $this->publicKeyTokenProvider->getTokenByUser($uid);
}
/**
* Get a token by token
*
* @param string $tokenId
* @throws InvalidTokenException
* @throws \RuntimeException when OpenSSL reports a problem
* @return OCPIToken
*/
public function getToken(string $tokenId): OCPIToken {
try {
return $this->publicKeyTokenProvider->getToken($tokenId);

View file

@ -58,9 +58,6 @@ abstract class Avatar implements IAvatar {
return implode('', $firstTwoLetters);
}
/**
* @inheritdoc
*/
public function get(int $size = 64, bool $darkTheme = false) {
try {
$file = $this->getFile($size, $darkTheme);
@ -227,9 +224,6 @@ abstract class Avatar implements IAvatar {
return intval($final % $maximum);
}
/**
* @return Color Object containing r g b int in the range [0, 255]
*/
public function avatarBackgroundColor(string $hash): Color {
// Normalize hash
$hash = strtolower($hash);

View file

@ -40,16 +40,6 @@ class AvatarManager implements IAvatarManager {
) {
}
/**
* return a user specific instance of \OCP\IAvatar
*
* If the user is disabled a guest avatar will be returned
*
* @see \OCP\IAvatar
* @param string $userId the ownCloud user id
* @throws \Exception In case the username is potentially dangerous
* @throws NotFoundException In case there is no user folder yet
*/
public function getAvatar(string $userId): IAvatar {
$user = $this->userManager->get($userId);
if ($user === null) {
@ -123,11 +113,6 @@ class AvatarManager implements IAvatarManager {
$this->config->deleteUserValue($userId, 'avatar', 'generated');
}
/**
* Returns a GuestAvatar.
*
* @param string $name The guest name, e.g. "Albert".
*/
public function getGuestAvatar(string $name): IAvatar {
return new GuestAvatar($name, $this->logger);
}

View file

@ -68,10 +68,6 @@ class JobList implements IJobList {
$this->add($job, $argument, $runAfter);
}
/**
* @param IJob|string $job
* @param mixed $argument
*/
public function remove($job, $argument = null): void {
$class = ($job instanceof IJob) ? get_class($job) : $job;
@ -107,12 +103,6 @@ class JobList implements IJobList {
$query->executeStatement();
}
/**
* check if a job is in the list
*
* @param IJob|class-string<IJob> $job
* @param mixed $argument
*/
public function has($job, $argument): bool {
$class = ($job instanceof IJob) ? get_class($job) : $job;
$argument = json_encode($argument);
@ -138,10 +128,6 @@ class JobList implements IJobList {
: iterator_to_array($iterable);
}
/**
* @param IJob|class-string<IJob>|null $job
* @return iterable<IJob> Avoid to store these objects as they may share a Singleton instance. You should instead use these IJobs instances while looping on the iterable.
*/
public function getJobsIterator($job, ?int $limit, int $offset): iterable {
$query = $this->connection->getQueryBuilder();
$query->select('*')
@ -165,9 +151,6 @@ class JobList implements IJobList {
$result->closeCursor();
}
/**
* @inheritDoc
*/
public function getNext(bool $onlyTimeSensitive = false, ?array $jobClasses = null): ?IJob {
$query = $this->connection->getQueryBuilder();
$query->select('*')
@ -245,9 +228,6 @@ class JobList implements IJobList {
}
}
/**
* @return ?IJob The job matching the id. Beware that this object may be a singleton and may be modified by the next call to buildJob.
*/
public function getById(int $id): ?IJob {
$row = $this->getDetailsById($id);
@ -311,17 +291,11 @@ class JobList implements IJobList {
}
}
/**
* set the job that was last ran
*/
public function setLastJob(IJob $job): void {
$this->unlockJob($job);
$this->config->setAppValue('backgroundjob', 'lastjob', (string)$job->getId());
}
/**
* Remove the reservation for a job
*/
public function unlockJob(IJob $job): void {
$query = $this->connection->getQueryBuilder();
$query->update('jobs')
@ -330,9 +304,6 @@ class JobList implements IJobList {
$query->executeStatement();
}
/**
* set the lastRun of $job to now
*/
public function setLastRun(IJob $job): void {
$query = $this->connection->getQueryBuilder();
$query->update('jobs')
@ -347,9 +318,6 @@ class JobList implements IJobList {
$query->executeStatement();
}
/**
* @param int $timeTaken
*/
public function setExecutionTime(IJob $job, $timeTaken): void {
$query = $this->connection->getQueryBuilder();
$query->update('jobs')
@ -359,11 +327,6 @@ class JobList implements IJobList {
$query->executeStatement();
}
/**
* Reset the $job so it executes on the next trigger
*
* @since 23.0.0
*/
public function resetBackgroundJob(IJob $job): void {
$query = $this->connection->getQueryBuilder();
$query->update('jobs')

View file

@ -23,11 +23,6 @@ class BinaryFinder implements IBinaryFinder {
$this->cache = $cacheFactory->createLocal('findBinaryPath');
}
/**
* Try to find a program
*
* @return false|string
*/
public function findBinaryPath(string $program) {
$result = $this->cache->get($program);
if ($result !== null) {

View file

@ -32,11 +32,6 @@ class GenerateBlurhashMetadata implements IEventListener {
private const COMPONENTS_X = 4;
private const COMPONENTS_Y = 3;
/**
* @throws NotPermittedException
* @throws GenericFileException
* @throws LockedException
*/
public function handle(Event $event): void {
if (!($event instanceof MetadataLiveEvent)
&& !($event instanceof MetadataBackgroundEvent)) {

View file

@ -29,19 +29,10 @@ class CappedMemoryCache implements ICache, \ArrayAccess {
return isset($this->cache[$key]);
}
/**
* @return ?T
*/
public function get($key) {
return $this->cache[$key] ?? null;
}
/**
* @param string $key
* @param T $value
* @param int $ttl
* @return bool
*/
public function set($key, $value, $ttl = 0): bool {
if (is_null($key)) {
$this->cache[] = $value;

View file

@ -43,11 +43,6 @@ class File implements ICache {
}
}
/**
* @param string $key
* @return mixed|null
* @throws \OC\ForbiddenException
*/
public function get($key) {
$result = null;
if ($this->hasKey($key)) {
@ -72,13 +67,6 @@ class File implements ICache {
return $result;
}
/**
* @param string $key
* @param mixed $value
* @param int $ttl
* @return bool|mixed
* @throws \OC\ForbiddenException
*/
public function set($key, $value, $ttl = 0) {
$storage = $this->getStorage();
$result = false;
@ -101,11 +89,6 @@ class File implements ICache {
return $result;
}
/**
* @param string $key
* @return bool
* @throws \OC\ForbiddenException
*/
public function hasKey($key) {
$storage = $this->getStorage();
if ($storage && $storage->is_file($key) && $storage->isReadable($key)) {
@ -114,11 +97,6 @@ class File implements ICache {
return false;
}
/**
* @param string $key
* @return bool|mixed
* @throws \OC\ForbiddenException
*/
public function remove($key) {
$storage = $this->getStorage();
if (!$storage) {
@ -127,11 +105,6 @@ class File implements ICache {
return $storage->unlink($key);
}
/**
* @param string $prefix
* @return bool
* @throws \OC\ForbiddenException
*/
public function clear($prefix = '') {
$storage = $this->getStorage();
if ($storage and $storage->is_dir('/')) {

View file

@ -14,7 +14,6 @@ use OCP\Calendar\Exceptions\CalendarException;
use OCP\Calendar\ICalendar;
use OCP\Calendar\ICalendarProvider;
use OCP\Calendar\ICalendarQuery;
use OCP\Calendar\ICreateFromString;
use OCP\Calendar\IHandleImipMessage;
use OCP\Calendar\IManager;
use Psr\Container\ContainerInterface;
@ -46,19 +45,6 @@ class Manager implements IManager {
) {
}
/**
* This function is used to search and find objects within the user's calendars.
* In case $pattern is empty all events/journals/todos will be returned.
*
* @param string $pattern which should match within the $searchProperties
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options - optional parameters:
* ['timerange' => ['start' => new DateTime(...), 'end' => new DateTime(...)]]
* @param integer|null $limit - limit number of search results
* @param integer|null $offset - offset for paging of search results
* @return array an array of events/journals/todos which are arrays of arrays of key-value-pairs
* @since 13.0.0
*/
public function search(
$pattern,
array $searchProperties = [],
@ -79,60 +65,28 @@ class Manager implements IManager {
return $result;
}
/**
* Check if calendars are available
*
* @return bool true if enabled, false if not
* @since 13.0.0
*/
public function isEnabled(): bool {
return !empty($this->calendars) || !empty($this->calendarLoaders);
}
/**
* Registers a calendar
*
* @since 13.0.0
*/
public function registerCalendar(ICalendar $calendar): void {
$this->calendars[$calendar->getKey()] = $calendar;
}
/**
* Unregisters a calendar
*
* @since 13.0.0
*/
public function unregisterCalendar(ICalendar $calendar): void {
unset($this->calendars[$calendar->getKey()]);
}
/**
* In order to improve lazy loading a closure can be registered which will be called in case
* calendars are actually requested
*
* @since 13.0.0
*/
public function register(\Closure $callable): void {
$this->calendarLoaders[] = $callable;
}
/**
* @return ICalendar[]
*
* @since 13.0.0
*/
public function getCalendars(): array {
$this->loadCalendars();
return array_values($this->calendars);
}
/**
* removes all registered calendar instances
*
* @since 13.0.0
*/
public function clear(): void {
$this->calendars = [];
$this->calendarLoaders = [];
@ -148,9 +102,6 @@ class Manager implements IManager {
$this->calendarLoaders = [];
}
/**
* @return ICreateFromString[]
*/
public function getCalendarsForPrincipal(string $principalUri, array $calendarUris = []): array {
$context = $this->coordinator->getRegistrationContext();
if ($context === null) {
@ -204,9 +155,6 @@ class Manager implements IManager {
return new CalendarQuery($principalUri);
}
/**
* @throws \OCP\DB\Exception
*/
public function handleIMipReply(
string $principalUri,
string $sender,
@ -286,10 +234,6 @@ class Manager implements IManager {
return true;
}
/**
* @since 25.0.0
* @throws \OCP\DB\Exception
*/
public function handleIMipCancel(
string $principalUri,
string $sender,

View file

@ -33,20 +33,10 @@ class Manager implements IManager {
) {
}
/**
* Registers a resource backend
*
* @since 14.0.0
*/
public function registerBackend(string $backendClass): void {
$this->backends[$backendClass] = $backendClass;
}
/**
* Unregisters a resource backend
*
* @since 14.0.0
*/
public function unregisterBackend(string $backendClass): void {
unset($this->backends[$backendClass], $this->initializedBackends[$backendClass]);
}
@ -67,11 +57,6 @@ class Manager implements IManager {
}
}
/**
* @return IBackend[]
* @throws \OCP\AppFramework\QueryException
* @since 14.0.0
*/
public function getBackends():array {
$this->fetchBootstrapBackends();
@ -86,10 +71,6 @@ class Manager implements IManager {
return array_values($this->initializedBackends);
}
/**
* @param string $backendId
* @throws \OCP\AppFramework\QueryException
*/
public function getBackend($backendId): ?IBackend {
$backends = $this->getBackends();
foreach ($backends as $backend) {
@ -101,11 +82,6 @@ class Manager implements IManager {
return null;
}
/**
* removes all registered backend instances
*
* @since 14.0.0
*/
public function clear(): void {
$this->backends = [];
$this->initializedBackends = [];

View file

@ -33,21 +33,10 @@ class Manager implements IManager {
) {
}
/**
* Registers a resource backend
*
* @since 14.0.0
*/
public function registerBackend(string $backendClass): void {
$this->backends[$backendClass] = $backendClass;
}
/**
* Unregisters a resource backend
*
* @param string $backendClass
* @since 14.0.0
*/
public function unregisterBackend(string $backendClass): void {
unset($this->backends[$backendClass], $this->initializedBackends[$backendClass]);
}
@ -68,11 +57,6 @@ class Manager implements IManager {
}
}
/**
* @return IBackend[]
* @throws \OCP\AppFramework\QueryException
* @since 14.0.0
*/
public function getBackends():array {
$this->fetchBootstrapBackends();
@ -93,10 +77,6 @@ class Manager implements IManager {
return array_values($this->initializedBackends);
}
/**
* @param string $backendId
* @throws \OCP\AppFramework\QueryException
*/
public function getBackend($backendId): ?IBackend {
$backends = $this->getBackends();
foreach ($backends as $backend) {
@ -108,11 +88,6 @@ class Manager implements IManager {
return null;
}
/**
* removes all registered backend instances
*
* @since 14.0.0
*/
public function clear(): void {
$this->backends = [];
$this->initializedBackends = [];

View file

@ -54,9 +54,6 @@ class MailPlugin implements ISearchPlugin {
}
}
/**
* {@inheritdoc}
*/
public function search($search, $limit, $offset, ISearchResult $searchResult): bool {
if ($this->shareeEnumerationFullMatch && !$this->shareeEnumerationFullMatchEmail) {
return false;

View file

@ -20,13 +20,6 @@ class Search implements ISearch {
) {
}
/**
* @param string $search
* @param bool $lookup
* @param int|null $limit
* @param int|null $offset
* @throws \OCP\AppFramework\QueryException
*/
public function search($search, array $shareTypes, $lookup, $limit, $offset): array {
$hasMoreResults = false;

View file

@ -31,9 +31,6 @@ class FileReferenceEventListener implements IEventListener {
$eventDispatcher->addServiceListener(ShareCreatedEvent::class, FileReferenceEventListener::class);
}
/**
* @inheritDoc
*/
public function handle(Event $event): void {
if ($event instanceof NodeDeletedEvent) {
if ($event->getNode() instanceof NonExistingFolder || $event->getNode() instanceof NonExistingFile) {

View file

@ -44,11 +44,6 @@ class ReferenceManager implements IReferenceManager {
$this->cache = $cacheFactory->createDistributed('reference');
}
/**
* Extract a list of URLs from a text
*
* @return string[]
*/
public function extractReferences(string $text): array {
preg_match_all(IURLGenerator::URL_REGEX, $text, $matches);
$references = $matches[0] ?? [];
@ -57,9 +52,6 @@ class ReferenceManager implements IReferenceManager {
}, $references);
}
/**
* Try to get a cached reference object from a reference string
*/
public function getReferenceFromCache(string $referenceId, bool $public = false, string $sharingToken = ''): ?IReference {
$matchedProvider = $this->getMatchedProvider($referenceId, $public);
@ -71,9 +63,6 @@ class ReferenceManager implements IReferenceManager {
return $this->getReferenceByCacheKey($cacheKey);
}
/**
* Try to get a cached reference object from a full cache key
*/
public function getReferenceByCacheKey(string $cacheKey): ?IReference {
$cached = $this->cache->get($cacheKey);
if ($cached) {
@ -83,10 +72,6 @@ class ReferenceManager implements IReferenceManager {
return null;
}
/**
* Get a reference object from a reference string with a matching provider
* Use a cached reference if possible
*/
public function resolveReference(string $referenceId, bool $public = false, $sharingToken = ''): ?IReference {
$matchedProvider = $this->getMatchedProvider($referenceId, $public);
@ -159,9 +144,6 @@ class ReferenceManager implements IReferenceManager {
);
}
/**
* Remove a specific cache entry from its key+prefix
*/
public function invalidateCache(string $cachePrefix, ?string $cacheKey = null): void {
if ($cacheKey === null) {
// clear might be a heavy operation, so we only do it if there have actually been keys set
@ -205,9 +187,6 @@ class ReferenceManager implements IReferenceManager {
return $this->providers;
}
/**
* @inheritDoc
*/
public function getDiscoverableProviders(): array {
// preserve 0 based index to avoid returning an object in data responses
return array_values(
@ -217,9 +196,6 @@ class ReferenceManager implements IReferenceManager {
);
}
/**
* @inheritDoc
*/
public function touchProvider(string $userId, string $providerId, ?int $timestamp = null): bool {
$providers = $this->getDiscoverableProviders();
$matchingProviders = array_filter($providers, static function (IDiscoverableReferenceProvider $provider) use ($providerId) {
@ -237,9 +213,6 @@ class ReferenceManager implements IReferenceManager {
return false;
}
/**
* @inheritDoc
*/
public function getUserProviderTimestamps(): array {
$user = $this->userSession->getUser();
if ($user === null) {

View file

@ -28,9 +28,6 @@ class RenderReferenceEventListener implements IEventListener {
$eventDispatcher->addServiceListener(RenderReferenceEvent::class, RenderReferenceEventListener::class);
}
/**
* @inheritDoc
*/
public function handle(Event $event): void {
if (!($event instanceof RenderReferenceEvent)) {
return;

View file

@ -32,23 +32,14 @@ class Collection implements ICollection {
) {
}
/**
* @since 16.0.0
*/
public function getId(): int {
return $this->id;
}
/**
* @since 16.0.0
*/
public function getName(): string {
return $this->name;
}
/**
* @since 16.0.0
*/
public function setName(string $name): void {
$query = $this->connection->getQueryBuilder();
$query->update(Manager::TABLE_COLLECTIONS)
@ -59,10 +50,6 @@ class Collection implements ICollection {
$this->name = $name;
}
/**
* @return IResource[]
* @since 16.0.0
*/
public function getResources(): array {
if (empty($this->resources)) {
$this->resources = $this->manager->getResourcesByCollectionForUser($this, $this->userForAccess);
@ -71,12 +58,6 @@ class Collection implements ICollection {
return $this->resources;
}
/**
* Adds a resource to a collection
*
* @throws ResourceException when the resource is already part of the collection
* @since 16.0.0
*/
public function addResource(IResource $resource): void {
array_map(function (IResource $r) use ($resource) {
if ($this->isSameResource($r, $resource)) {
@ -103,11 +84,6 @@ class Collection implements ICollection {
$this->manager->invalidateAccessCacheForCollection($this);
}
/**
* Removes a resource from a collection
*
* @since 16.0.0
*/
public function removeResource(IResource $resource): void {
$this->resources = array_filter($this->getResources(), function (IResource $r) use ($resource) {
return !$this->isSameResource($r, $resource);
@ -127,11 +103,6 @@ class Collection implements ICollection {
}
}
/**
* Can a user/guest access the collection
*
* @since 16.0.0
*/
public function canAccess(?IUser $user): bool {
if ($user instanceof IUser) {
return $this->canUserAccess($user);

View file

@ -36,10 +36,6 @@ class Manager implements IManager {
) {
}
/**
* @throws CollectionException when the collection could not be found
* @since 16.0.0
*/
public function getCollection(int $id): ICollection {
$query = $this->connection->getQueryBuilder();
$query->select('*')
@ -56,10 +52,6 @@ class Manager implements IManager {
return new Collection($this, $this->connection, (int)$row['id'], (string)$row['name']);
}
/**
* @throws CollectionException when the collection could not be found
* @since 16.0.0
*/
public function getCollectionForUser(int $id, ?IUser $user): ICollection {
$query = $this->connection->getQueryBuilder();
$userId = $user instanceof IUser ? $user->getUID() : '';
@ -137,9 +129,6 @@ class Manager implements IManager {
return $collections;
}
/**
* @since 16.0.0
*/
public function newCollection(string $name): ICollection {
$query = $this->connection->getQueryBuilder();
$query->insert(self::TABLE_COLLECTIONS)
@ -151,17 +140,10 @@ class Manager implements IManager {
return new Collection($this, $this->connection, $query->getLastInsertId(), $name);
}
/**
* @since 16.0.0
*/
public function createResource(string $type, string $id): IResource {
return new Resource($this, $this->connection, $type, $id);
}
/**
* @throws ResourceException
* @since 16.0.0
*/
public function getResourceForUser(string $type, string $id, ?IUser $user): IResource {
$query = $this->connection->getQueryBuilder();
$userId = $user instanceof IUser ? $user->getUID() : '';
@ -225,11 +207,6 @@ class Manager implements IManager {
return $resources;
}
/**
* Get the rich object data of a resource
*
* @since 16.0.0
*/
public function getResourceRichObject(IResource $resource): array {
foreach ($this->providerManager->getResourceProviders() as $provider) {
if ($provider->getType() === $resource->getType()) {
@ -243,11 +220,6 @@ class Manager implements IManager {
return [];
}
/**
* Can a user/guest access the collection
*
* @since 16.0.0
*/
public function canAccessResource(IResource $resource, ?IUser $user): bool {
$access = $this->checkAccessCacheForUserByResource($resource, $user);
if (\is_bool($access)) {
@ -271,11 +243,6 @@ class Manager implements IManager {
return $access;
}
/**
* Can a user/guest access the collection
*
* @since 16.0.0
*/
public function canAccessCollection(ICollection $collection, ?IUser $user): bool {
$access = $this->checkAccessCacheForUserByCollection($collection, $user);
if (\is_bool($access)) {
@ -456,11 +423,6 @@ class Manager implements IManager {
$this->providerManager->registerResourceProvider($provider);
}
/**
* Get the resource type of the provider
*
* @since 16.0.0
*/
public function getType(): string {
return '';
}

View file

@ -8,7 +8,6 @@ declare(strict_types=1);
*/
namespace OC\Collaboration\Resources;
use OCP\Collaboration\Resources\ICollection;
use OCP\Collaboration\Resources\IManager;
use OCP\Collaboration\Resources\IResource;
use OCP\IDBConnection;
@ -27,23 +26,14 @@ class Resource implements IResource {
) {
}
/**
* @since 16.0.0
*/
public function getType(): string {
return $this->type;
}
/**
* @since 16.0.0
*/
public function getId(): string {
return $this->id;
}
/**
* @since 16.0.0
*/
public function getRichObject(): array {
if ($this->data === null) {
$this->data = $this->manager->getResourceRichObject($this);
@ -52,11 +42,6 @@ class Resource implements IResource {
return $this->data;
}
/**
* Can a user/guest access the resource
*
* @since 16.0.0
*/
public function canAccess(?IUser $user): bool {
if ($user instanceof IUser) {
return $this->canUserAccess($user);
@ -88,10 +73,6 @@ class Resource implements IResource {
return $access;
}
/**
* @return ICollection[]
* @since 16.0.0
*/
public function getCollections(): array {
$collections = [];

View file

@ -21,11 +21,6 @@ abstract class AsyncBus implements IBus {
*/
private $syncTraits = [];
/**
* Schedule a command to be fired
*
* @param \OCP\Command\ICommand | callable $command
*/
public function push($command) {
if ($this->canRunAsync($command)) {
$this->queueCommand($command);
@ -41,11 +36,6 @@ abstract class AsyncBus implements IBus {
*/
abstract protected function queueCommand($command);
/**
* Require all commands using a trait to be run synchronous
*
* @param string $trait
*/
public function requireSync($trait) {
$this->syncTraits[] = trim($trait, '\\');
}

View file

@ -16,20 +16,10 @@ class QueueBus implements IBus {
*/
private $queue = [];
/**
* Schedule a command to be fired
*
* @param \OCP\Command\ICommand | callable $command
*/
public function push($command) {
$this->queue[] = $command;
}
/**
* Require all commands using a trait to be run synchronous
*
* @param string $trait
*/
public function requireSync($trait) {
}

View file

@ -43,32 +43,10 @@ class Comment implements IComment {
}
}
/**
* Returns the ID of the comment
*
* It may return an empty string, if the comment was not stored.
* It is expected that the concrete Comment implementation gives an ID
* by itself (e.g. after saving).
*
* @since 9.0.0
*/
public function getId(): string {
return $this->data['id'];
}
/**
* Sets the ID of the comment and returns itself
*
* It is only allowed to set the ID only, if the current id is an empty
* string (which means it is not stored in a database, storage or whatever
* the concrete implementation does), or vice versa. Changing a given ID is
* not permitted and must result in an IllegalIDChangeException.
*
* @param string $id
* @return IComment
* @throws IllegalIDChangeException
* @since 9.0.0
*/
public function setId($id): IComment {
if (!is_string($id)) {
throw new \InvalidArgumentException('String expected.');
@ -83,21 +61,10 @@ class Comment implements IComment {
throw new IllegalIDChangeException('Not allowed to assign a new ID to an already saved comment.');
}
/**
* Returns the parent ID of the comment
*
* @since 9.0.0
*/
public function getParentId(): string {
return $this->data['parentId'];
}
/**
* Sets the parent ID and returns itself
*
* @param string $parentId
* @since 9.0.0
*/
public function setParentId($parentId): IComment {
if (!is_string($parentId)) {
throw new \InvalidArgumentException('String expected.');
@ -106,22 +73,11 @@ class Comment implements IComment {
return $this;
}
/**
* Returns the topmost parent ID of the comment
*
* @since 9.0.0
*/
public function getTopmostParentId(): string {
return $this->data['topmostParentId'];
}
/**
* Sets the topmost parent ID and returns itself
*
* @param string $id
* @since 9.0.0
*/
public function setTopmostParentId($id): IComment {
if (!is_string($id)) {
throw new \InvalidArgumentException('String expected.');
@ -130,21 +86,10 @@ class Comment implements IComment {
return $this;
}
/**
* Returns the number of children
*
* @since 9.0.0
*/
public function getChildrenCount(): int {
return $this->data['childrenCount'];
}
/**
* Sets the number of children
*
* @param int $count
* @since 9.0.0
*/
public function setChildrenCount($count): IComment {
if (!is_int($count)) {
throw new \InvalidArgumentException('Integer expected.');
@ -153,22 +98,10 @@ class Comment implements IComment {
return $this;
}
/**
* Returns the message of the comment
* @since 9.0.0
*/
public function getMessage(): string {
return $this->data['message'];
}
/**
* sets the message of the comment and returns itself
*
* @param string $message
* @param int $maxLength
* @throws MessageTooLongException
* @since 9.0.0
*/
public function setMessage($message, $maxLength = self::MAX_MESSAGE_LENGTH): IComment {
if (!is_string($message)) {
throw new \InvalidArgumentException('String expected.');
@ -181,26 +114,6 @@ class Comment implements IComment {
return $this;
}
/**
* returns an array containing mentions that are included in the comment
*
* @return array each mention provides a 'type' and an 'id', see example below
* @since 11.0.0
*
* The return array looks like:
* [
* [
* 'type' => 'user',
* 'id' => 'citizen4'
* ],
* [
* 'type' => 'group',
* 'id' => 'media'
* ],
*
* ]
*
*/
public function getMentions(): array {
$ok = preg_match_all("/\B(?<![^a-z0-9_\-@\.\'\s])@(\"guest\/[a-f0-9]+\"|\"(?:federated_)?(?:group|team|user){1}\/[a-z0-9_\-@\.\' \/:]+\"|\"[a-z0-9_\-@\.\' ]+\"|[a-z0-9_\-@\.\']+)/i", $this->getMessage(), $mentions);
if (!$ok || !isset($mentions[0])) {
@ -234,21 +147,10 @@ class Comment implements IComment {
return $result;
}
/**
* Returns the verb of the comment
*
* @since 9.0.0
*/
public function getVerb(): string {
return $this->data['verb'];
}
/**
* Sets the verb of the comment, e.g. 'comment' or 'like'
*
* @param string $verb
* @since 9.0.0
*/
public function setVerb($verb): IComment {
if (!is_string($verb) || !trim($verb)) {
throw new \InvalidArgumentException('Non-empty String expected.');
@ -257,29 +159,14 @@ class Comment implements IComment {
return $this;
}
/**
* Returns the actor type
* @since 9.0.0
*/
public function getActorType(): string {
return $this->data['actorType'];
}
/**
* Returns the actor ID
* @since 9.0.0
*/
public function getActorId(): string {
return $this->data['actorId'];
}
/**
* Sets (overwrites) the actor type and id
*
* @param string $actorType e.g. 'users'
* @param string $actorId e.g. 'zombie234'
* @since 9.0.0
*/
public function setActor($actorType, $actorId): IComment {
if (
!is_string($actorType) || !trim($actorType)
@ -292,13 +179,6 @@ class Comment implements IComment {
return $this;
}
/**
* Returns the creation date of the comment.
*
* If not explicitly set, it shall default to the time of initialization.
* @since 9.0.0
* @throw \LogicException if creation date time is not set yet
*/
public function getCreationDateTime(): \DateTime {
if (!isset($this->data['creationDT'])) {
throw new \LogicException('Cannot get creation date before setting one or writting to database');
@ -306,54 +186,28 @@ class Comment implements IComment {
return $this->data['creationDT'];
}
/**
* Sets the creation date of the comment and returns itself
* @since 9.0.0
*/
public function setCreationDateTime(\DateTime $dateTime): IComment {
$this->data['creationDT'] = $dateTime;
return $this;
}
/**
* Returns the DateTime of the most recent child, if set, otherwise null
* @since 9.0.0
*/
public function getLatestChildDateTime(): ?\DateTime {
return $this->data['latestChildDT'];
}
/**
* @inheritDoc
*/
public function setLatestChildDateTime(?\DateTime $dateTime = null): IComment {
$this->data['latestChildDT'] = $dateTime;
return $this;
}
/**
* Returns the object type the comment is attached to
* @since 9.0.0
*/
public function getObjectType(): string {
return $this->data['objectType'];
}
/**
* Returns the object id the comment is attached to
* @since 9.0.0
*/
public function getObjectId(): string {
return $this->data['objectId'];
}
/**
* Sets (overwrites) the object of the comment
*
* @param string $objectType e.g. 'files'
* @param string $objectId e.g. '16435'
* @since 9.0.0
*/
public function setObject($objectType, $objectId): IComment {
if (
!is_string($objectType) || !trim($objectType)
@ -366,20 +220,10 @@ class Comment implements IComment {
return $this;
}
/**
* Returns the reference id of the comment
* @since 19.0.0
*/
public function getReferenceId(): ?string {
return $this->data['referenceId'];
}
/**
* Sets (overwrites) the reference id of the comment
*
* @param string $referenceId e.g. sha256 hash sum
* @since 19.0.0
*/
public function setReferenceId(?string $referenceId): IComment {
if ($referenceId === null) {
$this->data['referenceId'] = $referenceId;
@ -393,9 +237,6 @@ class Comment implements IComment {
return $this;
}
/**
* @inheritDoc
*/
public function getMetaData(): ?array {
if ($this->data['metaData'] === null) {
return null;
@ -409,9 +250,6 @@ class Comment implements IComment {
return is_array($metaData) ? $metaData : null;
}
/**
* @inheritDoc
*/
public function setMetaData(?array $metaData): IComment {
if ($metaData === null) {
$this->data['metaData'] = null;
@ -421,32 +259,20 @@ class Comment implements IComment {
return $this;
}
/**
* @inheritDoc
*/
public function getReactions(): array {
return $this->data['reactions'] ?? [];
}
/**
* @inheritDoc
*/
public function setReactions(?array $reactions): IComment {
$this->data['reactions'] = $reactions;
return $this;
}
/**
* @inheritDoc
*/
public function setExpireDate(?\DateTime $dateTime): IComment {
$this->data['expire_date'] = $dateTime;
return $this;
}
/**
* @inheritDoc
*/
public function getExpireDate(): ?\DateTime {
return $this->data['expire_date'];
}

View file

@ -8,7 +8,6 @@
namespace OC\Comments;
use Doctrine\DBAL\Exception\DriverException;
use OCA\DAV\Connector\Sabre\File;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Comments\CommentsEvent;
use OCP\Comments\IComment;
@ -228,14 +227,6 @@ class Manager implements ICommentsManager {
}
}
/**
* returns a comment instance
*
* @param string $id the ID of the comment
* @throws NotFoundException
* @throws \InvalidArgumentException
* @since 9.0.0
*/
public function get($id): IComment {
if ((int)$id === 0) {
throw new \InvalidArgumentException('IDs must be translatable to a number in this implementation.');
@ -264,9 +255,6 @@ class Manager implements ICommentsManager {
return $comment;
}
/**
* @inheritDoc
*/
public function getTree($id, $limit = 0, $offset = 0): array {
$tree = [];
$tree['comment'] = $this->get($id);
@ -300,21 +288,6 @@ class Manager implements ICommentsManager {
return $tree;
}
/**
* returns comments for a specific object (e.g. a file).
*
* The sort order is always newest to oldest.
*
* @param string $objectType the object type, e.g. 'files'
* @param string $objectId the id of the object
* @param int $limit optional, number of maximum comments to be returned. if
* not specified, all comments are returned.
* @param int $offset optional, starting point
* @param \DateTime $notOlderThan optional, timestamp of the oldest comments
* that may be returned
* @return list<IComment>
* @since 9.0.0
*/
public function getForObject(
$objectType,
$objectId,
@ -356,16 +329,6 @@ class Manager implements ICommentsManager {
return $comments;
}
/**
* @param string $objectType the object type, e.g. 'files'
* @param string $objectId the id of the object
* @param int $lastKnownCommentId the last known comment (will be used as offset)
* @param string $sortDirection direction of the comments (`asc` or `desc`)
* @param int $limit optional, number of maximum comments to be returned. if
* set to 0, all comments are returned.
* @param bool $includeLastKnown
* @return list<IComment>
*/
public function getForObjectSince(
string $objectType,
string $objectId,
@ -385,17 +348,6 @@ class Manager implements ICommentsManager {
);
}
/**
* @param string $objectType the object type, e.g. 'files'
* @param string $objectId the id of the object
* @param string[] $verbs List of verbs to filter by
* @param int $lastKnownCommentId the last known comment (will be used as offset)
* @param string $sortDirection direction of the comments (`asc` or `desc`)
* @param int $limit optional, number of maximum comments to be returned. if
* set to 0, all comments are returned.
* @param bool $includeLastKnown
* @return list<IComment>
*/
public function getCommentsWithVerbForObjectSinceComment(
string $objectType,
string $objectId,
@ -534,17 +486,6 @@ class Manager implements ICommentsManager {
return null;
}
/**
* Search for comments with a given content
*
* @param string $search content to search for
* @param string $objectType Limit the search by object type
* @param string $objectId Limit the search by object id
* @param string $verb Limit the verb of the comment
* @param int $offset
* @param int $limit
* @return list<IComment>
*/
public function search(string $search, string $objectType, string $objectId, string $verb, int $offset, int $limit = 50): array {
$objectIds = [];
if ($objectId) {
@ -553,17 +494,6 @@ class Manager implements ICommentsManager {
return $this->searchForObjects($search, $objectType, $objectIds, $verb, $offset, $limit);
}
/**
* Search for comments on one or more objects with a given content
*
* @param string $search content to search for
* @param string $objectType Limit the search by object type
* @param array $objectIds Limit the search by object ids
* @param string $verb Limit the verb of the comment
* @param int $offset
* @param int $limit
* @return list<IComment>
*/
public function searchForObjects(string $search, string $objectType, array $objectIds, string $verb, int $offset, int $limit = 50): array {
$query = $this->dbConn->getQueryBuilder();
@ -604,15 +534,6 @@ class Manager implements ICommentsManager {
return $comments;
}
/**
* @param $objectType string the object type, e.g. 'files'
* @param $objectId string the id of the object
* @param \DateTime $notOlderThan optional, timestamp of the oldest comments
* that may be returned
* @param string $verb Limit the verb of the comment - Added in 14.0.0
* @return Int
* @since 9.0.0
*/
public function getNumberOfCommentsForObject($objectType, $objectId, ?\DateTime $notOlderThan = null, $verb = '') {
$qb = $this->dbConn->getQueryBuilder();
$query = $qb->select($qb->func()->count('id'))
@ -638,15 +559,6 @@ class Manager implements ICommentsManager {
return (int)$data[0];
}
/**
* @param string $objectType the object type, e.g. 'files'
* @param string[] $objectIds the id of the object
* @param IUser $user
* @param string $verb Limit the verb of the comment - Added in 14.0.0
* @return array Map with object id => # of unread comments
* @psalm-return array<string, int>
* @since 21.0.0
*/
public function getNumberOfUnreadCommentsForObjects(string $objectType, array $objectIds, IUser $user, $verb = ''): array {
$unreadComments = [];
$query = $this->dbConn->getQueryBuilder();
@ -683,14 +595,6 @@ class Manager implements ICommentsManager {
return $unreadComments;
}
/**
* @param string $objectType
* @param string $objectId
* @param int $lastRead
* @param string $verb
* @return int
* @since 21.0.0
*/
public function getNumberOfCommentsForObjectSinceComment(string $objectType, string $objectId, int $lastRead, string $verb = ''): int {
if ($verb !== '') {
return $this->getNumberOfCommentsWithVerbsForObjectSinceComment($objectType, $objectId, $lastRead, [$verb]);
@ -699,14 +603,6 @@ class Manager implements ICommentsManager {
return $this->getNumberOfCommentsWithVerbsForObjectSinceComment($objectType, $objectId, $lastRead, []);
}
/**
* @param string $objectType
* @param string $objectId
* @param int $lastRead
* @param string[] $verbs
* @return int
* @since 24.0.0
*/
public function getNumberOfCommentsWithVerbsForObjectSinceComment(string $objectType, string $objectId, int $lastRead, array $verbs): int {
$query = $this->dbConn->getQueryBuilder();
$query->select($query->func()->count('id', 'num_messages'))
@ -726,14 +622,6 @@ class Manager implements ICommentsManager {
return (int)($data['num_messages'] ?? 0);
}
/**
* @param string $objectType
* @param string $objectId
* @param \DateTime $beforeDate
* @param string $verb
* @return int
* @since 21.0.0
*/
public function getLastCommentBeforeDate(string $objectType, string $objectId, \DateTime $beforeDate, string $verb = ''): int {
$query = $this->dbConn->getQueryBuilder();
$query->select('id')
@ -754,16 +642,6 @@ class Manager implements ICommentsManager {
return (int)($data['id'] ?? 0);
}
/**
* @param string $objectType
* @param string $objectId
* @param string $verb
* @param string $actorType
* @param string[] $actors
* @return \DateTime[] Map of "string actor" => "\DateTime most recent comment date"
* @psalm-return array<string, \DateTime>
* @since 21.0.0
*/
public function getLastCommentDateByActor(
string $objectType,
string $objectId,
@ -793,15 +671,6 @@ class Manager implements ICommentsManager {
return $lastComments;
}
/**
* Get the number of unread comments for all files in a folder
*
* This is unused since 8bd39fccf411195839f2dadee085fad18ec52c23
*
* @param int $folderId
* @param IUser $user
* @return array [$fileId => $unreadCount]
*/
public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user) {
$directory = $this->rootFolder->getFirstNodeById($folderId);
if (!$directory instanceof Folder) {
@ -817,18 +686,6 @@ class Manager implements ICommentsManager {
});
}
/**
* creates a new comment and returns it. At this point of time, it is not
* saved in the used data storage. Use save() after setting other fields
* of the comment (e.g. message or verb).
*
* @param string $actorType the actor type (e.g. 'users')
* @param string $actorId a user id
* @param string $objectType the object type the comment is attached to
* @param string $objectId the object id the comment is attached to
* @return IComment
* @since 9.0.0
*/
public function create($actorType, $actorId, $objectType, $objectId) {
$comment = new Comment();
$comment
@ -837,17 +694,6 @@ class Manager implements ICommentsManager {
return $comment;
}
/**
* permanently deletes the comment specified by the ID
*
* When the comment has child comments, their parent ID will be changed to
* the parent ID of the item that is to be deleted.
*
* @param string $id
* @return bool
* @throws \InvalidArgumentException
* @since 9.0.0
*/
public function delete($id) {
if (!is_string($id)) {
throw new \InvalidArgumentException('Parameter must be string');
@ -895,21 +741,6 @@ class Manager implements ICommentsManager {
$this->sumReactions($reaction->getParentId());
}
/**
* Get comment related with user reaction
*
* Throws PreConditionNotMetException when the system haven't the minimum requirements to
* use reactions
*
* @param int $parentId
* @param string $actorType
* @param string $actorId
* @param string $reaction
* @return IComment
* @throws NotFoundException
* @throws PreConditionNotMetException
* @since 24.0.0
*/
public function getReactionComment(int $parentId, string $actorType, string $actorId, string $reaction): IComment {
$this->throwIfNotSupportReactions();
$qb = $this->dbConn->getQueryBuilder();
@ -928,17 +759,6 @@ class Manager implements ICommentsManager {
return $this->get($messageId);
}
/**
* Retrieve all reactions of a message
*
* Throws PreConditionNotMetException when the system haven't the minimum requirements to
* use reactions
*
* @param int $parentId
* @return IComment[]
* @throws PreConditionNotMetException
* @since 24.0.0
*/
public function retrieveAllReactions(int $parentId): array {
$this->throwIfNotSupportReactions();
$qb = $this->dbConn->getQueryBuilder();
@ -957,18 +777,6 @@ class Manager implements ICommentsManager {
return $this->getCommentsById($commentIds);
}
/**
* Retrieve all reactions with specific reaction of a message
*
* Throws PreConditionNotMetException when the system haven't the minimum requirements to
* use reactions
*
* @param int $parentId
* @param string $reaction
* @return IComment[]
* @throws PreConditionNotMetException
* @since 24.0.0
*/
public function retrieveAllReactionsWithSpecificReaction(int $parentId, string $reaction): array {
$this->throwIfNotSupportReactions();
$qb = $this->dbConn->getQueryBuilder();
@ -991,12 +799,6 @@ class Manager implements ICommentsManager {
return $comments;
}
/**
* Support reactions
*
* @return bool
* @since 24.0.0
*/
public function supportReactions(): bool {
return $this->emojiHelper->doesPlatformSupportEmoji();
}
@ -1048,26 +850,6 @@ class Manager implements ICommentsManager {
return $comments;
}
/**
* saves the comment permanently
*
* if the supplied comment has an empty ID, a new entry comment will be
* saved and the instance updated with the new ID.
*
* Otherwise, an existing comment will be updated.
*
* Throws NotFoundException when a comment that is to be updated does not
* exist anymore at this point of time.
*
* Throws PreConditionNotMetException when the system haven't the minimum requirements to
* use reactions
*
* @param IComment $comment
* @return bool
* @throws NotFoundException
* @throws PreConditionNotMetException
* @since 9.0.0
*/
public function save(IComment $comment) {
if ($comment->getVerb() === 'reaction') {
$this->throwIfNotSupportReactions();
@ -1257,15 +1039,6 @@ class Manager implements ICommentsManager {
return $affectedRows > 0;
}
/**
* removes references to specific actor (e.g. on user delete) of a comment.
* The comment itself must not get lost/deleted.
*
* @param string $actorType the actor type (e.g. 'users')
* @param string $actorId a user id
* @return boolean
* @since 9.0.0
*/
public function deleteReferencesOfActor($actorType, $actorId) {
$this->checkRoleParameters('Actor', $actorType, $actorId);
@ -1285,14 +1058,6 @@ class Manager implements ICommentsManager {
return is_int($affectedRows);
}
/**
* deletes all comments made of a specific object (e.g. on file delete)
*
* @param string $objectType the object type (e.g. 'files')
* @param string $objectId e.g. the file id
* @return boolean
* @since 9.0.0
*/
public function deleteCommentsAtObject($objectType, $objectId) {
$this->checkRoleParameters('Object', $objectType, $objectId);
@ -1310,13 +1075,6 @@ class Manager implements ICommentsManager {
return is_int($affectedRows);
}
/**
* deletes the read markers for the specified user
*
* @param \OCP\IUser $user
* @return bool
* @since 9.0.0
*/
public function deleteReadMarksFromUser(IUser $user) {
$qb = $this->dbConn->getQueryBuilder();
$query = $qb->delete('comments_read_markers')
@ -1335,16 +1093,6 @@ class Manager implements ICommentsManager {
return ($affectedRows > 0);
}
/**
* sets the read marker for a given file to the specified date for the
* provided user
*
* @param string $objectType
* @param string $objectId
* @param \DateTime $dateTime
* @param IUser $user
* @since 9.0.0
*/
public function setReadMark($objectType, $objectId, \DateTime $dateTime, IUser $user) {
$this->checkRoleParameters('Object', $objectType, $objectId);
@ -1380,17 +1128,6 @@ class Manager implements ICommentsManager {
->execute();
}
/**
* returns the read marker for a given file to the specified date for the
* provided user. It returns null, when the marker is not present, i.e.
* no comments were marked as read.
*
* @param string $objectType
* @param string $objectId
* @param IUser $user
* @return \DateTime|null
* @since 9.0.0
*/
public function getReadMark($objectType, $objectId, IUser $user) {
$qb = $this->dbConn->getQueryBuilder();
$resultStatement = $qb->select('marker_datetime')
@ -1412,14 +1149,6 @@ class Manager implements ICommentsManager {
return new \DateTime($data['marker_datetime']);
}
/**
* deletes the read markers on the specified object
*
* @param string $objectType
* @param string $objectId
* @return bool
* @since 9.0.0
*/
public function deleteReadMarksOnObject($objectType, $objectId) {
$this->checkRoleParameters('Object', $objectType, $objectId);
@ -1442,28 +1171,11 @@ class Manager implements ICommentsManager {
return ($affectedRows > 0);
}
/**
* registers an Entity to the manager, so event notifications can be send
* to consumers of the comments infrastructure
*
* @param \Closure $closure
*/
public function registerEventHandler(\Closure $closure) {
$this->eventHandlerClosures[] = $closure;
$this->eventHandlers = [];
}
/**
* registers a method that resolves an ID to a display name for a given type
*
* @param string $type
* @param \Closure $closure
* @throws \OutOfBoundsException
* @since 11.0.0
*
* Only one resolver shall be registered per type. Otherwise a
* \OutOfBoundsException has to thrown.
*/
public function registerDisplayNameResolver($type, \Closure $closure) {
if (!is_string($type)) {
throw new \InvalidArgumentException('String expected.');
@ -1474,19 +1186,6 @@ class Manager implements ICommentsManager {
$this->displayNameResolvers[$type] = $closure;
}
/**
* resolves a given ID of a given Type to a display name.
*
* @param string $type
* @param string $id
* @return string
* @throws \OutOfBoundsException
* @since 11.0.0
*
* If a provided type was not registered, an \OutOfBoundsException shall
* be thrown. It is upon the resolver discretion what to return of the
* provided ID is unknown. It must be ensured that a string is returned.
*/
public function resolveDisplayName($type, $id) {
if (!is_string($type)) {
throw new \InvalidArgumentException('String expected.');
@ -1534,19 +1233,11 @@ class Manager implements ICommentsManager {
$this->eventDispatcher->dispatchTyped($event);
}
/**
* Load the Comments app into the page
*
* @since 21.0.0
*/
public function load(): void {
$this->initialStateService->provideInitialState('comments', 'max-message-length', IComment::MAX_MESSAGE_LENGTH);
Util::addScript('comments', 'comments-app');
}
/**
* @inheritDoc
*/
public function deleteCommentsExpiredAtObject(string $objectType, string $objectId = ''): bool {
$qb = $this->dbConn->getQueryBuilder();
$qb->delete('comments')

View file

@ -7,7 +7,6 @@
*/
namespace OC\Comments;
use OCP\Comments\ICommentsManager;
use OCP\Comments\ICommentsManagerFactory;
use OCP\IServerContainer;
@ -19,21 +18,10 @@ class ManagerFactory implements ICommentsManagerFactory {
*/
private $serverContainer;
/**
* Constructor for the comments manager factory
*
* @param IServerContainer $serverContainer server container
*/
public function __construct(IServerContainer $serverContainer) {
$this->serverContainer = $serverContainer;
}
/**
* creates and returns an instance of the ICommentsManager
*
* @return ICommentsManager
* @since 9.0.0
*/
public function getManager() {
return $this->serverContainer->get(Manager::class);
}

View file

@ -10,9 +10,6 @@ use OCP\Contacts\ContactsMenu\IActionFactory;
use OCP\Contacts\ContactsMenu\ILinkAction;
class ActionFactory implements IActionFactory {
/**
* {@inheritDoc}
*/
public function newLinkAction(string $icon, string $name, string $href, string $appId = ''): ILinkAction {
$action = new LinkAction();
$action->setName($name);
@ -22,9 +19,6 @@ class ActionFactory implements IActionFactory {
return $action;
}
/**
* {@inheritDoc}
*/
public function newEMailAction(string $icon, string $name, string $email, string $appId = ''): ILinkAction {
return $this->newLinkAction($icon, $name, 'mailto:' . $email, $appId);
}

View file

@ -14,9 +14,6 @@ class LinkAction implements ILinkAction {
private int $priority = 10;
private string $appId = '';
/**
* @param string $icon absolute URI to an icon
*/
public function setIcon(string $icon): void {
$this->icon = $icon;
}
@ -45,23 +42,14 @@ class LinkAction implements ILinkAction {
return $this->href;
}
/**
* @since 23.0.0
*/
public function setAppId(string $appId): void {
$this->appId = $appId;
}
/**
* @since 23.0.0
*/
public function getAppId(): string {
return $this->appId;
}
/**
* @return array{title: string, icon: string, hyperlink: string, appId: string}
*/
public function jsonSerialize(): array {
return [
'title' => $this->name,

View file

@ -41,9 +41,6 @@ class ContactsStore implements IContactsStore {
) {
}
/**
* @return IEntry[]
*/
public function getContacts(IUser $user, ?string $filter, ?int $limit = null, ?int $offset = null): array {
$options = [
'enumeration' => $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes',

View file

@ -56,9 +56,6 @@ class Entry implements IEntry {
$this->emailAddresses[] = $address;
}
/**
* @return string[]
*/
public function getEMailAddresses(): array {
return $this->emailAddresses;
}
@ -145,9 +142,6 @@ class Entry implements IEntry {
return $this->properties[$key];
}
/**
* @return array{id: int|string|null, fullName: string, avatar: string|null, topAction: mixed, actions: array, lastMessage: '', emailAddresses: string[], profileTitle: string|null, profileUrl: string|null, status: string|null, statusMessage: null|string, statusMessageTimestamp: null|int, statusIcon: null|string, isUser: bool, uid: mixed}
*/
public function jsonSerialize(): array {
$topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null;
$otherActions = array_map(function (IAction $action) {

View file

@ -12,24 +12,6 @@ use OCP\Contacts\IManager;
use OCP\IAddressBook;
class ContactsManager implements IManager {
/**
* This function is used to search and find contacts within the users address books.
* In case $pattern is empty all contacts will be returned.
*
* @param string $pattern which should match within the $searchProperties
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options = array() to define the search behavior
* - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array
* example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']]
* - 'escape_like_param' - If set to false wildcards _ and % are not escaped
* - 'limit' - Set a numeric limit for the search results
* - 'offset' - Set the offset for the limited search results
* - 'enumeration' - (since 23.0.0) Whether user enumeration on system address book is allowed
* - 'fullmatch' - (since 23.0.0) Whether matching on full detail in system address book is allowed
* - 'strict_search' - (since 23.0.0) Whether the search pattern is full string or partial search
* @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, enumeration?: bool, fullmatch?: bool, strict_search?: bool} $options
* @return array an array of contacts which are arrays of key-value-pairs
*/
public function search($pattern, $searchProperties = [], $options = []) {
$this->loadAddressBooks();
$result = [];
@ -67,13 +49,6 @@ class ContactsManager implements IManager {
return $result;
}
/**
* This function can be used to delete the contact identified by the given id
*
* @param int $id the unique identifier to a contact
* @param string $addressBookKey identifier of the address book in which the contact shall be deleted
* @return bool successful or not
*/
public function delete($id, $addressBookKey) {
$addressBook = $this->getAddressBook($addressBookKey);
if (!$addressBook) {
@ -87,14 +62,6 @@ class ContactsManager implements IManager {
return false;
}
/**
* This function is used to create a new contact if 'id' is not given or not present.
* Otherwise the contact will be updated by replacing the entire data set.
*
* @param array $properties this array if key-value-pairs defines a contact
* @param string $addressBookKey identifier of the address book in which the contact shall be created or updated
* @return ?array representing the contact just created or updated
*/
public function createOrUpdate($properties, $addressBookKey) {
$addressBook = $this->getAddressBook($addressBookKey);
if (!$addressBook) {
@ -108,43 +75,23 @@ class ContactsManager implements IManager {
return null;
}
/**
* Check if contacts are available (e.g. contacts app enabled)
*
* @return bool true if enabled, false if not
*/
public function isEnabled(): bool {
return !empty($this->addressBooks) || !empty($this->addressBookLoaders);
}
/**
* @param IAddressBook $addressBook
*/
public function registerAddressBook(IAddressBook $addressBook) {
$this->addressBooks[$addressBook->getKey()] = $addressBook;
}
/**
* @param IAddressBook $addressBook
*/
public function unregisterAddressBook(IAddressBook $addressBook) {
unset($this->addressBooks[$addressBook->getKey()]);
}
/**
* Return a list of the user's addressbooks
*
* @return IAddressBook[]
* @since 16.0.0
*/
public function getUserAddressBooks(): array {
$this->loadAddressBooks();
return $this->addressBooks;
}
/**
* removes all registered address book instances
*/
public function clear() {
$this->addressBooks = [];
$this->addressBookLoaders = [];
@ -160,12 +107,6 @@ class ContactsManager implements IManager {
*/
private $addressBookLoaders = [];
/**
* In order to improve lazy loading a closure can be registered which will be called in case
* address books are actually requested
*
* @param \Closure $callable
*/
public function register(\Closure $callable) {
$this->addressBookLoaders[] = $callable;
}

View file

@ -174,9 +174,6 @@ class ConnectionAdapter implements IDBConnection {
return $this->inner->quote($input, $type);
}
/**
* @todo we are leaking a 3rdparty type here
*/
public function getDatabasePlatform(): AbstractPlatform {
return $this->inner->getDatabasePlatform();
}
@ -205,9 +202,6 @@ class ConnectionAdapter implements IDBConnection {
return $this->inner->supports4ByteText();
}
/**
* @todo leaks a 3rdparty type
*/
public function createSchema(): Schema {
try {
return $this->inner->createSchema();
@ -228,9 +222,6 @@ class ConnectionAdapter implements IDBConnection {
return $this->inner;
}
/**
* @return self::PLATFORM_MYSQL|self::PLATFORM_ORACLE|self::PLATFORM_POSTGRES|self::PLATFORM_SQLITE
*/
public function getDatabaseProvider(): string {
return $this->inner->getDatabaseProvider();
}

View file

@ -20,13 +20,6 @@ class CompositeExpression implements ICompositeExpression, \Countable {
) {
}
/**
* Adds multiple parts to composite expression.
*
* @param array $parts
*
* @return \OCP\DB\QueryBuilder\ICompositeExpression
*/
public function addMultiple(array $parts = []): ICompositeExpression {
foreach ($parts as $part) {
$this->add($part);
@ -35,13 +28,6 @@ class CompositeExpression implements ICompositeExpression, \Countable {
return $this;
}
/**
* Adds an expression to composite expression.
*
* @param mixed $part
*
* @return \OCP\DB\QueryBuilder\ICompositeExpression
*/
public function add($part): ICompositeExpression {
if ($part === null) {
return $this;
@ -56,20 +42,10 @@ class CompositeExpression implements ICompositeExpression, \Countable {
return $this;
}
/**
* Retrieves the amount of expressions on composite expression.
*
* @return integer
*/
public function count(): int {
return count($this->parts);
}
/**
* Returns the type of this composite expression (AND/OR).
*
* @return string
*/
public function getType(): string {
return $this->type;
}

View file

@ -17,7 +17,6 @@ use OC\DB\QueryBuilder\QuoteHelper;
use OCP\DB\QueryBuilder\ICompositeExpression;
use OCP\DB\QueryBuilder\IExpressionBuilder;
use OCP\DB\QueryBuilder\ILiteral;
use OCP\DB\QueryBuilder\IParameter;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DB\QueryBuilder\IQueryFunction;
use OCP\IDBConnection;
@ -47,20 +46,6 @@ class ExpressionBuilder implements IExpressionBuilder {
$this->functionBuilder = $queryBuilder->func();
}
/**
* Creates a conjunction of the given boolean expressions.
*
* Example:
*
* [php]
* // (u.type = ?) AND (u.role = ?)
* $expr->andX('u.type = ?', 'u.role = ?'));
*
* @param mixed ...$x Optional clause. Defaults = null, but requires
* at least one defined when converting to string.
*
* @return \OCP\DB\QueryBuilder\ICompositeExpression
*/
public function andX(...$x): ICompositeExpression {
if (empty($x)) {
$this->logger->debug('Calling ' . IQueryBuilder::class . '::' . __FUNCTION__ . ' without parameters is deprecated and will throw soon.', ['exception' => new \Exception('No parameters in call to ' . __METHOD__)]);
@ -68,20 +53,6 @@ class ExpressionBuilder implements IExpressionBuilder {
return new CompositeExpression(CompositeExpression::TYPE_AND, $x);
}
/**
* Creates a disjunction of the given boolean expressions.
*
* Example:
*
* [php]
* // (u.type = ?) OR (u.role = ?)
* $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?'));
*
* @param mixed ...$x Optional clause. Defaults = null, but requires
* at least one defined when converting to string.
*
* @return \OCP\DB\QueryBuilder\ICompositeExpression
*/
public function orX(...$x): ICompositeExpression {
if (empty($x)) {
$this->logger->debug('Calling ' . IQueryBuilder::class . '::' . __FUNCTION__ . ' without parameters is deprecated and will throw soon.', ['exception' => new \Exception('No parameters in call to ' . __METHOD__)]);
@ -89,289 +60,94 @@ class ExpressionBuilder implements IExpressionBuilder {
return new CompositeExpression(CompositeExpression::TYPE_OR, $x);
}
/**
* Creates a comparison expression.
*
* @param mixed $x The left expression.
* @param string $operator One of the IExpressionBuilder::* constants.
* @param mixed $y The right expression.
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
*/
public function comparison($x, string $operator, $y, $type = null): string {
$x = $this->prepareColumn($x, $type);
$y = $this->prepareColumn($y, $type);
return $this->expressionBuilder->comparison($x, $operator, $y);
}
/**
* Creates an equality comparison expression with the given arguments.
*
* First argument is considered the left expression and the second is the right expression.
* When converted to string, it will generated a <left expr> = <right expr>. Example:
*
* [php]
* // u.id = ?
* $expr->eq('u.id', '?');
*
* @param mixed $x The left expression.
* @param mixed $y The right expression.
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
*/
public function eq($x, $y, $type = null): string {
$x = $this->prepareColumn($x, $type);
$y = $this->prepareColumn($y, $type);
return $this->expressionBuilder->eq($x, $y);
}
/**
* Creates a non equality comparison expression with the given arguments.
* First argument is considered the left expression and the second is the right expression.
* When converted to string, it will generated a <left expr> <> <right expr>. Example:
*
* [php]
* // u.id <> 1
* $q->where($q->expr()->neq('u.id', '1'));
*
* @param mixed $x The left expression.
* @param mixed $y The right expression.
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
*/
public function neq($x, $y, $type = null): string {
$x = $this->prepareColumn($x, $type);
$y = $this->prepareColumn($y, $type);
return $this->expressionBuilder->neq($x, $y);
}
/**
* Creates a lower-than comparison expression with the given arguments.
* First argument is considered the left expression and the second is the right expression.
* When converted to string, it will generated a <left expr> < <right expr>. Example:
*
* [php]
* // u.id < ?
* $q->where($q->expr()->lt('u.id', '?'));
*
* @param mixed $x The left expression.
* @param mixed $y The right expression.
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
*/
public function lt($x, $y, $type = null): string {
$x = $this->prepareColumn($x, $type);
$y = $this->prepareColumn($y, $type);
return $this->expressionBuilder->lt($x, $y);
}
/**
* Creates a lower-than-equal comparison expression with the given arguments.
* First argument is considered the left expression and the second is the right expression.
* When converted to string, it will generated a <left expr> <= <right expr>. Example:
*
* [php]
* // u.id <= ?
* $q->where($q->expr()->lte('u.id', '?'));
*
* @param mixed $x The left expression.
* @param mixed $y The right expression.
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
*/
public function lte($x, $y, $type = null): string {
$x = $this->prepareColumn($x, $type);
$y = $this->prepareColumn($y, $type);
return $this->expressionBuilder->lte($x, $y);
}
/**
* Creates a greater-than comparison expression with the given arguments.
* First argument is considered the left expression and the second is the right expression.
* When converted to string, it will generated a <left expr> > <right expr>. Example:
*
* [php]
* // u.id > ?
* $q->where($q->expr()->gt('u.id', '?'));
*
* @param mixed $x The left expression.
* @param mixed $y The right expression.
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
*/
public function gt($x, $y, $type = null): string {
$x = $this->prepareColumn($x, $type);
$y = $this->prepareColumn($y, $type);
return $this->expressionBuilder->gt($x, $y);
}
/**
* Creates a greater-than-equal comparison expression with the given arguments.
* First argument is considered the left expression and the second is the right expression.
* When converted to string, it will generated a <left expr> >= <right expr>. Example:
*
* [php]
* // u.id >= ?
* $q->where($q->expr()->gte('u.id', '?'));
*
* @param mixed $x The left expression.
* @param mixed $y The right expression.
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
*/
public function gte($x, $y, $type = null): string {
$x = $this->prepareColumn($x, $type);
$y = $this->prepareColumn($y, $type);
return $this->expressionBuilder->gte($x, $y);
}
/**
* Creates an IS NULL expression with the given arguments.
*
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be restricted by IS NULL.
*
* @return string
*/
public function isNull($x): string {
$x = $this->helper->quoteColumnName($x);
return $this->expressionBuilder->isNull($x);
}
/**
* Creates an IS NOT NULL expression with the given arguments.
*
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be restricted by IS NOT NULL.
*
* @return string
*/
public function isNotNull($x): string {
$x = $this->helper->quoteColumnName($x);
return $this->expressionBuilder->isNotNull($x);
}
/**
* Creates a LIKE() comparison expression with the given arguments.
*
* @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by LIKE() comparison.
* @param mixed $y Argument to be used in LIKE() comparison.
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
*/
public function like($x, $y, $type = null): string {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->like($x, $y);
}
/**
* Creates a ILIKE() comparison expression with the given arguments.
*
* @param string $x Field in string format to be inspected by ILIKE() comparison.
* @param mixed $y Argument to be used in ILIKE() comparison.
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @since 9.0.0
*/
public function iLike($x, $y, $type = null): string {
return $this->expressionBuilder->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y));
}
/**
* Creates a NOT LIKE() comparison expression with the given arguments.
*
* @param ILiteral|IParameter|IQueryFunction|string $x Field in string format to be inspected by NOT LIKE() comparison.
* @param mixed $y Argument to be used in NOT LIKE() comparison.
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
*/
public function notLike($x, $y, $type = null): string {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->notLike($x, $y);
}
/**
* Creates a IN () comparison expression with the given arguments.
*
* @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by IN() comparison.
* @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by IN() comparison.
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
*/
public function in($x, $y, $type = null): string {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnNames($y);
return $this->expressionBuilder->in($x, $y);
}
/**
* Creates a NOT IN () comparison expression with the given arguments.
*
* @param ILiteral|IParameter|IQueryFunction|string $x The field in string format to be inspected by NOT IN() comparison.
* @param ILiteral|IParameter|IQueryFunction|string|array $y The placeholder or the array of values to be used by NOT IN() comparison.
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
*/
public function notIn($x, $y, $type = null): string {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnNames($y);
return $this->expressionBuilder->notIn($x, $y);
}
/**
* Creates a $x = '' statement, because Oracle needs a different check
*
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison.
* @return string
* @since 13.0.0
*/
public function emptyString($x): string {
return $this->eq($x, $this->literal('', IQueryBuilder::PARAM_STR));
}
/**
* Creates a `$x <> ''` statement, because Oracle needs a different check
*
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison.
* @return string
* @since 13.0.0
*/
public function nonEmptyString($x): string {
return $this->neq($x, $this->literal('', IQueryBuilder::PARAM_STR));
}
/**
* Binary AND Operator copies a bit to the result if it exists in both operands.
*
* @param string|ILiteral $x The field or value to check
* @param int $y Bitmap that must be set
* @return IQueryFunction
* @since 12.0.0
*/
public function bitwiseAnd($x, int $y): IQueryFunction {
return new QueryFunction($this->connection->getDatabasePlatform()->getBitAndComparisonExpression(
$this->helper->quoteColumnName($x),
@ -379,14 +155,6 @@ class ExpressionBuilder implements IExpressionBuilder {
));
}
/**
* Binary OR Operator copies a bit if it exists in either operand.
*
* @param string|ILiteral $x The field or value to check
* @param int $y Bitmap that must be set
* @return IQueryFunction
* @since 12.0.0
*/
public function bitwiseOr($x, int $y): IQueryFunction {
return new QueryFunction($this->connection->getDatabasePlatform()->getBitOrComparisonExpression(
$this->helper->quoteColumnName($x),
@ -394,26 +162,10 @@ class ExpressionBuilder implements IExpressionBuilder {
));
}
/**
* Quotes a given input parameter.
*
* @param mixed $input The parameter to be quoted.
* @param int $type One of the IQueryBuilder::PARAM_* constants
*
* @return ILiteral
*/
public function literal($input, $type = IQueryBuilder::PARAM_STR): ILiteral {
return new Literal($this->expressionBuilder->literal($input, $type));
}
/**
* Returns a IQueryFunction that casts the column to the given type
*
* @param string|IQueryFunction $column
* @param mixed $type One of IQueryBuilder::PARAM_*
* @psalm-param IQueryBuilder::PARAM_* $type
* @return IQueryFunction
*/
public function castColumn($column, $type): IQueryFunction {
return new QueryFunction(
$this->helper->quoteColumnName($column)

File diff suppressed because it is too large Load diff

View file

@ -5,8 +5,6 @@
*/
namespace OC\DB;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Schema;
use OCP\DB\ISchemaWrapper;
@ -43,11 +41,6 @@ class SchemaWrapper implements ISchemaWrapper {
}
}
/**
* Gets all table names
*
* @return array
*/
public function getTableNamesWithoutPrefix() {
$tableNames = $this->schema->getTableNames();
return array_map(function ($tableName) {
@ -59,74 +52,32 @@ class SchemaWrapper implements ISchemaWrapper {
}, $tableNames);
}
// Overwritten methods
/**
* @return array
*/
public function getTableNames() {
return $this->schema->getTableNames();
}
/**
* @param string $tableName
*
* @return \Doctrine\DBAL\Schema\Table
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
public function getTable($tableName) {
return $this->schema->getTable($this->connection->getPrefix() . $tableName);
}
/**
* Does this schema have a table with the given name?
*
* @param string $tableName
*
* @return boolean
*/
public function hasTable($tableName) {
return $this->schema->hasTable($this->connection->getPrefix() . $tableName);
}
/**
* Creates a new table.
*
* @param string $tableName
* @return \Doctrine\DBAL\Schema\Table
*/
public function createTable($tableName) {
unset($this->tablesToDelete[$tableName]);
return $this->schema->createTable($this->connection->getPrefix() . $tableName);
}
/**
* Drops a table from the schema.
*
* @param string $tableName
* @return \Doctrine\DBAL\Schema\Schema
*/
public function dropTable($tableName) {
$this->tablesToDelete[$tableName] = true;
return $this->schema->dropTable($this->connection->getPrefix() . $tableName);
}
/**
* Gets all tables of this schema.
*
* @return \Doctrine\DBAL\Schema\Table[]
*/
public function getTables() {
return $this->schema->getTables();
}
/**
* Gets the DatabasePlatform for the database.
*
* @return AbstractPlatform
*
* @throws Exception
*/
public function getDatabasePlatform() {
return $this->connection->getDatabasePlatform();
}

View file

@ -121,9 +121,6 @@ class Manager implements IManager {
$this->lazyWidgets = [];
}
/**
* @return array<string, IWidget>
*/
public function getWidgets(): array {
$this->loadLazyPanels();
return $this->widgets;

View file

@ -74,39 +74,10 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
return $timestamp;
}
/**
* Formats the date of the given timestamp
*
* @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object
* @param string $format Either 'full', 'long', 'medium' or 'short'
* full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014'
* long: e.g. 'MMMM d, y' => 'August 20, 2014'
* medium: e.g. 'MMM d, y' => 'Aug 20, 2014'
* short: e.g. 'M/d/yy' => '8/20/14'
* The exact format is dependent on the language
* @param \DateTimeZone $timeZone The timezone to use
* @param \OCP\IL10N $l The locale to use
* @return string Formatted date string
*/
public function formatDate($timestamp, $format = 'long', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) {
return $this->format($timestamp, 'date', $format, $timeZone, $l);
}
/**
* Formats the date of the given timestamp
*
* @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object
* @param string $format Either 'full', 'long', 'medium' or 'short'
* full: e.g. 'EEEE, MMMM d, y' => 'Wednesday, August 20, 2014'
* long: e.g. 'MMMM d, y' => 'August 20, 2014'
* medium: e.g. 'MMM d, y' => 'Aug 20, 2014'
* short: e.g. 'M/d/yy' => '8/20/14'
* The exact format is dependent on the language
* Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable
* @param \DateTimeZone $timeZone The timezone to use
* @param \OCP\IL10N $l The locale to use
* @return string Formatted relative date string
*/
public function formatDateRelativeDay($timestamp, $format = 'long', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) {
if (!str_ends_with($format, '^') && !str_ends_with($format, '*')) {
$format .= '^';
@ -115,18 +86,6 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
return $this->format($timestamp, 'date', $format, $timeZone, $l);
}
/**
* Gives the relative date of the timestamp
* Only works for past dates
*
* @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object
* @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time
* @param \OCP\IL10N $l The locale to use
* @return string Formatted date span. Dates returned are:
* < 1 month => Today, Yesterday, n days ago
* < 13 month => last month, n months ago
* >= 13 month => last year, n years ago
*/
public function formatDateSpan($timestamp, $baseTimestamp = null, ?\OCP\IL10N $l = null) {
$l = $this->getLocale($l);
$timestamp = $this->getDateTime($timestamp);
@ -179,38 +138,10 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
}
}
/**
* Formats the time of the given timestamp
*
* @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object
* @param string $format Either 'full', 'long', 'medium' or 'short'
* full: e.g. 'h:mm:ss a zzzz' => '11:42:13 AM GMT+0:00'
* long: e.g. 'h:mm:ss a z' => '11:42:13 AM GMT'
* medium: e.g. 'h:mm:ss a' => '11:42:13 AM'
* short: e.g. 'h:mm a' => '11:42 AM'
* The exact format is dependent on the language
* @param \DateTimeZone $timeZone The timezone to use
* @param \OCP\IL10N $l The locale to use
* @return string Formatted time string
*/
public function formatTime($timestamp, $format = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) {
return $this->format($timestamp, 'time', $format, $timeZone, $l);
}
/**
* Gives the relative past time of the timestamp
*
* @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object
* @param int|\DateTime $baseTimestamp Timestamp to compare $timestamp against, defaults to current time
* @param \OCP\IL10N $l The locale to use
* @return string Formatted time span. Dates returned are:
* < 60 sec => seconds ago
* < 1 hour => n minutes ago
* < 1 day => n hours ago
* < 1 month => Yesterday, n days ago
* < 13 month => last month, n months ago
* >= 13 month => last year, n years ago
*/
public function formatTimeSpan($timestamp, $baseTimestamp = null, ?\OCP\IL10N $l = null) {
$l = $this->getLocale($l);
$timestamp = $this->getDateTime($timestamp);
@ -244,31 +175,10 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
}
}
/**
* Formats the date and time of the given timestamp
*
* @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object
* @param string $formatDate See formatDate() for description
* @param string $formatTime See formatTime() for description
* @param \DateTimeZone $timeZone The timezone to use
* @param \OCP\IL10N $l The locale to use
* @return string Formatted date and time string
*/
public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) {
return $this->format($timestamp, 'datetime', $formatDate . '|' . $formatTime, $timeZone, $l);
}
/**
* Formats the date and time of the given timestamp
*
* @param int|\DateTime $timestamp Either a Unix timestamp or DateTime object
* @param string $formatDate See formatDate() for description
* Uses 'Today', 'Yesterday' and 'Tomorrow' when applicable
* @param string $formatTime See formatTime() for description
* @param \DateTimeZone $timeZone The timezone to use
* @param \OCP\IL10N $l The locale to use
* @return string Formatted relative date and time string
*/
public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) {
if (!str_ends_with($formatDate, '^') && !str_ends_with($formatDate, '*')) {
$formatDate .= '^';

View file

@ -30,12 +30,6 @@ class DateTimeZone implements IDateTimeZone {
$this->session = $session;
}
/**
* Get the timezone of the current user, based on his session information and config data
*
* @param bool|int $timestamp
* @return \DateTimeZone
*/
public function getTimeZone($timestamp = false) {
$timeZone = $this->config->getUserValue($this->session->get('user_id'), 'core', 'timezone', null);
if ($timeZone === null) {

View file

@ -47,37 +47,22 @@ class Event implements IEvent {
$this->end = $time;
}
/**
* @return float
*/
public function getStart() {
return $this->start;
}
/**
* @return string
*/
public function getId() {
return $this->id;
}
/**
* @return string
*/
public function getDescription() {
return $this->description;
}
/**
* @return float
*/
public function getEnd() {
return $this->end;
}
/**
* @return float
*/
public function getDuration() {
if (!$this->end) {
$this->end = microtime(true);

View file

@ -52,9 +52,6 @@ class EventLogger implements IEventLogger {
return $systemValue && $isDebugLevel;
}
/**
* @inheritdoc
*/
public function start($id, $description = '') {
if ($this->activated) {
$this->events[$id] = new Event($id, $description, microtime(true));
@ -62,9 +59,6 @@ class EventLogger implements IEventLogger {
}
}
/**
* @inheritdoc
*/
public function end($id) {
if ($this->activated && isset($this->events[$id])) {
$timing = $this->events[$id];
@ -73,9 +67,6 @@ class EventLogger implements IEventLogger {
}
}
/**
* @inheritdoc
*/
public function log($id, $description, $start, $end) {
if ($this->activated) {
$this->events[$id] = new Event($id, $description, $start);
@ -84,16 +75,10 @@ class EventLogger implements IEventLogger {
}
}
/**
* @inheritdoc
*/
public function getEvents() {
return $this->events;
}
/**
* @inheritdoc
*/
public function activate() {
$this->activated = true;
}

View file

@ -36,30 +36,18 @@ class Query implements IQuery {
$this->end = $time;
}
/**
* @return array
*/
public function getParams() {
return $this->params;
}
/**
* @return string
*/
public function getSql() {
return $this->sql;
}
/**
* @return float
*/
public function getStart() {
return $this->start;
}
/**
* @return float
*/
public function getDuration() {
return $this->end - $this->start;
}

View file

@ -29,9 +29,6 @@ class QueryLogger implements IQueryLogger {
*/
private $activated = false;
/**
* @inheritdoc
*/
public function startQuery($sql, ?array $params = null, ?array $types = null) {
if ($this->activated) {
$this->activeQuery = new Query($sql, $params, microtime(true), $this->getStack());
@ -46,9 +43,6 @@ class QueryLogger implements IQueryLogger {
return $stack;
}
/**
* @inheritdoc
*/
public function stopQuery() {
if ($this->activated && $this->activeQuery) {
$this->activeQuery->end(microtime(true));
@ -58,16 +52,10 @@ class QueryLogger implements IQueryLogger {
}
}
/**
* @inheritdoc
*/
public function getQueries() {
return $this->queries->getData();
}
/**
* @inheritdoc
*/
public function activate() {
$this->activated = true;
}

View file

@ -44,12 +44,6 @@ class File implements \OCP\Encryption\IFile {
return $this->appManager;
}
/**
* Get list of users with access to the file
*
* @param string $path to the file
* @return array{users: string[], public: bool}
*/
public function getAccessList($path) {
// Make sure that a share key is generated for the owner too
[$owner, $ownerPath] = $this->util->getUidAndFilename($path);

View file

@ -64,17 +64,11 @@ class Storage implements IStorage {
$this->config = $config;
}
/**
* @inheritdoc
*/
public function getUserKey($uid, $keyId, $encryptionModuleId) {
$path = $this->constructUserKeyPath($encryptionModuleId, $keyId, $uid);
return base64_decode($this->getKeyWithUid($path, $uid));
}
/**
* @inheritdoc
*/
public function getFileKey($path, $keyId, $encryptionModuleId) {
$realFile = $this->util->stripPartialFileExtension($path);
$keyDir = $this->util->getFileKeyDir($encryptionModuleId, $realFile);
@ -91,17 +85,11 @@ class Storage implements IStorage {
return base64_decode($key);
}
/**
* @inheritdoc
*/
public function getSystemUserKey($keyId, $encryptionModuleId) {
$path = $this->constructUserKeyPath($encryptionModuleId, $keyId, null);
return base64_decode($this->getKeyWithUid($path, null));
}
/**
* @inheritdoc
*/
public function setUserKey($uid, $keyId, $key, $encryptionModuleId) {
$path = $this->constructUserKeyPath($encryptionModuleId, $keyId, $uid);
return $this->setKey($path, [
@ -110,9 +98,6 @@ class Storage implements IStorage {
]);
}
/**
* @inheritdoc
*/
public function setFileKey($path, $keyId, $key, $encryptionModuleId) {
$keyDir = $this->util->getFileKeyDir($encryptionModuleId, $path);
return $this->setKey($keyDir . $keyId, [
@ -120,9 +105,6 @@ class Storage implements IStorage {
]);
}
/**
* @inheritdoc
*/
public function setSystemUserKey($keyId, $key, $encryptionModuleId) {
$path = $this->constructUserKeyPath($encryptionModuleId, $keyId, null);
return $this->setKey($path, [
@ -131,9 +113,6 @@ class Storage implements IStorage {
]);
}
/**
* @inheritdoc
*/
public function deleteUserKey($uid, $keyId, $encryptionModuleId) {
try {
$path = $this->constructUserKeyPath($encryptionModuleId, $keyId, $uid);
@ -152,25 +131,16 @@ class Storage implements IStorage {
}
}
/**
* @inheritdoc
*/
public function deleteFileKey($path, $keyId, $encryptionModuleId) {
$keyDir = $this->util->getFileKeyDir($encryptionModuleId, $path);
return !$this->view->file_exists($keyDir . $keyId) || $this->view->unlink($keyDir . $keyId);
}
/**
* @inheritdoc
*/
public function deleteAllFileKeys($path) {
$keyDir = $this->util->getFileKeyDir('', $path);
return !$this->view->file_exists($keyDir) || $this->view->deleteAll($keyDir);
}
/**
* @inheritdoc
*/
public function deleteSystemUserKey($keyId, $encryptionModuleId) {
$path = $this->constructUserKeyPath($encryptionModuleId, $keyId, null);
return !$this->view->file_exists($path) || $this->view->unlink($path);
@ -334,13 +304,6 @@ class Storage implements IStorage {
return false;
}
/**
* move keys if a file was renamed
*
* @param string $source
* @param string $target
* @return boolean
*/
public function renameKeys($source, $target) {
$sourcePath = $this->getPathToKeys($source);
$targetPath = $this->getPathToKeys($target);
@ -356,13 +319,6 @@ class Storage implements IStorage {
}
/**
* copy keys if a file was renamed
*
* @param string $source
* @param string $target
* @return boolean
*/
public function copyKeys($source, $target) {
$sourcePath = $this->getPathToKeys($source);
$targetPath = $this->getPathToKeys($target);
@ -376,15 +332,6 @@ class Storage implements IStorage {
return false;
}
/**
* backup keys of a given encryption module
*
* @param string $encryptionModuleId
* @param string $purpose
* @param string $uid
* @return bool
* @since 12.0.0
*/
public function backupUserKeys($encryptionModuleId, $purpose, $uid) {
$source = $uid . $this->encryption_base_dir . '/' . $encryptionModuleId;
$backupDir = $uid . $this->backup_base_dir;

View file

@ -34,11 +34,6 @@ class Manager implements IManager {
$this->encryptionModules = [];
}
/**
* Check if encryption is enabled
*
* @return bool true if enabled, false if not
*/
public function isEnabled() {
$installed = $this->config->getSystemValueBool('installed', false);
if (!$installed) {
@ -82,14 +77,6 @@ class Manager implements IManager {
return true;
}
/**
* Registers an callback function which must return an encryption module instance
*
* @param string $id
* @param string $displayName
* @param callable $callback
* @throws Exceptions\ModuleAlreadyExistsException
*/
public function registerEncryptionModule($id, $displayName, callable $callback) {
if (isset($this->encryptionModules[$id])) {
throw new Exceptions\ModuleAlreadyExistsException($id, $displayName);
@ -108,31 +95,14 @@ class Manager implements IManager {
}
}
/**
* Unregisters an encryption module
*
* @param string $moduleId
*/
public function unregisterEncryptionModule($moduleId) {
unset($this->encryptionModules[$moduleId]);
}
/**
* get a list of all encryption modules
*
* @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
*/
public function getEncryptionModules() {
return $this->encryptionModules;
}
/**
* get a specific encryption module
*
* @param string $moduleId
* @return IEncryptionModule
* @throws Exceptions\ModuleDoesNotExistsException
*/
public function getEncryptionModule($moduleId = '') {
if (empty($moduleId)) {
return $this->getDefaultEncryptionModule();
@ -164,12 +134,6 @@ class Manager implements IManager {
throw new Exceptions\ModuleDoesNotExistsException($message);
}
/**
* set default encryption module Id
*
* @param string $moduleId
* @return bool
*/
public function setDefaultEncryptionModule($moduleId) {
try {
$this->getEncryptionModule($moduleId);
@ -181,11 +145,6 @@ class Manager implements IManager {
return true;
}
/**
* get default encryption module Id
*
* @return string
*/
public function getDefaultEncryptionModuleId() {
return $this->config->getAppValue('core', 'default_encryption_module');
}

View file

@ -59,9 +59,6 @@ class EventDispatcher implements IEventDispatcher {
return $this->dispatcher->hasListeners($eventName);
}
/**
* @deprecated
*/
public function dispatch(string $eventName,
Event $event): void {
$this->dispatcher->dispatch($event, $eventName);

View file

@ -62,16 +62,6 @@ class EventSource implements IEventSource {
flush();
}
/**
* send a message to the client
*
* @param string $type
* @param mixed $data
*
* @throws \BadMethodCallException
* if only one parameter is given, a typeless message will be send with that parameter as data
* @suppress PhanDeprecatedFunction
*/
public function send($type, $data = null) {
if ($data and !preg_match('/^[A-Za-z0-9_]+$/', $type)) {
throw new \BadMethodCallException('Type needs to be alphanumeric ('. $type .')');
@ -95,9 +85,6 @@ class EventSource implements IEventSource {
flush();
}
/**
* close the connection of the event source
*/
public function close() {
$this->send('__internal__', 'close'); //server side closing can be an issue, let the client do it
}

View file

@ -6,40 +6,12 @@
namespace OC\Federation;
use OCP\Federation\ICloudFederationFactory;
use OCP\Federation\ICloudFederationNotification;
use OCP\Federation\ICloudFederationShare;
class CloudFederationFactory implements ICloudFederationFactory {
/**
* get a CloudFederationShare Object to prepare a share you want to send
*
* @param string $shareWith
* @param string $name resource name (e.g. document.odt)
* @param string $description share description (optional)
* @param string $providerId resource UID on the provider side
* @param string $owner provider specific UID of the user who owns the resource
* @param string $ownerDisplayName display name of the user who shared the item
* @param string $sharedBy provider specific UID of the user who shared the resource
* @param string $sharedByDisplayName display name of the user who shared the resource
* @param string $sharedSecret used to authenticate requests across servers
* @param string $shareType ('group' or 'user' share)
* @param $resourceType ('file', 'calendar',...)
* @return ICloudFederationShare
*
* @since 14.0.0
*/
public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $sharedSecret, $shareType, $resourceType) {
return new CloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $shareType, $resourceType, $sharedSecret);
}
/**
* get a Cloud FederationNotification object to prepare a notification you
* want to send
*
* @return ICloudFederationNotification
*
* @since 14.0.0
*/
public function getCloudFederationNotification() {
return new CloudFederationNotification();
}

View file

@ -17,16 +17,6 @@ use OCP\Federation\ICloudFederationNotification;
class CloudFederationNotification implements ICloudFederationNotification {
private $message = [];
/**
* add a message to the notification
*
* @param string $notificationType (e.g. SHARE_ACCEPTED)
* @param string $resourceType (e.g. file, calendar, contact,...)
* @param string $providerId id of the share
* @param array $notification payload of the notification
*
* @since 14.0.0
*/
public function setMessage($notificationType, $resourceType, $providerId, array $notification) {
$this->message = [
'notificationType' => $notificationType,
@ -36,13 +26,6 @@ class CloudFederationNotification implements ICloudFederationNotification {
];
}
/**
* get message, ready to send out
*
* @return array
*
* @since 14.0.0
*/
public function getMessage() {
return $this->message;
}

View file

@ -12,7 +12,6 @@ use OC\AppFramework\Http;
use OCP\App\IAppManager;
use OCP\Federation\Exceptions\ProviderDoesNotExistsException;
use OCP\Federation\ICloudFederationNotification;
use OCP\Federation\ICloudFederationProvider;
use OCP\Federation\ICloudFederationProviderManager;
use OCP\Federation\ICloudFederationShare;
use OCP\Federation\ICloudIdManager;
@ -45,13 +44,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
}
/**
* Registers an callback function which must return an cloud federation provider
*
* @param string $resourceType which resource type does the provider handles
* @param string $displayName user facing name of the federated share provider
* @param callable $callback
*/
public function addCloudFederationProvider($resourceType, $displayName, callable $callback) {
$this->cloudFederationProvider[$resourceType] = [
'resourceType' => $resourceType,
@ -60,31 +52,14 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
];
}
/**
* remove cloud federation provider
*
* @param string $providerId
*/
public function removeCloudFederationProvider($providerId) {
unset($this->cloudFederationProvider[$providerId]);
}
/**
* get a list of all cloudFederationProviders
*
* @return array [resourceType => ['resourceType' => $resourceType, 'displayName' => $displayName, 'callback' => callback]]
*/
public function getAllCloudFederationProviders() {
return $this->cloudFederationProvider;
}
/**
* get a specific cloud federation provider
*
* @param string $resourceType
* @return ICloudFederationProvider
* @throws ProviderDoesNotExistsException
*/
public function getCloudFederationProvider($resourceType) {
if (isset($this->cloudFederationProvider[$resourceType])) {
return call_user_func($this->cloudFederationProvider[$resourceType]['callback']);
@ -93,9 +68,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
}
}
/**
* @deprecated 29.0.0 - Use {@see sendCloudShare()} instead and handle errors manually
*/
public function sendShare(ICloudFederationShare $share) {
$cloudID = $this->cloudIdManager->resolveCloudId($share->getShareWith());
try {
@ -132,11 +104,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
return false;
}
/**
* @param ICloudFederationShare $share
* @return IResponse
* @throws OCMProviderException
*/
public function sendCloudShare(ICloudFederationShare $share): IResponse {
$cloudID = $this->cloudIdManager->resolveCloudId($share->getShareWith());
$ocmProvider = $this->discoveryService->discover($cloudID->getRemote());
@ -160,12 +127,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
}
}
/**
* @param string $url
* @param ICloudFederationNotification $notification
* @return array|false
* @deprecated 29.0.0 - Use {@see sendCloudNotification()} instead and handle errors manually
*/
public function sendNotification($url, ICloudFederationNotification $notification) {
try {
$ocmProvider = $this->discoveryService->discover($url);
@ -194,12 +155,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
return false;
}
/**
* @param string $url
* @param ICloudFederationNotification $notification
* @return IResponse
* @throws OCMProviderException
*/
public function sendCloudNotification(string $url, ICloudFederationNotification $notification): IResponse {
$ocmProvider = $this->discoveryService->discover($url);
@ -222,11 +177,6 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
}
}
/**
* check if the new cloud federation API is ready to be used
*
* @return bool
*/
public function isReady() {
return $this->appManager->isEnabledForUser('cloud_federation_api');
}

View file

@ -69,123 +69,46 @@ class CloudFederationShare implements ICloudFederationShare {
$this->setResourceType($resourceType);
}
/**
* set uid of the recipient
*
* @param string $user
*
* @since 14.0.0
*/
public function setShareWith($user) {
$this->share['shareWith'] = $user;
}
/**
* set resource name (e.g. document.odt)
*
* @param string $name
*
* @since 14.0.0
*/
public function setResourceName($name) {
$this->share['name'] = $name;
}
/**
* set resource type (e.g. file, calendar, contact,...)
*
* @param string $resourceType
*
* @since 14.0.0
*/
public function setResourceType($resourceType) {
$this->share['resourceType'] = $resourceType;
}
/**
* set resource description (optional)
*
* @param string $description
*
* @since 14.0.0
*/
public function setDescription($description) {
$this->share['description'] = $description;
}
/**
* set provider ID (e.g. file ID)
*
* @param string $providerId
*
* @since 14.0.0
*/
public function setProviderId($providerId) {
$this->share['providerId'] = $providerId;
}
/**
* set owner UID
*
* @param string $owner
*
* @since 14.0.0
*/
public function setOwner($owner) {
$this->share['owner'] = $owner;
}
/**
* set owner display name
*
* @param string $ownerDisplayName
*
* @since 14.0.0
*/
public function setOwnerDisplayName($ownerDisplayName) {
$this->share['ownerDisplayName'] = $ownerDisplayName;
}
/**
* set UID of the user who sends the share
*
* @param string $sharedBy
*
* @since 14.0.0
*/
public function setSharedBy($sharedBy) {
$this->share['sharedBy'] = $sharedBy;
}
/**
* set display name of the user who sends the share
*
* @param $sharedByDisplayName
*
* @since 14.0.0
*/
public function setSharedByDisplayName($sharedByDisplayName) {
$this->share['sharedByDisplayName'] = $sharedByDisplayName;
}
/**
* set protocol specification
*
* @param array $protocol
*
* @since 14.0.0
*/
public function setProtocol(array $protocol) {
$this->share['protocol'] = $protocol;
}
/**
* share type (group or user)
*
* @param string $shareType
*
* @since 14.0.0
*/
public function setShareType($shareType) {
if ($shareType === 'group' || $shareType === IShare::TYPE_REMOTE_GROUP) {
$this->share['shareType'] = 'group';
@ -194,145 +117,54 @@ class CloudFederationShare implements ICloudFederationShare {
}
}
/**
* get the whole share, ready to send out
*
* @return array
*
* @since 14.0.0
*/
public function getShare() {
return $this->share;
}
/**
* get uid of the recipient
*
* @return string
*
* @since 14.0.0
*/
public function getShareWith() {
return $this->share['shareWith'];
}
/**
* get resource name (e.g. file, calendar, contact,...)
*
* @return string
*
* @since 14.0.0
*/
public function getResourceName() {
return $this->share['name'];
}
/**
* get resource type (e.g. file, calendar, contact,...)
*
* @return string
*
* @since 14.0.0
*/
public function getResourceType() {
return $this->share['resourceType'];
}
/**
* get resource description (optional)
*
* @return string
*
* @since 14.0.0
*/
public function getDescription() {
return $this->share['description'];
}
/**
* get provider ID (e.g. file ID)
*
* @return string
*
* @since 14.0.0
*/
public function getProviderId() {
return $this->share['providerId'];
}
/**
* get owner UID
*
* @return string
*
* @since 14.0.0
*/
public function getOwner() {
return $this->share['owner'];
}
/**
* get owner display name
*
* @return string
*
* @since 14.0.0
*/
public function getOwnerDisplayName() {
return $this->share['ownerDisplayName'];
}
/**
* get UID of the user who sends the share
*
* @return string
*
* @since 14.0.0
*/
public function getSharedBy() {
return $this->share['sharedBy'];
}
/**
* get display name of the user who sends the share
*
* @return string
*
* @since 14.0.0
*/
public function getSharedByDisplayName() {
return $this->share['sharedByDisplayName'];
}
/**
* get share type (group or user)
*
* @return string
*
* @since 14.0.0
*/
public function getShareType() {
return $this->share['shareType'];
}
/**
* get share Secret
*
* @return string
*
* @since 14.0.0
*/
public function getShareSecret() {
return $this->share['protocol']['options']['sharedSecret'];
}
/**
* get protocol specification
*
* @return array
*
* @since 14.0.0
*/
public function getProtocol() {
return $this->share['protocol'];
}

View file

@ -34,11 +34,6 @@ class CloudId implements ICloudId {
$this->displayName = $displayName;
}
/**
* The full remote cloud id
*
* @return string
*/
public function getId(): string {
return $this->id;
}
@ -52,20 +47,10 @@ class CloudId implements ICloudId {
return str_replace('https://', '', str_replace('http://', '', $this->getId()));
}
/**
* The username on the remote server
*
* @return string
*/
public function getUser(): string {
return $this->user;
}
/**
* The base address of the remote server
*
* @return string
*/
public function getRemote(): string {
return $this->remote;
}

View file

@ -71,11 +71,6 @@ class CloudIdManager implements ICloudIdManager {
}
}
/**
* @param string $cloudId
* @return ICloudId
* @throws \InvalidArgumentException
*/
public function resolveCloudId(string $cloudId): ICloudId {
// TODO magic here to get the url and user instead of just splitting on @
@ -139,11 +134,6 @@ class CloudIdManager implements ICloudIdManager {
return null;
}
/**
* @param string $user
* @param string|null $remote
* @return CloudId
*/
public function getCloudId(string $user, ?string $remote): ICloudId {
$isLocal = $remote === null;
if ($isLocal) {
@ -185,10 +175,6 @@ class CloudIdManager implements ICloudIdManager {
return new CloudId($id, $user, $remote, $displayName);
}
/**
* @param string $url
* @return string
*/
public function removeProtocolFromUrl(string $url, bool $httpsOnly = false): string {
if (str_starts_with($url, 'https://')) {
return substr($url, 8);
@ -230,10 +216,6 @@ class CloudIdManager implements ICloudIdManager {
return $remote;
}
/**
* @param string $cloudId
* @return bool
*/
public function isValidCloudId(string $cloudId): bool {
return str_contains($cloudId, '@');
}

View file

@ -97,21 +97,10 @@ class Cache implements ICache {
return $this->storageCache;
}
/**
* Get the numeric storage id for this cache's storage
*
* @return int
*/
public function getNumericStorageId() {
return $this->storageCache->getNumericId();
}
/**
* get the stored metadata of a file or folder
*
* @param string | int $file either the path of a file or folder or the file id for a file or folder
* @return ICacheEntry|false the cache entry as array or false if the file is not found in the cache
*/
public function get($file) {
$query = $this->getQueryBuilder();
$query->selectFileCache();
@ -178,23 +167,11 @@ class Cache implements ICache {
return new CacheEntry($data);
}
/**
* get the metadata of all files stored in $folder
*
* @param string $folder
* @return ICacheEntry[]
*/
public function getFolderContents($folder) {
$fileId = $this->getId($folder);
return $this->getFolderContentsById($fileId);
}
/**
* get the metadata of all files stored in $folder
*
* @param int $fileId the file id of the folder
* @return ICacheEntry[]
*/
public function getFolderContentsById($fileId) {
if ($fileId > -1) {
$query = $this->getQueryBuilder();
@ -217,15 +194,6 @@ class Cache implements ICache {
return [];
}
/**
* insert or update meta data for a file or folder
*
* @param string $file
* @param array $data
*
* @return int file id
* @throws \RuntimeException
*/
public function put($file, array $data) {
if (($id = $this->getId($file)) > -1) {
$this->update($id, $data);
@ -235,15 +203,6 @@ class Cache implements ICache {
}
}
/**
* insert meta data for a new file or folder
*
* @param string $file
* @param array $data
*
* @return int file id
* @throws \RuntimeException
*/
public function insert($file, array $data) {
// normalize file
$file = $this->normalize($file);
@ -316,12 +275,6 @@ class Cache implements ICache {
}
}
/**
* update the metadata of an existing file or folder in the cache
*
* @param int $id the fileid of the existing file or folder
* @param array $data [$key => $value] the metadata to update, only the fields provided in the array will be updated, non-provided values will remain unchanged
*/
public function update($id, array $data) {
if (isset($data['path'])) {
// normalize path
@ -445,16 +398,6 @@ class Cache implements ICache {
return [$params, array_filter($extensionParams)];
}
/**
* get the file id for a file
*
* A file id is a numeric id for a file or folder that's unique within an owncloud instance which stays the same for the lifetime of a file
*
* File ids are easiest way for apps to store references to a file since unlike paths they are not affected by renames or sharing
*
* @param string $file
* @return int
*/
public function getId($file) {
// normalize file
$file = $this->normalize($file);
@ -472,12 +415,6 @@ class Cache implements ICache {
return $id === false ? -1 : (int)$id;
}
/**
* get the id of the parent folder of a file
*
* @param string $file
* @return int
*/
public function getParentId($file) {
if ($file === '') {
return -1;
@ -495,23 +432,10 @@ class Cache implements ICache {
return $parent;
}
/**
* check if a file is available in the cache
*
* @param string $file
* @return bool
*/
public function inCache($file) {
return $this->getId($file) != -1;
}
/**
* remove a file or folder from the cache
*
* when removing a folder from the cache all files and folders inside the folder will be removed as well
*
* @param string $file
*/
public function remove($file) {
$entry = $this->get($file);
@ -614,12 +538,6 @@ class Cache implements ICache {
}
}
/**
* Move a file or folder in the cache
*
* @param string $source
* @param string $target
*/
public function move($source, $target) {
$this->moveFromCache($this, $source, $target);
}
@ -638,15 +556,6 @@ class Cache implements ICache {
return $this->storage->instanceOfStorage(Encryption::class);
}
/**
* Move a file or folder in the cache
*
* @param ICache $sourceCache
* @param string $sourcePath
* @param string $targetPath
* @throws \OC\DatabaseException
* @throws \Exception if the given storages have an invalid id
*/
public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {
if ($sourceCache instanceof Cache) {
// normalize source and target
@ -805,18 +714,6 @@ class Cache implements ICache {
$query->execute();
}
/**
* Get the scan status of a file
*
* - Cache::NOT_FOUND: File is not in the cache
* - Cache::PARTIAL: File is not stored in the cache but some incomplete data is known
* - Cache::SHALLOW: The folder and it's direct children are in the cache but not all sub folders are fully scanned
* - Cache::COMPLETE: The file or folder, with all it's children) are fully scanned
*
* @param string $file
*
* @return int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE
*/
public function getStatus($file) {
// normalize file
$file = $this->normalize($file);
@ -846,24 +743,11 @@ class Cache implements ICache {
}
}
/**
* search for files matching $pattern
*
* @param string $pattern the search pattern using SQL search syntax (e.g. '%searchstring%')
* @return ICacheEntry[] an array of cache entries where the name matches the search pattern
*/
public function search($pattern) {
$operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', $pattern);
return $this->searchQuery(new SearchQuery($operator, 0, 0, [], null));
}
/**
* search for files by mimetype
*
* @param string $mimetype either a full mimetype to search ('text/plain') or only the first part of a mimetype ('image')
* where it will search for all mimetypes in the group ('image/*')
* @return ICacheEntry[] an array of cache entries where the mimetype matches the search
*/
public function searchByMime($mimetype) {
if (!str_contains($mimetype, '/')) {
$operator = new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%');
@ -1045,15 +929,6 @@ class Cache implements ICache {
}, $files);
}
/**
* find a folder in the cache which has not been fully scanned
*
* If multiple incomplete folders are in the cache, the one with the highest id will be returned,
* use the one with the highest id gives the best result with the background scanner, since that is most
* likely the folder where we stopped scanning previously
*
* @return string|false the path of the folder or false when no folder matched
*/
public function getIncomplete() {
// we select the fileid here first instead of directly selecting the path since this helps mariadb/mysql
// to use the correct index.
@ -1079,12 +954,6 @@ class Cache implements ICache {
return $path ?? false;
}
/**
* get the path of a file on this storage by it's file id
*
* @param int $id the file id of the file or folder to search
* @return string|null the path of the file (relative to the storage) or null if a file with the given id does not exists within this cache
*/
public function getPathById($id) {
$query = $this->getQueryBuilder();
$query->select('path')
@ -1136,24 +1005,10 @@ class Cache implements ICache {
}
}
/**
* normalize the given path
*
* @param string $path
* @return string
*/
public function normalize($path) {
return trim(\OC_Util::normalizeUnicode($path), '/');
}
/**
* Copy a file or folder in the cache
*
* @param ICache $sourceCache
* @param ICacheEntry $sourceEntry
* @param string $targetPath
* @return int fileId of copied entry
*/
public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int {
if ($sourceEntry->getId() < 0) {
throw new \RuntimeException('Invalid source cache entry on copyFromCache');

View file

@ -34,9 +34,6 @@ class CacheEntry implements ICacheEntry {
unset($this->data[$offset]);
}
/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset) {
if (isset($this->data[$offset])) {

View file

@ -68,10 +68,6 @@ class FileAccess implements IFileAccess {
return $result;
}
/**
* @param int[] $fileIds
* @return array<int, CacheEntry>
*/
public function getByFileIds(array $fileIds): array {
$query = $this->getQuery()->selectFileCache();
$query->andWhere($query->expr()->in('filecache.fileid', $query->createNamedParameter($fileIds, IQueryBuilder::PARAM_INT_ARRAY)));
@ -80,11 +76,6 @@ class FileAccess implements IFileAccess {
return $this->rowsToEntries($rows);
}
/**
* @param int[] $fileIds
* @param int $storageId
* @return array<int, CacheEntry>
*/
public function getByFileIdsInStorage(array $fileIds, int $storageId): array {
$fileIds = array_values($fileIds);
$query = $this->getQuery()->selectFileCache();

View file

@ -46,11 +46,6 @@ class Propagator implements IPropagator {
}
/**
* @param string $internalPath
* @param int $time
* @param int $sizeDifference number of bytes the file has grown
*/
public function propagateChange($internalPath, $time, $sizeDifference = 0) {
// Do not propagate changes in ignored paths
foreach ($this->ignore as $ignore) {
@ -142,14 +137,6 @@ class Propagator implements IPropagator {
return $parents;
}
/**
* Mark the beginning of a propagation batch
*
* Note that not all cache setups support propagation in which case this will be a noop
*
* Batching for cache setups that do support it has to be explicit since the cache state is not fully consistent
* before the batch is committed.
*/
public function beginBatch() {
$this->inBatch = true;
}
@ -169,9 +156,6 @@ class Propagator implements IPropagator {
}
}
/**
* Commit the active propagation batch
*/
public function commitBatch() {
if (!$this->inBatch) {
throw new \BadMethodCallException('Not in batch');

View file

@ -101,18 +101,6 @@ class Scanner extends BasicEmitter implements IScanner {
return $data;
}
/**
* scan a single file and store it in the cache
*
* @param string $file
* @param int $reuseExisting
* @param int $parentId
* @param array|null|false $cacheData existing data in the cache for the file to be scanned
* @param bool $lock set to false to disable getting an additional read lock during scanning
* @param null $data the metadata for the file, as returned by the storage
* @return array|null an array of metadata of the scanned file
* @throws \OCP\Lock\LockedException
*/
public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = null, $lock = true, $data = null) {
if ($file !== '') {
try {
@ -305,15 +293,6 @@ class Scanner extends BasicEmitter implements IScanner {
}
}
/**
* scan a folder and all it's children
*
* @param string $path
* @param bool $recursive
* @param int $reuse
* @param bool $lock set to false to disable getting an additional read lock during scanning
* @return array|null an array of the meta data of the scanned file or folder
*/
public function scan($path, $recursive = self::SCAN_RECURSIVE, $reuse = -1, $lock = true) {
if ($reuse === -1) {
$reuse = ($recursive === self::SCAN_SHALLOW) ? self::REUSE_ETAG | self::REUSE_SIZE : self::REUSE_ETAG;
@ -553,14 +532,6 @@ class Scanner extends BasicEmitter implements IScanner {
return $childQueue;
}
/**
* check if the file should be ignored when scanning
* NOTE: files with a '.part' extension are ignored as well!
* prevents unfinished put requests to be scanned
*
* @param string $file
* @return boolean
*/
public static function isPartialFile($file) {
if (pathinfo($file, PATHINFO_EXTENSION) === 'part') {
return true;
@ -572,9 +543,6 @@ class Scanner extends BasicEmitter implements IScanner {
return false;
}
/**
* walk over any folders that are not fully scanned yet and scan them
*/
public function backgroundScan() {
if ($this->storage->instanceOfStorage(Jail::class)) {
// for jail storage wrappers (shares, groupfolders) we run the background scan on the source storage

View file

@ -71,21 +71,10 @@ class Updater implements IUpdater {
$this->enabled = true;
}
/**
* Get the propagator for etags and mtime for the view the updater works on
*
* @return Propagator
*/
public function getPropagator() {
return $this->propagator;
}
/**
* Propagate etag and mtime changes for the parent folders of $path up to the root of the filesystem
*
* @param string $path the path of the file to propagate the changes for
* @param int|null $time the timestamp to set as mtime for the parent folders, if left out the current time is used
*/
public function propagate($path, $time = null) {
if (Scanner::isPartialFile($path)) {
return;
@ -93,12 +82,6 @@ class Updater implements IUpdater {
$this->propagator->propagateChange($path, $time);
}
/**
* Update the cache for $path and update the size, etag and mtime of the parent folders
*
* @param string $path
* @param int $time
*/
public function update($path, $time = null, ?int $sizeDifference = null) {
if (!$this->enabled or Scanner::isPartialFile($path)) {
return;
@ -126,11 +109,6 @@ class Updater implements IUpdater {
$this->propagator->propagateChange($path, $time, $sizeDifference ?? 0);
}
/**
* Remove $path from the cache and update the size, etag and mtime of the parent folders
*
* @param string $path
*/
public function remove($path) {
if (!$this->enabled or Scanner::isPartialFile($path)) {
return;
@ -156,13 +134,6 @@ class Updater implements IUpdater {
}
}
/**
* Rename a file or folder in the cache and update the size, etag and mtime of the parent folders
*
* @param IStorage $sourceStorage
* @param string $source
* @param string $target
*/
public function renameFromStorage(IStorage $sourceStorage, $source, $target) {
if (!$this->enabled or Scanner::isPartialFile($source) or Scanner::isPartialFile($target)) {
return;

View file

@ -7,7 +7,6 @@
*/
namespace OC\Files\Cache;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Cache\IWatcher;
/**
@ -42,27 +41,14 @@ class Watcher implements IWatcher {
$this->scanner = $storage->getScanner();
}
/**
* @param int $policy either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS
*/
public function setPolicy($policy) {
$this->watchPolicy = $policy;
}
/**
* @return int either \OC\Files\Cache\Watcher::CHECK_NEVER, \OC\Files\Cache\Watcher::CHECK_ONCE, \OC\Files\Cache\Watcher::CHECK_ALWAYS
*/
public function getPolicy() {
return $this->watchPolicy;
}
/**
* check $path for updates and update if needed
*
* @param string $path
* @param ICacheEntry|null $cachedEntry
* @return boolean true if path was updated
*/
public function checkUpdate($path, $cachedEntry = null) {
if (is_null($cachedEntry)) {
$cachedEntry = $this->cache->get($path);
@ -82,12 +68,6 @@ class Watcher implements IWatcher {
}
}
/**
* Update the cache for changes to $path
*
* @param string $path
* @param ICacheEntry $cachedData
*/
public function update($path, $cachedData) {
if ($this->storage->is_dir($path)) {
$this->scanner->scan($path, Scanner::SCAN_SHALLOW);
@ -102,13 +82,6 @@ class Watcher implements IWatcher {
}
}
/**
* Check if the cache for $path needs to be updated
*
* @param string $path
* @param ICacheEntry $cachedData
* @return bool
*/
public function needsUpdate($path, $cachedData) {
if ($this->watchPolicy === self::CHECK_ALWAYS or ($this->watchPolicy === self::CHECK_ONCE and !in_array($path, $this->checkedPaths))) {
$this->checkedPaths[] = $path;
@ -117,11 +90,6 @@ class Watcher implements IWatcher {
return false;
}
/**
* remove deleted files in $path from the cache
*
* @param string $path
*/
public function cleanFolder($path) {
$cachedContent = $this->cache->getFolderContents($path);
foreach ($cachedContent as $entry) {

View file

@ -54,30 +54,18 @@ class CachedMountInfo implements ICachedMountInfo {
$this->key = $rootId . '::' . $mountPoint;
}
/**
* @return IUser
*/
public function getUser(): IUser {
return $this->user;
}
/**
* @return int the numeric storage id of the mount
*/
public function getStorageId(): int {
return $this->storageId;
}
/**
* @return int the fileid of the root of the mount
*/
public function getRootId(): int {
return $this->rootId;
}
/**
* @return Node|null the root node of the mount
*/
public function getMountPointNode(): ?Node {
// TODO injection etc
Filesystem::initMountPoints($this->getUser()->getUID());
@ -85,28 +73,14 @@ class CachedMountInfo implements ICachedMountInfo {
return $userNode->getParent()->getFirstNodeById($this->getRootId());
}
/**
* @return string the mount point of the mount for the user
*/
public function getMountPoint(): string {
return $this->mountPoint;
}
/**
* Get the id of the configured mount
*
* @return int|null mount id or null if not applicable
* @since 9.1.0
*/
public function getMountId(): ?int {
return $this->mountId;
}
/**
* Get the internal path (within the storage) of the root of the mount
*
* @return string
*/
public function getRootInternalPath(): string {
return $this->rootInternalPath;
}

View file

@ -138,13 +138,6 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
return array_merge($lateMounts, $firstMounts);
}
/**
* Get the configured home mount for this user
*
* @param \OCP\IUser $user
* @return \OCP\Files\Mount\IMountPoint
* @since 9.1.0
*/
public function getHomeMountForUser(IUser $user) {
/** @var \OCP\Files\Config\IHomeMountProvider[] $providers */
$providers = array_reverse($this->homeProviders); // call the latest registered provider first to give apps an opportunity to overwrite builtin
@ -157,11 +150,6 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
throw new \Exception('No home storage configured for user ' . $user);
}
/**
* Add a provider for mount points
*
* @param \OCP\Files\Config\IMountProvider $provider
*/
public function registerProvider(IMountProvider $provider) {
$this->providers[] = $provider;
@ -183,22 +171,11 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
});
}
/**
* Add a provider for home mount points
*
* @param \OCP\Files\Config\IHomeMountProvider $provider
* @since 9.1.0
*/
public function registerHomeProvider(IHomeMountProvider $provider) {
$this->homeProviders[] = $provider;
$this->emit('\OC\Files\Config', 'registerHomeMountProvider', [$provider]);
}
/**
* Get the mount cache which can be used to search for mounts without setting up the filesystem
*
* @return IUserMountCache
*/
public function getMountCache() {
return $this->mountCache;
}
@ -207,12 +184,6 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
$this->rootProviders[] = $provider;
}
/**
* Get all root mountpoints
*
* @return \OCP\Files\Mount\IMountPoint[]
* @since 20.0.0
*/
public function getRootMounts(): array {
$loader = $this->loader;
$mounts = array_map(function (IRootMountProvider $provider) use ($loader) {

View file

@ -11,7 +11,6 @@ use OC\User\LazyUser;
use OCP\Cache\CappedMemoryCache;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Diagnostics\IEventLogger;
use OCP\Files\Config\ICachedMountFileInfo;
use OCP\Files\Config\ICachedMountInfo;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\NotFoundException;
@ -224,10 +223,6 @@ class UserMountCache implements IUserMountCache {
}
}
/**
* @param IUser $user
* @return ICachedMountInfo[]
*/
public function getMountsForUser(IUser $user) {
$userUID = $user->getUID();
if (!$this->userManager->userExists($userUID)) {
@ -268,11 +263,6 @@ class UserMountCache implements IUserMountCache {
return $query->executeQuery()->fetchOne() ?: '';
}
/**
* @param int $numericStorageId
* @param string|null $user limit the results to a single user
* @return CachedMountInfo[]
*/
public function getMountsForStorageId($numericStorageId, $user = null) {
$builder = $this->connection->getQueryBuilder();
$query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class')
@ -291,10 +281,6 @@ class UserMountCache implements IUserMountCache {
return array_filter(array_map([$this, 'dbRowToMountInfo'], $rows));
}
/**
* @param int $rootFileId
* @return CachedMountInfo[]
*/
public function getMountsForRootId($rootFileId) {
$builder = $this->connection->getQueryBuilder();
$query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class')
@ -338,12 +324,6 @@ class UserMountCache implements IUserMountCache {
return $this->cacheInfoCache[$fileId];
}
/**
* @param int $fileId
* @param string|null $user optionally restrict the results to a single user
* @return ICachedMountFileInfo[]
* @since 9.0.0
*/
public function getMountsForFileId($fileId, $user = null) {
try {
[$storageId, $internalPath] = $this->getCacheInfoFromFileId($fileId);
@ -380,11 +360,6 @@ class UserMountCache implements IUserMountCache {
}, $filteredMounts);
}
/**
* Remove all cached mounts for a user
*
* @param IUser $user
*/
public function removeUserMounts(IUser $user) {
$builder = $this->connection->getQueryBuilder();
@ -410,10 +385,6 @@ class UserMountCache implements IUserMountCache {
$query->execute();
}
/**
* @param array $users
* @return array
*/
public function getUsedSpaceForUsers(array $users) {
$builder = $this->connection->getQueryBuilder();

View file

@ -106,9 +106,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
};
}
/**
* @return string
*/
public function getPath() {
return $this->path;
}
@ -117,48 +114,28 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
return $this->storage;
}
/**
* @return string
*/
public function getInternalPath() {
return $this->internalPath;
}
/**
* Get FileInfo ID or null in case of part file
*
* @return int|null
*/
public function getId() {
return isset($this->data['fileid']) ? (int)$this->data['fileid'] : null;
}
/**
* @return string
*/
public function getMimetype() {
return $this->data['mimetype'];
}
/**
* @return string
*/
public function getMimePart() {
return $this->data['mimepart'];
}
/**
* @return string
*/
public function getName() {
return empty($this->data['name'])
? basename($this->getPath())
: $this->data['name'];
}
/**
* @return string
*/
public function getEtag() {
$this->updateEntryFromSubMounts();
if (count($this->childEtags) > 0) {
@ -169,10 +146,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
}
}
/**
* @param bool $includeMounts
* @return int|float
*/
public function getSize($includeMounts = true) {
if ($includeMounts) {
$this->updateEntryFromSubMounts();
@ -187,17 +160,11 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
}
}
/**
* @return int
*/
public function getMTime() {
$this->updateEntryFromSubMounts();
return (int)$this->data['mtime'];
}
/**
* @return bool
*/
public function isEncrypted() {
return $this->data['encrypted'] ?? false;
}
@ -209,16 +176,10 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
return isset($this->data['encryptedVersion']) ? (int)$this->data['encryptedVersion'] : 1;
}
/**
* @return int
*/
public function getPermissions() {
return (int)$this->data['permissions'];
}
/**
* @return string \OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER
*/
public function getType() {
if (!isset($this->data['type'])) {
$this->data['type'] = ($this->getMimetype() === self::MIMETYPE_FOLDER) ? self::TYPE_FOLDER : self::TYPE_FILE;
@ -238,48 +199,26 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
return ($this->getPermissions() & $permissions) === $permissions;
}
/**
* @return bool
*/
public function isReadable() {
return $this->checkPermissions(\OCP\Constants::PERMISSION_READ);
}
/**
* @return bool
*/
public function isUpdateable() {
return $this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE);
}
/**
* Check whether new files or folders can be created inside this folder
*
* @return bool
*/
public function isCreatable() {
return $this->checkPermissions(\OCP\Constants::PERMISSION_CREATE);
}
/**
* @return bool
*/
public function isDeletable() {
return $this->checkPermissions(\OCP\Constants::PERMISSION_DELETE);
}
/**
* @return bool
*/
public function isShareable() {
return $this->checkPermissions(\OCP\Constants::PERMISSION_SHARE);
}
/**
* Check if a file or folder is shared
*
* @return bool
*/
public function isShared() {
return $this->mount instanceof ISharedMountPoint;
}
@ -289,20 +228,10 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
return !$isHome && !$this->isShared();
}
/**
* Get the mountpoint the file belongs to
*
* @return \OCP\Files\Mount\IMountPoint
*/
public function getMountPoint() {
return $this->mount;
}
/**
* Get the owner of the file
*
* @return ?IUser
*/
public function getOwner() {
return $this->owner;
}
@ -363,9 +292,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
}
}
/**
* @inheritdoc
*/
public function getChecksum() {
return $this->data['checksum'];
}
@ -386,10 +312,6 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
return $this->data['parent'] ?? -1;
}
/**
* @inheritDoc
* @return array<string, int|string|bool|float|string[]|int[]>
*/
public function getMetadata(): array {
return $this->data['metadata'] ?? [];
}

View file

@ -156,9 +156,6 @@ class FilenameValidator implements IFilenameValidator {
return $this->forbiddenCharacters;
}
/**
* @inheritdoc
*/
public function isFilenameValid(string $filename): bool {
try {
$this->validateFilename($filename);
@ -168,9 +165,6 @@ class FilenameValidator implements IFilenameValidator {
return true;
}
/**
* @inheritdoc
*/
public function validateFilename(string $filename): void {
$trimmed = trim($filename);
if ($trimmed === '') {

View file

@ -30,13 +30,6 @@ class CacheMountProvider implements IMountProvider {
$this->config = $config;
}
/**
* Get the cache mount for a user
*
* @param IUser $user
* @param IStorageFactory $loader
* @return \OCP\Files\Mount\IMountPoint[]
*/
public function getMountsForUser(IUser $user, IStorageFactory $loader) {
$cacheBaseDir = $this->config->getSystemValueString('cache_path', '');
if ($cacheBaseDir !== '') {

View file

@ -15,13 +15,6 @@ use OCP\IUser;
* Mount provider for regular posix home folders
*/
class LocalHomeMountProvider implements IHomeMountProvider {
/**
* Get the cache mount for a user
*
* @param IUser $user
* @param IStorageFactory $loader
* @return \OCP\Files\Mount\IMountPoint|null
*/
public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
$arguments = ['user' => $user];
return new HomeMountPoint($user, '\OC\Files\Storage\Home', '/' . $user->getUID(), $arguments, $loader, null, null, self::class);

View file

@ -32,18 +32,12 @@ class Manager implements IMountManager {
$this->setupManager = $setupManagerFactory->create($this);
}
/**
* @param IMountPoint $mount
*/
public function addMount(IMountPoint $mount) {
$this->mounts[$mount->getMountPoint()] = $mount;
$this->pathCache->clear();
$this->inPathCache->clear();
}
/**
* @param string $mountPoint
*/
public function removeMount(string $mountPoint) {
$mountPoint = Filesystem::normalizePath($mountPoint);
if (\strlen($mountPoint) > 1) {
@ -54,10 +48,6 @@ class Manager implements IMountManager {
$this->inPathCache->clear();
}
/**
* @param string $mountPoint
* @param string $target
*/
public function moveMount(string $mountPoint, string $target) {
$this->mounts[$target] = $this->mounts[$mountPoint];
unset($this->mounts[$mountPoint]);
@ -65,12 +55,6 @@ class Manager implements IMountManager {
$this->inPathCache->clear();
}
/**
* Find the mount for $path
*
* @param string $path
* @return IMountPoint
*/
public function find(string $path): IMountPoint {
$this->setupManager->setupForPath($path);
$path = Filesystem::normalizePath($path);
@ -107,12 +91,6 @@ class Manager implements IMountManager {
throw new NotFoundException('No mount for path ' . $path . ' existing mounts (' . count($this->mounts) .'): ' . implode(',', array_keys($this->mounts)));
}
/**
* Find all mounts in $path
*
* @param string $path
* @return IMountPoint[]
*/
public function findIn(string $path): array {
$this->setupManager->setupForPath($path, true);
$path = $this->formatPath($path);
@ -140,12 +118,6 @@ class Manager implements IMountManager {
$this->inPathCache->clear();
}
/**
* Find mounts by storage id
*
* @param string $id
* @return IMountPoint[]
*/
public function findByStorageId(string $id): array {
if (\strlen($id) > 64) {
$id = md5($id);
@ -159,19 +131,10 @@ class Manager implements IMountManager {
return $result;
}
/**
* @return IMountPoint[]
*/
public function getAll(): array {
return $this->mounts;
}
/**
* Find mounts by numeric storage id
*
* @param int $id
* @return IMountPoint[]
*/
public function findByNumericId(int $id): array {
$result = [];
foreach ($this->mounts as $mount) {
@ -216,13 +179,6 @@ class Manager implements IMountManager {
}
}
/**
* Return the mount matching a cached mount info (or mount file info)
*
* @param ICachedMountInfo $info
*
* @return IMountPoint|null
*/
public function getMountFromMountInfo(ICachedMountInfo $info): ?IMountPoint {
$this->setupManager->setupForPath($info->getMountPoint());
foreach ($this->mounts as $mount) {

View file

@ -112,20 +112,10 @@ class MountPoint implements IMountPoint {
$this->mountProvider = $mountProvider ?? '';
}
/**
* get complete path to the mount point, relative to data/
*
* @return string
*/
public function getMountPoint() {
return $this->mountPoint;
}
/**
* Sets the mount point path, relative to data/
*
* @param string $mountPoint new mount point
*/
public function setMountPoint($mountPoint) {
$this->mountPoint = $this->formatPath($mountPoint);
}
@ -162,9 +152,6 @@ class MountPoint implements IMountPoint {
}
}
/**
* @return \OC\Files\Storage\Storage|null
*/
public function getStorage() {
if (is_null($this->storage)) {
$this->createStorage();
@ -172,9 +159,6 @@ class MountPoint implements IMountPoint {
return $this->storage;
}
/**
* @return string|null
*/
public function getStorageId() {
if (!$this->storageId) {
$storage = $this->getStorage();
@ -189,9 +173,6 @@ class MountPoint implements IMountPoint {
return $this->storageId;
}
/**
* @return int
*/
public function getNumericStorageId() {
if (is_null($this->numericStorageId)) {
$storage = $this->getStorage();
@ -203,10 +184,6 @@ class MountPoint implements IMountPoint {
return $this->numericStorageId;
}
/**
* @param string $path
* @return string
*/
public function getInternalPath($path) {
$path = Filesystem::normalizePath($path, true, false, true);
if ($this->mountPoint === $path or $this->mountPoint . '/' === $path) {
@ -230,9 +207,6 @@ class MountPoint implements IMountPoint {
return $path;
}
/**
* @param callable $wrapper
*/
public function wrapStorage($wrapper) {
$storage = $this->getStorage();
// storage can be null if it couldn't be initialized
@ -241,31 +215,14 @@ class MountPoint implements IMountPoint {
}
}
/**
* Get a mount option
*
* @param string $name Name of the mount option to get
* @param mixed $default Default value for the mount option
* @return mixed
*/
public function getOption($name, $default) {
return $this->mountOptions[$name] ?? $default;
}
/**
* Get all options for the mount
*
* @return array
*/
public function getOptions() {
return $this->mountOptions;
}
/**
* Get the file id of the root of the storage
*
* @return int
*/
public function getStorageRootId() {
if (is_null($this->rootId) || $this->rootId === -1) {
$storage = $this->getStorage();

View file

@ -31,13 +31,6 @@ class ObjectHomeMountProvider implements IHomeMountProvider {
$this->config = $config;
}
/**
* Get the cache mount for a user
*
* @param IUser $user
* @param IStorageFactory $loader
* @return \OCP\Files\Mount\IMountPoint
*/
public function getHomeMountForUser(IUser $user, IStorageFactory $loader) {
$config = $this->getMultiBucketObjectStoreConfig($user);
if ($config === null) {

View file

@ -29,10 +29,6 @@ class ObjectStorePreviewCacheMountProvider implements IRootMountProvider {
$this->config = $config;
}
/**
* @return MountPoint[]
* @throws \Exception
*/
public function getRootMounts(IStorageFactory $loader): array {
if (!is_array($this->config->getSystemValue('objectstore_multibucket'))) {
return [];

View file

@ -9,7 +9,6 @@ namespace OC\Files\Node;
use OCP\Files\GenericFileException;
use OCP\Files\NotPermittedException;
use OCP\Lock\LockedException;
class File extends Node implements \OCP\Files\File {
/**
@ -22,12 +21,6 @@ class File extends Node implements \OCP\Files\File {
return new NonExistingFile($this->root, $this->view, $path);
}
/**
* @return string
* @throws NotPermittedException
* @throws GenericFileException
* @throws LockedException
*/
public function getContent() {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_READ)) {
$content = $this->view->file_get_contents($this->path);
@ -40,12 +33,6 @@ class File extends Node implements \OCP\Files\File {
}
}
/**
* @param string|resource $data
* @throws NotPermittedException
* @throws GenericFileException
* @throws LockedException
*/
public function putContent($data) {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
$this->sendHooks(['preWrite']);
@ -59,12 +46,6 @@ class File extends Node implements \OCP\Files\File {
}
}
/**
* @param string $mode
* @return resource|false
* @throws NotPermittedException
* @throws LockedException
*/
public function fopen($mode) {
$preHooks = [];
$postHooks = [];
@ -100,11 +81,6 @@ class File extends Node implements \OCP\Files\File {
}
}
/**
* @throws NotPermittedException
* @throws \OCP\Files\InvalidPathException
* @throws \OCP\Files\NotFoundException
*/
public function delete() {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
$this->sendHooks(['preDelete']);
@ -118,18 +94,10 @@ class File extends Node implements \OCP\Files\File {
}
}
/**
* @param string $type
* @param bool $raw
* @return string
*/
public function hash($type, $raw = false) {
return $this->view->hash($type, $this->path, $raw);
}
/**
* @inheritdoc
*/
public function getChecksum() {
return $this->getFileInfo()->getChecksum();
}

View file

@ -40,11 +40,6 @@ class Folder extends Node implements \OCP\Files\Folder {
return new NonExistingFolder($this->root, $this->view, $path);
}
/**
* @param string $path path relative to the folder
* @return string
* @throws \OCP\Files\NotPermittedException
*/
public function getFullPath($path) {
$path = $this->normalizePath($path);
if (!$this->isValidPath($path)) {
@ -53,30 +48,14 @@ class Folder extends Node implements \OCP\Files\Folder {
return $this->path . $path;
}
/**
* @param string $path
* @return string|null
*/
public function getRelativePath($path) {
return PathHelper::getRelativePath($this->getPath(), $path);
}
/**
* check if a node is a (grand-)child of the folder
*
* @param \OC\Files\Node\Node $node
* @return bool
*/
public function isSubNode($node) {
return str_starts_with($node->getPath(), $this->path . '/');
}
/**
* get the content of this directory
*
* @return Node[]
* @throws \OCP\Files\NotFoundException
*/
public function getDirectoryListing() {
$folderContent = $this->view->getDirectoryContent($this->path, '', $this->getFileInfo(false));
@ -103,21 +82,10 @@ class Folder extends Node implements \OCP\Files\Folder {
}
}
/**
* Get the node at $path
*
* @param string $path
* @return \OC\Files\Node\Node
* @throws \OCP\Files\NotFoundException
*/
public function get($path) {
return $this->root->get($this->getFullPath($path));
}
/**
* @param string $path
* @return bool
*/
public function nodeExists($path) {
try {
$this->get($path);
@ -127,11 +95,6 @@ class Folder extends Node implements \OCP\Files\Folder {
}
}
/**
* @param string $path
* @return \OC\Files\Node\Folder
* @throws \OCP\Files\NotPermittedException
*/
public function newFolder($path) {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_CREATE)) {
$fullPath = $this->getFullPath($path);
@ -149,12 +112,6 @@ class Folder extends Node implements \OCP\Files\Folder {
}
}
/**
* @param string $path
* @param string | resource | null $content
* @return \OC\Files\Node\File
* @throws \OCP\Files\NotPermittedException
*/
public function newFile($path, $content = null) {
if ($path === '') {
throw new NotPermittedException('Could not create as provided path is empty');
@ -189,12 +146,6 @@ class Folder extends Node implements \OCP\Files\Folder {
return new SearchQuery($operator, $limit, $offset, [], $user);
}
/**
* search for files with the name matching $query
*
* @param string|ISearchQuery $query
* @return \OC\Files\Node\Node[]
*/
public function search($query) {
if (is_string($query)) {
$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%' . $query . '%'));
@ -271,12 +222,6 @@ class Folder extends Node implements \OCP\Files\Folder {
);
}
/**
* search for files by mimetype
*
* @param string $mimetype
* @return Node[]
*/
public function searchByMime($mimetype) {
if (!str_contains($mimetype, '/')) {
$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%'));
@ -286,13 +231,6 @@ class Folder extends Node implements \OCP\Files\Folder {
return $this->search($query);
}
/**
* search for files by tag
*
* @param string|int $tag name or tag id
* @param string $userId owner of the tags
* @return Node[]
*/
public function searchByTag($tag, $userId) {
$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'tagname', $tag), $userId);
return $this->search($query);
@ -303,10 +241,6 @@ class Folder extends Node implements \OCP\Files\Folder {
return $this->search($query);
}
/**
* @param int $id
* @return \OCP\Files\Node[]
*/
public function getById($id) {
return $this->root->getByIdInPath((int)$id, $this->getPath());
}
@ -379,23 +313,11 @@ class Folder extends Node implements \OCP\Files\Folder {
}
}
/**
* Add a suffix to the name in case the file exists
*
* @param string $name
* @return string
* @throws NotPermittedException
*/
public function getNonExistingName($name) {
$uniqueName = \OC_Helper::buildNotExistingFileNameForView($this->getPath(), $name, $this->view);
return trim($this->getRelativePath($uniqueName), '/');
}
/**
* @param int $limit
* @param int $offset
* @return INode[]
*/
public function getRecent($limit, $offset = 0) {
$filterOutNonEmptyFolder = new SearchBinaryOperator(
// filter out non empty folders

View file

@ -134,9 +134,6 @@ class LazyFolder implements Folder {
$this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function get($path) {
return $this->getRootFolder()->get($this->getFullPath($path));
}
@ -148,37 +145,22 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function delete() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function copy($targetPath) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function touch($mtime = null) {
$this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getStorage() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getPath() {
if (isset($this->data['path'])) {
return $this->data['path'];
@ -186,16 +168,10 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getInternalPath() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getId() {
if (isset($this->data['fileid'])) {
return $this->data['fileid'];
@ -203,16 +179,10 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function stat() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getMTime() {
if (isset($this->data['mtime'])) {
return $this->data['mtime'];
@ -220,9 +190,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getSize($includeMounts = true): int|float {
if (isset($this->data['size'])) {
return $this->data['size'];
@ -230,9 +197,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getEtag() {
if (isset($this->data['etag'])) {
return $this->data['etag'];
@ -240,9 +204,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getPermissions() {
if (isset($this->data['permissions'])) {
return $this->data['permissions'];
@ -250,9 +211,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function isReadable() {
if (isset($this->data['permissions'])) {
return ($this->data['permissions'] & Constants::PERMISSION_READ) == Constants::PERMISSION_READ;
@ -260,9 +218,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function isUpdateable() {
if (isset($this->data['permissions'])) {
return ($this->data['permissions'] & Constants::PERMISSION_UPDATE) == Constants::PERMISSION_UPDATE;
@ -270,9 +225,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function isDeletable() {
if (isset($this->data['permissions'])) {
return ($this->data['permissions'] & Constants::PERMISSION_DELETE) == Constants::PERMISSION_DELETE;
@ -280,9 +232,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function isShareable() {
if (isset($this->data['permissions'])) {
return ($this->data['permissions'] & Constants::PERMISSION_SHARE) == Constants::PERMISSION_SHARE;
@ -290,16 +239,10 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getParent() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getName() {
if (isset($this->data['path'])) {
return basename($this->data['path']);
@ -317,9 +260,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getMimetype() {
if (isset($this->data['mimetype'])) {
return $this->data['mimetype'];
@ -327,9 +267,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getMimePart() {
if (isset($this->data['mimetype'])) {
[$part,] = explode('/', $this->data['mimetype']);
@ -338,16 +275,10 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function isEncrypted() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getType() {
if (isset($this->data['type'])) {
return $this->data['type'];
@ -355,37 +286,22 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function isShared() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function isMounted() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getMountPoint() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getOwner() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getChecksum() {
return $this->__call(__FUNCTION__, func_get_args());
}
@ -394,9 +310,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getFullPath($path) {
if (isset($this->data['path'])) {
$path = PathHelper::normalizePath($path);
@ -408,58 +321,34 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function isSubNode($node) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getDirectoryListing() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function nodeExists($path) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function newFolder($path) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function newFile($path, $content = null) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function search($query) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function searchByMime($mimetype) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function searchByTag($tag, $userId) {
return $this->__call(__FUNCTION__, func_get_args());
}
@ -468,9 +357,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getById($id) {
return $this->getRootFolder()->getByIdInPath((int)$id, $this->getPath());
}
@ -479,72 +365,42 @@ class LazyFolder implements Folder {
return $this->getRootFolder()->getFirstNodeByIdInPath($id, $this->getPath());
}
/**
* @inheritDoc
*/
public function getFreeSpace() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function isCreatable() {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getNonExistingName($name) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function move($targetPath) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function lock($type) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function changeLock($targetType) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function unlock($type) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getRecent($limit, $offset = 0) {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getCreationTime(): int {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
*/
public function getUploadTime(): int {
return $this->__call(__FUNCTION__, func_get_args());
}
@ -560,10 +416,6 @@ class LazyFolder implements Folder {
return $this->__call(__FUNCTION__, func_get_args());
}
/**
* @inheritDoc
* @return array<string, int|string|bool|float|string[]|int[]>
*/
public function getMetadata(): array {
return $this->data['metadata'] ?? $this->__call(__FUNCTION__, func_get_args());
}

View file

@ -18,7 +18,6 @@ use OCP\Files\IRootFolder;
use OCP\Files\Node as INode;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Lock\LockedException;
use OCP\PreConditionNotMetException;
// FIXME: this class really should be abstract (+1)
@ -133,12 +132,6 @@ class Node implements INode {
public function delete() {
}
/**
* @param int $mtime
* @throws InvalidPathException
* @throws NotFoundException
* @throws NotPermittedException
*/
public function touch($mtime = null) {
if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) {
$this->sendHooks(['preTouch']);
@ -163,114 +156,54 @@ class Node implements INode {
return $storage;
}
/**
* @return string
*/
public function getPath() {
return $this->path;
}
/**
* @return string
*/
public function getInternalPath() {
return $this->getFileInfo(false)->getInternalPath();
}
/**
* @return int
* @throws InvalidPathException
* @throws NotFoundException
*/
public function getId() {
return $this->getFileInfo(false)->getId() ?? -1;
}
/**
* @return array
*/
public function stat() {
return $this->view->stat($this->path);
}
/**
* @return int
* @throws InvalidPathException
* @throws NotFoundException
*/
public function getMTime() {
return $this->getFileInfo()->getMTime();
}
/**
* @param bool $includeMounts
* @return int|float
* @throws InvalidPathException
* @throws NotFoundException
*/
public function getSize($includeMounts = true): int|float {
return $this->getFileInfo()->getSize($includeMounts);
}
/**
* @return string
* @throws InvalidPathException
* @throws NotFoundException
*/
public function getEtag() {
return $this->getFileInfo()->getEtag();
}
/**
* @return int
* @throws InvalidPathException
* @throws NotFoundException
*/
public function getPermissions() {
return $this->getFileInfo(false)->getPermissions();
}
/**
* @return bool
* @throws InvalidPathException
* @throws NotFoundException
*/
public function isReadable() {
return $this->getFileInfo(false)->isReadable();
}
/**
* @return bool
* @throws InvalidPathException
* @throws NotFoundException
*/
public function isUpdateable() {
return $this->getFileInfo(false)->isUpdateable();
}
/**
* @return bool
* @throws InvalidPathException
* @throws NotFoundException
*/
public function isDeletable() {
return $this->getFileInfo(false)->isDeletable();
}
/**
* @return bool
* @throws InvalidPathException
* @throws NotFoundException
*/
public function isShareable() {
return $this->getFileInfo(false)->isShareable();
}
/**
* @return bool
* @throws InvalidPathException
* @throws NotFoundException
*/
public function isCreatable() {
return $this->getFileInfo(false)->isCreatable();
}
@ -306,9 +239,6 @@ class Node implements INode {
return $this->parent;
}
/**
* @return string
*/
public function getName() {
return basename($this->path);
}
@ -370,37 +300,18 @@ class Node implements INode {
return $this->getFileInfo(false)->getExtension();
}
/**
* @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
* @throws LockedException
*/
public function lock($type) {
$this->view->lockFile($this->path, $type);
}
/**
* @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
* @throws LockedException
*/
public function changeLock($type) {
$this->view->changeLock($this->path, $type);
}
/**
* @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE
* @throws LockedException
*/
public function unlock($type) {
$this->view->unlockFile($this->path, $type);
}
/**
* @param string $targetPath
* @return INode
* @throws InvalidPathException
* @throws NotFoundException
* @throws NotPermittedException if copy not allowed or failed
*/
public function copy($targetPath) {
$targetPath = $this->normalizePath($targetPath);
$parent = $this->root->get(dirname($targetPath));
@ -420,14 +331,6 @@ class Node implements INode {
}
}
/**
* @param string $targetPath
* @return INode
* @throws InvalidPathException
* @throws NotFoundException
* @throws NotPermittedException if move not allowed or failed
* @throws LockedException
*/
public function move($targetPath) {
$targetPath = $this->normalizePath($targetPath);
$parent = $this->root->get(dirname($targetPath));
@ -479,10 +382,6 @@ class Node implements INode {
return $this->fileInfo->getParentId();
}
/**
* @inheritDoc
* @return array<string, int|string|bool|float|string[]|int[]>
*/
public function getMetadata(): array {
return $this->fileInfo->getMetadata();
}

View file

@ -98,20 +98,10 @@ class Root extends Folder implements IRootFolder {
return $this->user;
}
/**
* @param string $scope
* @param string $method
* @param callable $callback
*/
public function listen($scope, $method, callable $callback) {
$this->emitter->listen($scope, $method, $callback);
}
/**
* @param string $scope optional
* @param string $method optional
* @param callable $callback optional
*/
public function removeListener($scope = null, $method = null, ?callable $callback = null) {
$this->emitter->removeListener($scope, $method, $callback);
}
@ -139,10 +129,6 @@ class Root extends Folder implements IRootFolder {
return $this->mountManager->find($mountPoint);
}
/**
* @param string $mountPoint
* @return \OC\Files\Mount\MountPoint[]
*/
public function getMountsIn(string $mountPoint): array {
return $this->mountManager->findIn($mountPoint);
}
@ -170,12 +156,6 @@ class Root extends Folder implements IRootFolder {
$this->mountManager->remove($mount);
}
/**
* @param string $path
* @return Node
* @throws \OCP\Files\NotPermittedException
* @throws \OCP\Files\NotFoundException
*/
public function get($path) {
$path = $this->normalizePath($path);
if ($this->isValidPath($path)) {
@ -206,138 +186,74 @@ class Root extends Folder implements IRootFolder {
throw new NotPermittedException();
}
/**
* @param string $targetPath
* @return Node
* @throws \OCP\Files\NotPermittedException
*/
public function copy($targetPath) {
throw new NotPermittedException();
}
/**
* @param int $mtime
* @throws \OCP\Files\NotPermittedException
*/
public function touch($mtime = null) {
throw new NotPermittedException();
}
/**
* @return \OC\Files\Storage\Storage
* @throws \OCP\Files\NotFoundException
*/
public function getStorage() {
throw new NotFoundException();
}
/**
* @return string
*/
public function getPath() {
return '/';
}
/**
* @return string
*/
public function getInternalPath() {
return '';
}
/**
* @return int
*/
public function getId() {
return 0;
}
/**
* @return array
*/
public function stat() {
return [];
}
/**
* @return int
*/
public function getMTime() {
return 0;
}
/**
* @param bool $includeMounts
* @return int|float
*/
public function getSize($includeMounts = true): int|float {
return 0;
}
/**
* @return string
*/
public function getEtag() {
return '';
}
/**
* @return int
*/
public function getPermissions() {
return \OCP\Constants::PERMISSION_CREATE;
}
/**
* @return bool
*/
public function isReadable() {
return false;
}
/**
* @return bool
*/
public function isUpdateable() {
return false;
}
/**
* @return bool
*/
public function isDeletable() {
return false;
}
/**
* @return bool
*/
public function isShareable() {
return false;
}
/**
* @throws \OCP\Files\NotFoundException
*/
public function getParent(): INode|IRootFolder {
throw new NotFoundException();
}
/**
* @return string
*/
public function getName() {
return '';
}
/**
* Returns a view to user's files folder
*
* @param string $userId user ID
* @return \OCP\Files\Folder
* @throws NoUserException
* @throws NotPermittedException
*/
public function getUserFolder($userId) {
$userObject = $this->userManager->get($userId);
@ -410,10 +326,6 @@ class Root extends Folder implements IRootFolder {
return $node;
}
/**
* @param int $id
* @return Node[]
*/
public function getByIdInPath(int $id, string $path): array {
$mountCache = $this->getUserMountCache();
if (strpos($path, '/', 1) > 0) {

View file

@ -25,22 +25,10 @@ class Change implements IChange {
$this->path = $path;
}
/**
* Get the type of the change
*
* @return int IChange::ADDED, IChange::REMOVED, IChange::MODIFIED or IChange::RENAMED
*/
public function getType() {
return $this->type;
}
/**
* Get the path of the file that was changed relative to the root of the storage
*
* Note, for rename changes this path is the old path for the file
*
* @return mixed
*/
public function getPath() {
return $this->path;
}

View file

@ -23,11 +23,6 @@ class RenameChange extends Change implements IRenameChange {
$this->targetPath = $targetPath;
}
/**
* Get the new path of the renamed file relative to the storage root
*
* @return string
*/
public function getTargetPath() {
return $this->targetPath;
}

View file

@ -66,18 +66,10 @@ class Azure implements IObjectStore {
return $this->blobClient;
}
/**
* @return string the container or bucket name where objects are stored
*/
public function getStorageId() {
return 'azure::blob::' . $this->containerName;
}
/**
* @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
*/
public function readObject($urn) {
$blob = $this->getBlobClient()->getBlob($this->containerName, $urn);
return $blob->getContentStream();
@ -91,11 +83,6 @@ class Azure implements IObjectStore {
$this->getBlobClient()->createBlockBlob($this->containerName, $urn, $stream, $options);
}
/**
* @param string $urn the unified resource name used to identify the object
* @return void
* @throws \Exception when something goes wrong, message will be logged
*/
public function deleteObject($urn) {
$this->getBlobClient()->deleteBlob($this->containerName, $urn);
}

Some files were not shown because too many files have changed in this diff Show more