Skip to content

Commit ab2f9c6

Browse files
committed
docs(dev): remove deprecated createEventSource
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
1 parent dda5c9b commit ab2f9c6

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_28.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Back-end changes
4545
Added APIs
4646
^^^^^^^^^^
4747

48-
* tbd
48+
* ``\OCP\IEventSourceFactory``: To create a `OCP\IEventSource` instance.
4949

5050
Changed APIs
5151
^^^^^^^^^^^^
@@ -66,3 +66,17 @@ Removed APIs
6666
* ``\OC_App::getSettingsNavigation``: inject ``\OCP\App\IAppManager`` and call ``\OCP\App\IAppManager::getAll('settings')``.
6767
* ``\OC_App::isEnabled``: inject ``\OCP\App\IAppManager`` and call ``\OCP\App\IAppManager::isEnabledForUser``.
6868
* ``\OC_Defaults::getLogoClaim``: There is no replacement.
69+
* `\OC::$server->createEventSource()` has been removed, use `\OC::$server->get(\OCP\IEventSourceFactory::class)->create()` instead.
70+
71+
The factory `\OCP\IEventSourceFactory` works only from Nextcloud 28. For older versions use \OC::$server->createEventSource().
72+
73+
If you want to support Nextcloud 27 and Nextcloud 28:
74+
75+
.. code-block:: php
76+
77+
// @TODO: Remove method_exists when min-version="28"
78+
if (method_exists(\OC::$server, 'createEventSource')) {
79+
$eventSource = \OC::$server->createEventSource();
80+
} else {
81+
$eventSource = \OCP\Server::get(IEventSourceFactory::class)->create();
82+
}

0 commit comments

Comments
 (0)