summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files/appinfo/app.php1
-rw-r--r--apps/files/lib/activity.php10
-rw-r--r--apps/files/tests/activitytest.php7
3 files changed, 16 insertions, 2 deletions
diff --git a/apps/files/appinfo/app.php b/apps/files/appinfo/app.php
index c752b5e7d72..61ff6d748f9 100644
--- a/apps/files/appinfo/app.php
+++ b/apps/files/appinfo/app.php
@@ -65,6 +65,7 @@ $templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadshe
new \OCA\Files\ActivityHelper(
\OC::$server->getTagManager()
),
+ \OC::$server->getDatabaseConnection(),
\OC::$server->getConfig()
);
});
diff --git a/apps/files/lib/activity.php b/apps/files/lib/activity.php
index 132f4169dee..23e3f26e62d 100644
--- a/apps/files/lib/activity.php
+++ b/apps/files/lib/activity.php
@@ -22,6 +22,7 @@
namespace OCA\Files;
+use OCP\IDBConnection;
use OCP\L10N\IFactory;
use OCP\Activity\IExtension;
use OCP\Activity\IManager;
@@ -52,6 +53,9 @@ class Activity implements IExtension {
/** @var \OCP\Activity\IManager */
protected $activityManager;
+ /** @var \OCP\IDBConnection */
+ protected $connection;
+
/** @var \OCP\IConfig */
protected $config;
@@ -63,14 +67,16 @@ class Activity implements IExtension {
* @param IURLGenerator $URLGenerator
* @param IManager $activityManager
* @param ActivityHelper $helper
+ * @param IDBConnection $connection
* @param IConfig $config
*/
- public function __construct(IFactory $languageFactory, IURLGenerator $URLGenerator, IManager $activityManager, ActivityHelper $helper, IConfig $config) {
+ public function __construct(IFactory $languageFactory, IURLGenerator $URLGenerator, IManager $activityManager, ActivityHelper $helper, IDBConnection $connection, IConfig $config) {
$this->languageFactory = $languageFactory;
$this->URLGenerator = $URLGenerator;
$this->l = $this->getL10N();
$this->activityManager = $activityManager;
$this->helper = $helper;
+ $this->connection = $connection;
$this->config = $config;
}
@@ -391,7 +397,7 @@ class Activity implements IExtension {
}
foreach ($favorites['folders'] as $favorite) {
$fileQueryList[] = '`file` LIKE ?';
- $parameters[] = \OC::$server->getDatabaseConnection()->escapeLikeParameter($favorite) . '/%';
+ $parameters[] = $this->connection->escapeLikeParameter($favorite) . '/%';
}
return [
diff --git a/apps/files/tests/activitytest.php b/apps/files/tests/activitytest.php
index 6a3424e727a..59c020c9042 100644
--- a/apps/files/tests/activitytest.php
+++ b/apps/files/tests/activitytest.php
@@ -25,6 +25,12 @@ namespace OCA\Files\Tests;
use OCA\Files\Activity;
use Test\TestCase;
+/**
+ * Class ActivityTest
+ *
+ * @group DB
+ * @package OCA\Files\Tests
+ */
class ActivityTest extends TestCase {
/** @var \OC\ActivityManager */
@@ -95,6 +101,7 @@ class ActivityTest extends TestCase {
$this->getMockBuilder('OCP\IURLGenerator')->disableOriginalConstructor()->getMock(),
$this->activityManager,
$this->activityHelper,
+ \OC::$server->getDatabaseConnection(),
$this->config
);