Skip to content

Commit 02eb08a

Browse files
authored
Merge pull request #1479 from tintou/tintou/nc-deprecation
Update to Nextcloud 32 deprecation removals
2 parents e249102 + 4a95027 commit 02eb08a

File tree

2 files changed

+7
-51
lines changed

2 files changed

+7
-51
lines changed

lib/Hooks/FileHooks.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use OCP\Files\FileInfo;
1919
use OCP\Files\IRootFolder;
2020
use OCP\Lock\ILockingProvider;
21-
use OCP\Share;
21+
use OCP\Share\IShare;
2222
use OCP\Util;
2323
use function OCP\Log\logger;
2424

@@ -139,7 +139,7 @@ public function postShare($params) {
139139

140140
public function postUnShare($params) {
141141
//logger('maps')->debug("Hook postUnShare");
142-
if ($params['shareType'] === Share::SHARE_TYPE_USER) {
142+
if ($params['shareType'] === IShare::TYPE_USER) {
143143
if ($params['itemType'] === 'file') {
144144
$targetUserId = $params['shareWith'];
145145
$fileId = $params['fileSource']; // or itemSource
@@ -151,7 +151,7 @@ public function postUnShare($params) {
151151

152152
public function preUnShare($params) {
153153
//logger('maps')->debug("Hook preUnShare");
154-
if ($params['shareType'] === Share::SHARE_TYPE_USER) {
154+
if ($params['shareType'] === IShare::TYPE_USER) {
155155
if ($params['itemType'] === 'folder') {
156156
$targetUserId = $params['shareWith'];
157157
$dirId = $params['fileSource']; // or itemSource

tests/stubs/oc_share_constants.php

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,60 +10,16 @@
1010
use OCP\Share\IShare;
1111

1212
class Constants {
13-
/**
14-
* @deprecated 17.0.0 - use IShare::TYPE_USER instead
15-
*/
16-
public const SHARE_TYPE_USER = 0;
17-
/**
18-
* @deprecated 17.0.0 - use IShare::TYPE_GROUP instead
19-
*/
20-
public const SHARE_TYPE_GROUP = 1;
21-
// const SHARE_TYPE_USERGROUP = 2; // Internal type used by DefaultShareProvider
22-
/**
23-
* @deprecated 17.0.0 - use IShare::TYPE_LINK instead
24-
*/
25-
public const SHARE_TYPE_LINK = 3;
26-
/**
27-
* @deprecated 17.0.0 - use IShare::TYPE_EMAIL instead
28-
*/
29-
public const SHARE_TYPE_EMAIL = 4;
30-
public const SHARE_TYPE_CONTACT = 5; // ToDo Check if it is still in use otherwise remove it
31-
/**
32-
* @deprecated 17.0.0 - use IShare::TYPE_REMOTE instead
33-
*/
34-
public const SHARE_TYPE_REMOTE = 6;
35-
/**
36-
* @deprecated 17.0.0 - use IShare::TYPE_CIRCLE instead
37-
*/
38-
public const SHARE_TYPE_CIRCLE = 7;
39-
/**
40-
* @deprecated 17.0.0 - use IShare::TYPE_GUEST instead
41-
*/
42-
public const SHARE_TYPE_GUEST = 8;
43-
/**
44-
* @deprecated 17.0.0 - use IShare::REMOTE_GROUP instead
45-
*/
46-
public const SHARE_TYPE_REMOTE_GROUP = 9;
47-
/**
48-
* @deprecated 17.0.0 - use IShare::TYPE_ROOM instead
49-
*/
50-
public const SHARE_TYPE_ROOM = 10;
51-
// const SHARE_TYPE_USERROOM = 11; // Internal type used by RoomShareProvider
52-
/**
53-
* @deprecated 21.0.0 - use IShare::TYPE_DECK instead
54-
*/
55-
public const SHARE_TYPE_DECK = 12;
56-
// const SHARE_TYPE_DECK_USER = 13; // Internal type used by DeckShareProvider
57-
58-
// Note to developers: Do not add new share types here
59-
6013
public const FORMAT_NONE = -1;
6114
public const FORMAT_STATUSES = -2;
6215
public const FORMAT_SOURCES = -3; // ToDo Check if it is still in use otherwise remove it
6316

6417
public const RESPONSE_FORMAT = 'json'; // default response format for ocs calls
6518

66-
public const TOKEN_LENGTH = 15; // old (oc7) length is 32, keep token length in db at least that for compatibility
19+
public const MIN_TOKEN_LENGTH = 6; // 19,770,609,664 different possible variations
20+
public const DEFAULT_TOKEN_LENGTH = 15; // 54,960,434,128,018,667,122,720,768 different possible variations
21+
public const MAX_TOKEN_LENGTH = 32; // 8,167,835,760,036,914,488,254,418,108,462,708,901,695,678,621,570,564,096 different possible variations
22+
public const TOKEN_LENGTH = self::DEFAULT_TOKEN_LENGTH; // old (oc7) length is 32, keep token length in db at least that for compatibility
6723

6824
protected static $shareTypeUserAndGroups = -1;
6925
protected static $shareTypeGroupUserUnique = 2;

0 commit comments

Comments
 (0)