diff --git a/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_28.rst b/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_28.rst index 654ca3b3830..2f51832b365 100644 --- a/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_28.rst +++ b/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_28.rst @@ -45,7 +45,7 @@ Back-end changes Added APIs ^^^^^^^^^^ -* tbd +* ``\OCP\IEventSourceFactory``: To create a `OCP\IEventSource` instance. Changed APIs ^^^^^^^^^^^^ @@ -66,3 +66,17 @@ Removed APIs * ``\OC_App::getSettingsNavigation``: inject ``\OCP\App\IAppManager`` and call ``\OCP\App\IAppManager::getAll('settings')``. * ``\OC_App::isEnabled``: inject ``\OCP\App\IAppManager`` and call ``\OCP\App\IAppManager::isEnabledForUser``. * ``\OC_Defaults::getLogoClaim``: There is no replacement. +* `\OC::$server->createEventSource()` has been removed, use `\OC::$server->get(\OCP\IEventSourceFactory::class)->create()` instead. + +The factory `\OCP\IEventSourceFactory` works only from Nextcloud 28. For older versions use \OC::$server->createEventSource(). + +If you want to support Nextcloud 27 and Nextcloud 28: + +.. code-block:: php + +// @TODO: Remove method_exists when min-version="28" +if (method_exists(\OC::$server, 'createEventSource')) { + $eventSource = \OC::$server->createEventSource(); +} else { + $eventSource = \OCP\Server::get(IEventSourceFactory::class)->create(); +} \ No newline at end of file