Skip to content

Commit

Permalink
Update OCP
Browse files Browse the repository at this point in the history
  • Loading branch information
nextcloud-command committed Jan 17, 2025
1 parent 78c2623 commit ba6108b
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 47 deletions.
66 changes: 66 additions & 0 deletions OCP/Files/Conversion/ConversionMimeProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCP\Files\Conversion;

use JsonSerializable;

/**
* A tuple-like object representing both an original and target
* MIME type for a file conversion
*
* @since 31.0.0
*/
class ConversionMimeProvider implements JsonSerializable {
/**
* @param string $from The source MIME type of a file
* @param string $to The target MIME type for the file
* @param string $extension The file extension for the target MIME type (e.g. 'png')
* @param string $displayName The human-readable name of the target MIME type (e.g. 'Image (.png)')
*
* @since 31.0.0
*/
public function __construct(
private string $from,
private string $to,
private string $extension,
private string $displayName,
) {
}

public function getFrom(): string {
return $this->from;
}

public function getTo(): string {
return $this->to;
}

public function getExtension(): string {
return $this->extension;
}

public function getDisplayName(): string {
return $this->displayName;
}

/**
* @return array{from: string, to: string, extension: string, displayName: string}
*
* @since 31.0.0
*/
public function jsonSerialize(): array {
return [
'from' => $this->from,
'to' => $this->to,
'extension' => $this->extension,
'displayName' => $this->displayName,
];
}
}
44 changes: 0 additions & 44 deletions OCP/Files/Conversion/ConversionMimeTuple.php

This file was deleted.

4 changes: 2 additions & 2 deletions OCP/Files/Conversion/IConversionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ public function hasProviders(): bool;
/**
* Gets all supported MIME type conversions
*
* @return list<ConversionMimeTuple>
* @return list<ConversionMimeProvider>
*
* @since 31.0.0
*/
public function getMimeTypes(): array;
public function getProviders(): array;

/**
* Convert a file to a given MIME type
Expand Down
2 changes: 1 addition & 1 deletion OCP/Files/Conversion/IConversionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface IConversionProvider {
/**
* Get an array of MIME type tuples this conversion provider supports
*
* @return list<ConversionMimeTuple>
* @return list<ConversionMimeProvider>
*
* @since 31.0.0
*/
Expand Down
10 changes: 10 additions & 0 deletions OCP/IUserManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ public function createUserFromBackend($uid, $password, UserInterface $backend);
*/
public function countUsers();

/**
* Get how many users exists in total, whithin limit
*
* @param int $limit Limit the count to avoid resource waste. 0 to disable
* @param bool $onlyMappedUsers Count mapped users instead of all users for compatible backends
*
* @since 31.0.0
*/
public function countUsersTotal(int $limit = 0, bool $onlyMappedUsers = false): int|false;

/**
* @param \Closure $callback
* @psalm-param \Closure(\OCP\IUser):void $callback
Expand Down
1 change: 1 addition & 0 deletions OCP/User/Backend/ICountUsersBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

/**
* @since 14.0.0
* @deprecated 31.0.0 use and implement ILimitAwareCountUsersBackend instead.
*/
interface ICountUsersBackend {
/**
Expand Down
23 changes: 23 additions & 0 deletions OCP/User/Backend/ILimitAwareCountUsersBackend.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCP\User\Backend;

/**
* @since 31.0.0
*/
interface ILimitAwareCountUsersBackend extends ICountUsersBackend {
/**
* @since 31.0.0
*
* @param int $limit Limit to stop counting users if there are more than $limit. 0 to disable limiting.
* @return int|false The number of users (may be limited to $limit) on success false on failure
*/
public function countUsers(int $limit = 0): int|false;
}

0 comments on commit ba6108b

Please sign in to comment.