summaryrefslogtreecommitdiffstats
path: root/apps
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
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')
-rw-r--r--apps/encryption/lib/migration.php14
-rw-r--r--apps/encryption/tests/lib/MigrationTest.php24
-rw-r--r--apps/files_trashbin/command/cleanup.php4
-rw-r--r--apps/files_trashbin/tests/command/cleanuptest.php8
4 files changed, 25 insertions, 25 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();
diff --git a/apps/files_trashbin/command/cleanup.php b/apps/files_trashbin/command/cleanup.php
index 961f72763ea..de17020ea5c 100644
--- a/apps/files_trashbin/command/cleanup.php
+++ b/apps/files_trashbin/command/cleanup.php
@@ -38,7 +38,7 @@ class CleanUp extends Command {
/** @var IRootFolder */
protected $rootFolder;
- /** @var \OC\DB\Connection */
+ /** @var \OCP\IDBConnection */
protected $dbConnection;
/**
@@ -107,7 +107,7 @@ class CleanUp extends Command {
\OC_Util::setupFS($uid);
if ($this->rootFolder->nodeExists('/' . $uid . '/files_trashbin')) {
$this->rootFolder->get('/' . $uid . '/files_trashbin')->delete();
- $query = $this->dbConnection->createQueryBuilder();
+ $query = $this->dbConnection->getQueryBuilder();
$query->delete('`*PREFIX*files_trash`')
->where($query->expr()->eq('`user`', ':uid'))
->setParameter('uid', $uid);
diff --git a/apps/files_trashbin/tests/command/cleanuptest.php b/apps/files_trashbin/tests/command/cleanuptest.php
index 6e2f78093e0..ecbaab98bf2 100644
--- a/apps/files_trashbin/tests/command/cleanuptest.php
+++ b/apps/files_trashbin/tests/command/cleanuptest.php
@@ -64,7 +64,7 @@ class CleanUpTest extends TestCase {
* populate files_trash table with 10 dummy values
*/
public function initTable() {
- $query = $this->dbConnection->createQueryBuilder();
+ $query = $this->dbConnection->getQueryBuilder();
$query->delete($this->trashTable)->execute();
for ($i = 0; $i < 10; $i++) {
$query->insert($this->trashTable)
@@ -75,7 +75,7 @@ class CleanUpTest extends TestCase {
'`user`' => $query->expr()->literal('user'.$i%2)
))->execute();
}
- $getAllQuery = $this->dbConnection->createQueryBuilder();
+ $getAllQuery = $this->dbConnection->getQueryBuilder();
$result = $getAllQuery->select('`id`')->from($this->trashTable)->execute()->fetchAll();
$this->assertSame(10, count($result));
}
@@ -106,7 +106,7 @@ class CleanUpTest extends TestCase {
if ($nodeExists) {
// if the delete operation was execute only files from user1
// should be left.
- $query = $this->dbConnection->createQueryBuilder();
+ $query = $this->dbConnection->getQueryBuilder();
$result = $query->select('`user`')
->from($this->trashTable)
->execute()->fetchAll();
@@ -117,7 +117,7 @@ class CleanUpTest extends TestCase {
} else {
// if no delete operation was execute we should still have all 10
// database entries
- $getAllQuery = $this->dbConnection->createQueryBuilder();
+ $getAllQuery = $this->dbConnection->getQueryBuilder();
$result = $getAllQuery->select('`id`')->from($this->trashTable)->execute()->fetchAll();
$this->assertSame(10, count($result));
}