]> source.dussan.org Git - nextcloud-server.git/commitdiff
Inject the database connection
authorJoas Schilling <nickvergessen@owncloud.com>
Mon, 30 Nov 2015 08:42:11 +0000 (09:42 +0100)
committerJoas Schilling <nickvergessen@owncloud.com>
Mon, 30 Nov 2015 16:14:47 +0000 (17:14 +0100)
apps/files/appinfo/app.php
apps/files/lib/activity.php
apps/files/tests/activitytest.php

index c752b5e7d72be454a37d1ea34d9ef2bb4d3a3410..61ff6d748f99faccce897b73a878cd628ee72640 100644 (file)
@@ -65,6 +65,7 @@ $templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadshe
                new \OCA\Files\ActivityHelper(
                        \OC::$server->getTagManager()
                ),
+               \OC::$server->getDatabaseConnection(),
                \OC::$server->getConfig()
        );
 });
index 132f4169deeeebffa1456e6acdac47c42d43b7b0..23e3f26e62dc72e50d63491c7d9c602926f35b2a 100644 (file)
@@ -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 [
index 6a3424e727a72625d070d691d68d54bf3a6a5756..59c020c9042dd2671c1f25ba65bdee0243269feb 100644 (file)
@@ -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
                );