aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/IDBConnection.php13
-rw-r--r--lib/public/Notification/IManager.php2
-rw-r--r--lib/public/Notification/INotifier.php5
-rw-r--r--lib/public/Notification/IPreloadableNotifier.php31
-rw-r--r--lib/public/TaskProcessing/IManager.php1
5 files changed, 49 insertions, 3 deletions
diff --git a/lib/public/IDBConnection.php b/lib/public/IDBConnection.php
index e0fe603ec57..ea9b71d8958 100644
--- a/lib/public/IDBConnection.php
+++ b/lib/public/IDBConnection.php
@@ -45,6 +45,11 @@ interface IDBConnection {
public const PLATFORM_SQLITE = 'sqlite';
/**
+ * @since 32.0.0
+ */
+ public const PLATFORM_MARIADB = 'mariadb';
+
+ /**
* Gets the QueryBuilder for the connection.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder
@@ -357,11 +362,15 @@ interface IDBConnection {
/**
* Returns the database provider name
+ *
* @link https://github.com/nextcloud/server/issues/30877
+ *
+ * @param bool $strict differentiate between database flavors, e.g. MySQL vs MariaDB
+ * @return self::PLATFORM_MYSQL|self::PLATFORM_ORACLE|self::PLATFORM_POSTGRES|self::PLATFORM_SQLITE|self::PLATFORM_MARIADB
+ * @since 32.0.0 Optional parameter $strict was added
* @since 28.0.0
- * @return self::PLATFORM_MYSQL|self::PLATFORM_ORACLE|self::PLATFORM_POSTGRES|self::PLATFORM_SQLITE
*/
- public function getDatabaseProvider(): string;
+ public function getDatabaseProvider(bool $strict = false): string;
/**
* Get the shard definition by name, if configured
diff --git a/lib/public/Notification/IManager.php b/lib/public/Notification/IManager.php
index 23664af17cd..207a89344b0 100644
--- a/lib/public/Notification/IManager.php
+++ b/lib/public/Notification/IManager.php
@@ -11,7 +11,7 @@ namespace OCP\Notification;
use OCP\AppFramework\Attribute\Consumable;
#[Consumable(since: '9.0.0')]
-interface IManager extends IApp, INotifier {
+interface IManager extends IApp, IPreloadableNotifier {
/**
* @param string $appClass The service must implement IApp, otherwise a
* \InvalidArgumentException is thrown later
diff --git a/lib/public/Notification/INotifier.php b/lib/public/Notification/INotifier.php
index bdc7207216f..b6851e3dfb3 100644
--- a/lib/public/Notification/INotifier.php
+++ b/lib/public/Notification/INotifier.php
@@ -10,6 +10,11 @@ namespace OCP\Notification;
use OCP\AppFramework\Attribute\Implementable;
+/**
+ * Please consider implementing {@see IPreloadableNotifier} to improve performance. It allows to
+ * preload and cache data for many notifications at once instead of loading the data for each
+ * prepared notification separately.
+ */
#[Implementable(since: '9.0.0')]
interface INotifier {
/**
diff --git a/lib/public/Notification/IPreloadableNotifier.php b/lib/public/Notification/IPreloadableNotifier.php
new file mode 100644
index 00000000000..2bdcd84d254
--- /dev/null
+++ b/lib/public/Notification/IPreloadableNotifier.php
@@ -0,0 +1,31 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Notification;
+
+use OCP\AppFramework\Attribute\Implementable;
+
+/**
+ * Allow notifier implementations to preload and cache data for many notifications at once to
+ * improve performance by, for example, bundling SQL queries.
+ */
+#[Implementable(since: '32.0.0')]
+interface IPreloadableNotifier extends INotifier {
+ /**
+ * This method provides a way for notifier implementations to preload and cache data for many
+ * notifications. The data is meant to be consumed later in the {@see INotifier::prepare()}
+ * method to improve performance.
+ *
+ * @since 32.0.0
+ *
+ * @param INotification[] $notifications The notifications which are about to be prepared in the next step.
+ * @param string $languageCode The code of the language that should be used to prepare the notification.
+ */
+ public function preloadDataForParsing(array $notifications, string $languageCode): void;
+}
diff --git a/lib/public/TaskProcessing/IManager.php b/lib/public/TaskProcessing/IManager.php
index f161030f5f4..723eca8f615 100644
--- a/lib/public/TaskProcessing/IManager.php
+++ b/lib/public/TaskProcessing/IManager.php
@@ -26,6 +26,7 @@ use OCP\TaskProcessing\Exception\ValidationException;
* @since 30.0.0
*/
interface IManager {
+
/**
* @since 30.0.0
*/