summaryrefslogtreecommitdiffstats
path: root/apps/encryption
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-07-06 12:34:19 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-07-21 15:25:47 +0200
commitde348180ae257017a9a2af05dac72286bf262bed (patch)
tree3fe07523249ca6a6e91defcff781b86be031b98c /apps/encryption
parent1bfb944d515c88f915739c3b920d39d6da200d29 (diff)
downloadnextcloud-server-de348180ae257017a9a2af05dac72286bf262bed.tar.gz
nextcloud-server-de348180ae257017a9a2af05dac72286bf262bed.zip
Use the public interface and our method instead of the doctrine thing
Diffstat (limited to 'apps/encryption')
-rw-r--r--apps/encryption/lib/migration.php14
-rw-r--r--apps/encryption/tests/lib/MigrationTest.php24
2 files changed, 19 insertions, 19 deletions
diff --git a/apps/encryption/lib/migration.php b/apps/encryption/lib/migration.php
index e6887e8cc07..a4da05d7f06 100644
--- a/apps/encryption/lib/migration.php
+++ b/apps/encryption/lib/migration.php
@@ -23,9 +23,9 @@
namespace OCA\Encryption;
-use OC\DB\Connection;
use OC\Files\View;
use OCP\IConfig;
+use OCP\IDBConnection;
use OCP\ILogger;
class Migration {
@@ -33,7 +33,7 @@ class Migration {
private $moduleId;
/** @var \OC\Files\View */
private $view;
- /** @var \OC\DB\Connection */
+ /** @var \OCP\IDBConnection */
private $connection;
/** @var IConfig */
private $config;
@@ -44,10 +44,10 @@ class Migration {
/**
* @param IConfig $config
* @param View $view
- * @param Connection $connection
+ * @param IDBConnection $connection
* @param ILogger $logger
*/
- public function __construct(IConfig $config, View $view, Connection $connection, ILogger $logger) {
+ public function __construct(IConfig $config, View $view, IDBConnection $connection, ILogger $logger) {
$this->view = $view;
$this->view->getUpdater()->disable();
$this->connection = $connection;
@@ -66,7 +66,7 @@ class Migration {
* update file cache, copy unencrypted_size to the 'size' column
*/
private function updateFileCache() {
- $query = $this->connection->createQueryBuilder();
+ $query = $this->connection->getQueryBuilder();
$query->update('`*PREFIX*filecache`')
->set('`size`', '`unencrypted_size`')
->where($query->expr()->eq('`encrypted`', ':encrypted'))
@@ -149,7 +149,7 @@ class Migration {
$this->config->deleteAppValue('files_encryption', 'types');
$this->config->deleteAppValue('files_encryption', 'enabled');
- $oldAppValues = $this->connection->createQueryBuilder();
+ $oldAppValues = $this->connection->getQueryBuilder();
$oldAppValues->select('*')
->from('`*PREFIX*appconfig`')
->where($oldAppValues->expr()->eq('`appid`', ':appid'))
@@ -164,7 +164,7 @@ class Migration {
}
}
- $oldPreferences = $this->connection->createQueryBuilder();
+ $oldPreferences = $this->connection->getQueryBuilder();
$oldPreferences->select('*')
->from('`*PREFIX*preferences`')
->where($oldPreferences->expr()->eq('`appid`', ':appid'))
diff --git a/apps/encryption/tests/lib/MigrationTest.php b/apps/encryption/tests/lib/MigrationTest.php
index 6742de574bf..c0d8f081342 100644
--- a/apps/encryption/tests/lib/MigrationTest.php
+++ b/apps/encryption/tests/lib/MigrationTest.php
@@ -288,14 +288,14 @@ class MigrationTest extends \Test\TestCase {
// delete default values set by the encryption app during initialization
- /** @var \OC\DB\Connection $connection */
+ /** @var \OCP\IDBConnection $connection */
$connection = \OC::$server->getDatabaseConnection();
- $query = $connection->createQueryBuilder();
+ $query = $connection->getQueryBuilder();
$query->delete('`*PREFIX*appconfig`')
->where($query->expr()->eq('`appid`', ':appid'))
->setParameter('appid', 'encryption');
$query->execute();
- $query = $connection->createQueryBuilder();
+ $query = $connection->getQueryBuilder();
$query->delete('`*PREFIX*preferences`')
->where($query->expr()->eq('`appid`', ':appid'))
->setParameter('appid', 'encryption');
@@ -368,9 +368,9 @@ class MigrationTest extends \Test\TestCase {
}
public function verifyDB($table, $appid, $expected) {
- /** @var \OC\DB\Connection $connection */
+ /** @var \OCP\IDBConnection $connection */
$connection = \OC::$server->getDatabaseConnection();
- $query = $connection->createQueryBuilder();
+ $query = $connection->getQueryBuilder();
$query->select('`appid`')
->from($table)
->where($query->expr()->eq('`appid`', ':appid'))
@@ -392,9 +392,9 @@ class MigrationTest extends \Test\TestCase {
// check results
- /** @var \OC\DB\Connection $connection */
+ /** @var \OCP\IDBConnection $connection */
$connection = \OC::$server->getDatabaseConnection();
- $query = $connection->createQueryBuilder();
+ $query = $connection->getQueryBuilder();
$query->select('*')
->from('`*PREFIX*filecache`');
$result = $query->execute();
@@ -411,17 +411,17 @@ class MigrationTest extends \Test\TestCase {
}
public function prepareFileCache() {
- /** @var \OC\DB\Connection $connection */
+ /** @var \OCP\IDBConnection $connection */
$connection = \OC::$server->getDatabaseConnection();
- $query = $connection->createQueryBuilder();
+ $query = $connection->getQueryBuilder();
$query->delete('`*PREFIX*filecache`');
$query->execute();
- $query = $connection->createQueryBuilder();
+ $query = $connection->getQueryBuilder();
$result = $query->select('`fileid`')
->from('`*PREFIX*filecache`')
->setMaxResults(1)->execute()->fetchAll();
$this->assertEmpty($result);
- $query = $connection->createQueryBuilder();
+ $query = $connection->getQueryBuilder();
$query->insert('`*PREFIX*filecache`')
->values(
array(
@@ -442,7 +442,7 @@ class MigrationTest extends \Test\TestCase {
$query->execute()
);
}
- $query = $connection->createQueryBuilder();
+ $query = $connection->getQueryBuilder();
$result = $query->select('`fileid`')
->from('`*PREFIX*filecache`')
->execute()->fetchAll();