Skip to content

Commit ce115ed

Browse files
committed
refactor: Remove old deprecated methods from OCP\Calendar
Signed-off-by: Carl Schwan <carlschwan@kde.org>
1 parent a8428f8 commit ce115ed

9 files changed

Lines changed: 28 additions & 358 deletions

File tree

lib/private/Calendar/Resource/Manager.php

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
use OC\AppFramework\Bootstrap\Coordinator;
1313
use OC\Calendar\ResourcesRoomsUpdater;
14-
use OCP\AppFramework\QueryException;
1514
use OCP\Calendar\Resource\IBackend;
1615
use OCP\Calendar\Resource\IManager;
1716
use Psr\Container\ContainerInterface;
@@ -21,11 +20,11 @@ class Manager implements IManager {
2120

2221
/**
2322
* @var string[] holds all registered resource backends
24-
* @psalm-var class-string<IBackend>[]
23+
* @psalm-var list<class-string<IBackend>>
2524
*/
2625
private array $backends = [];
2726

28-
/** @var IBackend[] holds all backends that have been initialized already */
27+
/** @var array<class-string<IBackend>, IBackend> holds all backends that have been initialized already */
2928
private array $initializedBackends = [];
3029

3130
public function __construct(
@@ -35,26 +34,6 @@ public function __construct(
3534
) {
3635
}
3736

38-
/**
39-
* Registers a resource backend
40-
*
41-
* @since 14.0.0
42-
*/
43-
#[\Override]
44-
public function registerBackend(string $backendClass): void {
45-
$this->backends[$backendClass] = $backendClass;
46-
}
47-
48-
/**
49-
* Unregisters a resource backend
50-
*
51-
* @since 14.0.0
52-
*/
53-
#[\Override]
54-
public function unregisterBackend(string $backendClass): void {
55-
unset($this->backends[$backendClass], $this->initializedBackends[$backendClass]);
56-
}
57-
5837
private function fetchBootstrapBackends(): void {
5938
if ($this->bootstrapBackendsLoaded) {
6039
return;
@@ -71,12 +50,6 @@ private function fetchBootstrapBackends(): void {
7150
}
7251
}
7352

74-
/**
75-
* @return IBackend[]
76-
* @throws QueryException
77-
* @since 14.0.0
78-
*/
79-
#[\Override]
8053
public function getBackends():array {
8154
$this->fetchBootstrapBackends();
8255

@@ -91,12 +64,7 @@ public function getBackends():array {
9164
return array_values($this->initializedBackends);
9265
}
9366

94-
/**
95-
* @param string $backendId
96-
* @throws QueryException
97-
*/
98-
#[\Override]
99-
public function getBackend($backendId): ?IBackend {
67+
public function getBackend(string $backendId): ?IBackend {
10068
$backends = $this->getBackends();
10169
foreach ($backends as $backend) {
10270
if ($backend->getBackendIdentifier() === $backendId) {
@@ -107,17 +75,6 @@ public function getBackend($backendId): ?IBackend {
10775
return null;
10876
}
10977

110-
/**
111-
* removes all registered backend instances
112-
*
113-
* @since 14.0.0
114-
*/
115-
#[\Override]
116-
public function clear(): void {
117-
$this->backends = [];
118-
$this->initializedBackends = [];
119-
}
120-
12178
#[\Override]
12279
public function update(): void {
12380
$this->updater->updateResources();

lib/private/Calendar/ResourcesRoomsUpdater.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
use OCP\Calendar\BackendTemporarilyUnavailableException;
1414
use OCP\Calendar\IMetadataProvider;
1515
use OCP\Calendar\Resource\IBackend as IResourceBackend;
16-
use OCP\Calendar\Resource\IManager as IResourceManager;
1716
use OCP\Calendar\Resource\IResource;
18-
use OCP\Calendar\Room\IManager as IRoomManager;
1917
use OCP\Calendar\Room\IRoom;
2018
use OCP\IDBConnection;
2119
use Psr\Container\ContainerInterface;
@@ -33,7 +31,7 @@ public function __construct(
3331
*/
3432
public function updateResources(): void {
3533
$this->updateFromBackend(
36-
$this->container->get(IResourceManager::class),
34+
$this->container->get(Resource\Manager::class),
3735
'calendar_resources',
3836
'calendar_resources_md',
3937
'resource_id',
@@ -46,7 +44,7 @@ public function updateResources(): void {
4644
*/
4745
public function updateRooms(): void {
4846
$this->updateFromBackend(
49-
$this->container->get(IRoomManager::class),
47+
$this->container->get(Room\Manager::class),
5048
'calendar_rooms',
5149
'calendar_rooms_md',
5250
'room_id',
@@ -57,7 +55,7 @@ public function updateRooms(): void {
5755
/**
5856
* Update cache from one specific backend manager, either ResourceManager or RoomManager
5957
*
60-
* @param IResourceManager|IRoomManager $backendManager
58+
* @param Resource\Manager|Room\Manager $backendManager
6159
*/
6260
private function updateFromBackend($backendManager,
6361
string $dbTable,
@@ -311,15 +309,9 @@ private function serializeGroupRestrictions(array $groups): string {
311309
/**
312310
* Gets all metadata of a backend
313311
*
314-
* @param IResource|IRoom $resource
315-
*
316-
* @return array
312+
* @return array<string, ?string>
317313
*/
318-
private function getAllMetadataOfBackend($resource): array {
319-
if (!($resource instanceof IMetadataProvider)) {
320-
return [];
321-
}
322-
314+
private function getAllMetadataOfBackend(IMetadataProvider $resource): array {
323315
$keys = $resource->getAllAvailableMetadataKeys();
324316
$metadata = [];
325317
foreach ($keys as $key) {

lib/private/Calendar/Room/Manager.php

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
use OC\AppFramework\Bootstrap\Coordinator;
1313
use OC\Calendar\ResourcesRoomsUpdater;
14-
use OCP\AppFramework\QueryException;
1514
use OCP\Calendar\Room\IBackend;
1615
use OCP\Calendar\Room\IManager;
1716
use Psr\Container\ContainerInterface;
@@ -35,27 +34,6 @@ public function __construct(
3534
) {
3635
}
3736

38-
/**
39-
* Registers a resource backend
40-
*
41-
* @since 14.0.0
42-
*/
43-
#[\Override]
44-
public function registerBackend(string $backendClass): void {
45-
$this->backends[$backendClass] = $backendClass;
46-
}
47-
48-
/**
49-
* Unregisters a resource backend
50-
*
51-
* @param string $backendClass
52-
* @since 14.0.0
53-
*/
54-
#[\Override]
55-
public function unregisterBackend(string $backendClass): void {
56-
unset($this->backends[$backendClass], $this->initializedBackends[$backendClass]);
57-
}
58-
5937
private function fetchBootstrapBackends(): void {
6038
if ($this->bootstrapBackendsLoaded) {
6139
return;
@@ -72,12 +50,6 @@ private function fetchBootstrapBackends(): void {
7250
}
7351
}
7452

75-
/**
76-
* @return IBackend[]
77-
* @throws QueryException
78-
* @since 14.0.0
79-
*/
80-
#[\Override]
8153
public function getBackends():array {
8254
$this->fetchBootstrapBackends();
8355

@@ -89,7 +61,7 @@ public function getBackends():array {
8961
/**
9062
* @todo fetch from the app container
9163
*
92-
* The backend might have services injected that can't be build from the
64+
* The backend might have services injected that can't be built from the
9365
* server container.
9466
*/
9567
$this->initializedBackends[$backend] = $this->container->get($backend);
@@ -98,12 +70,7 @@ public function getBackends():array {
9870
return array_values($this->initializedBackends);
9971
}
10072

101-
/**
102-
* @param string $backendId
103-
* @throws QueryException
104-
*/
105-
#[\Override]
106-
public function getBackend($backendId): ?IBackend {
73+
public function getBackend(string $backendId): ?IBackend {
10774
$backends = $this->getBackends();
10875
foreach ($backends as $backend) {
10976
if ($backend->getBackendIdentifier() === $backendId) {
@@ -114,17 +81,6 @@ public function getBackend($backendId): ?IBackend {
11481
return null;
11582
}
11683

117-
/**
118-
* removes all registered backend instances
119-
*
120-
* @since 14.0.0
121-
*/
122-
#[\Override]
123-
public function clear(): void {
124-
$this->backends = [];
125-
$this->initializedBackends = [];
126-
}
127-
12884
#[\Override]
12985
public function update(): void {
13086
$this->updater->updateRooms();

lib/public/Calendar/Resource/IManager.php

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,6 @@
1313
* @since 14.0.0
1414
*/
1515
interface IManager {
16-
/**
17-
* Registers a resource backend
18-
*
19-
* @param string $backendClass
20-
* @return void
21-
* @since 14.0.0
22-
* @deprecated 24.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerCalendarResourceBackend
23-
*/
24-
public function registerBackend(string $backendClass);
25-
26-
/**
27-
* Unregisters a resource backend
28-
*
29-
* @param string $backendClass
30-
* @return void
31-
* @since 14.0.0
32-
* @deprecated 24.0.0
33-
*/
34-
public function unregisterBackend(string $backendClass);
35-
36-
/**
37-
* @return IBackend[]
38-
* @since 14.0.0
39-
* @deprecated 24.0.0
40-
*/
41-
public function getBackends():array;
42-
43-
/**
44-
* @param string $backendId
45-
* @return IBackend|null
46-
* @since 14.0.0
47-
* @deprecated 24.0.0
48-
*/
49-
public function getBackend($backendId);
50-
51-
/**
52-
* removes all registered backend instances
53-
* @return void
54-
* @since 14.0.0
55-
* @deprecated 24.0.0
56-
*/
57-
public function clear();
58-
5916
/**
6017
* Update all resources from all backends right now.
6118
*

lib/public/Calendar/Room/IBackend.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
interface IBackend {
1818
/**
19-
* get a list of all rooms in this backend
19+
* Get a list of all rooms in this backend.
2020
*
2121
* @throws BackendTemporarilyUnavailableException
2222
* @return IRoom[]
@@ -25,7 +25,7 @@ interface IBackend {
2525
public function getAllRooms():array;
2626

2727
/**
28-
* get a list of all room identifiers in this backend
28+
* Get a list of all room identifiers in this backend.
2929
*
3030
* @throws BackendTemporarilyUnavailableException
3131
* @return string[]
@@ -34,7 +34,7 @@ public function getAllRooms():array;
3434
public function listAllRooms():array;
3535

3636
/**
37-
* get a room by it's id
37+
* Get a room by its id.
3838
*
3939
* @param string $id
4040
* @throws BackendTemporarilyUnavailableException
@@ -44,7 +44,7 @@ public function listAllRooms():array;
4444
public function getRoom($id);
4545

4646
/**
47-
* Get unique identifier of the backend
47+
* Get unique identifier of the backend.
4848
*
4949
* @return string
5050
* @since 14.0.0

lib/public/Calendar/Room/IManager.php

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,6 @@
1313
* @since 14.0.0
1414
*/
1515
interface IManager {
16-
/**
17-
* Registers a room backend
18-
*
19-
* @param string $backendClass
20-
* @return void
21-
* @since 14.0.0
22-
* @deprecated 24.0.0 use \OC\AppFramework\Bootstrap\::registerCalendarRoomBackend
23-
*/
24-
public function registerBackend(string $backendClass);
25-
26-
/**
27-
* Unregisters a room backend
28-
*
29-
* @param string $backendClass
30-
* @return void
31-
* @since 14.0.0
32-
* @deprecated 24.0.0
33-
*/
34-
public function unregisterBackend(string $backendClass);
35-
36-
/**
37-
* @return IBackend[]
38-
* @since 14.0.0
39-
* @deprecated 24.0.0
40-
*/
41-
public function getBackends():array;
42-
43-
/**
44-
* @param string $backendId
45-
* @return IBackend|null
46-
* @since 14.0.0
47-
* @deprecated 24.0.0
48-
*/
49-
public function getBackend($backendId);
50-
51-
/**
52-
* removes all registered backend instances
53-
* @return void
54-
* @since 14.0.0
55-
* @deprecated 24.0.0
56-
*/
57-
public function clear();
58-
5916
/**
6017
* Update all rooms from all backends right now.
6118
*

0 commit comments

Comments
 (0)