Use the public interface and our method instead of the doctrine thing
This commit is contained in:
parent
1bfb944d51
commit
de348180ae
|
@ -23,9 +23,9 @@
|
||||||
namespace OCA\Encryption;
|
namespace OCA\Encryption;
|
||||||
|
|
||||||
|
|
||||||
use OC\DB\Connection;
|
|
||||||
use OC\Files\View;
|
use OC\Files\View;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
|
use OCP\IDBConnection;
|
||||||
use OCP\ILogger;
|
use OCP\ILogger;
|
||||||
|
|
||||||
class Migration {
|
class Migration {
|
||||||
|
@ -33,7 +33,7 @@ class Migration {
|
||||||
private $moduleId;
|
private $moduleId;
|
||||||
/** @var \OC\Files\View */
|
/** @var \OC\Files\View */
|
||||||
private $view;
|
private $view;
|
||||||
/** @var \OC\DB\Connection */
|
/** @var \OCP\IDBConnection */
|
||||||
private $connection;
|
private $connection;
|
||||||
/** @var IConfig */
|
/** @var IConfig */
|
||||||
private $config;
|
private $config;
|
||||||
|
@ -44,10 +44,10 @@ class Migration {
|
||||||
/**
|
/**
|
||||||
* @param IConfig $config
|
* @param IConfig $config
|
||||||
* @param View $view
|
* @param View $view
|
||||||
* @param Connection $connection
|
* @param IDBConnection $connection
|
||||||
* @param ILogger $logger
|
* @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 = $view;
|
||||||
$this->view->getUpdater()->disable();
|
$this->view->getUpdater()->disable();
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
|
@ -66,7 +66,7 @@ class Migration {
|
||||||
* update file cache, copy unencrypted_size to the 'size' column
|
* update file cache, copy unencrypted_size to the 'size' column
|
||||||
*/
|
*/
|
||||||
private function updateFileCache() {
|
private function updateFileCache() {
|
||||||
$query = $this->connection->createQueryBuilder();
|
$query = $this->connection->getQueryBuilder();
|
||||||
$query->update('`*PREFIX*filecache`')
|
$query->update('`*PREFIX*filecache`')
|
||||||
->set('`size`', '`unencrypted_size`')
|
->set('`size`', '`unencrypted_size`')
|
||||||
->where($query->expr()->eq('`encrypted`', ':encrypted'))
|
->where($query->expr()->eq('`encrypted`', ':encrypted'))
|
||||||
|
@ -149,7 +149,7 @@ class Migration {
|
||||||
$this->config->deleteAppValue('files_encryption', 'types');
|
$this->config->deleteAppValue('files_encryption', 'types');
|
||||||
$this->config->deleteAppValue('files_encryption', 'enabled');
|
$this->config->deleteAppValue('files_encryption', 'enabled');
|
||||||
|
|
||||||
$oldAppValues = $this->connection->createQueryBuilder();
|
$oldAppValues = $this->connection->getQueryBuilder();
|
||||||
$oldAppValues->select('*')
|
$oldAppValues->select('*')
|
||||||
->from('`*PREFIX*appconfig`')
|
->from('`*PREFIX*appconfig`')
|
||||||
->where($oldAppValues->expr()->eq('`appid`', ':appid'))
|
->where($oldAppValues->expr()->eq('`appid`', ':appid'))
|
||||||
|
@ -164,7 +164,7 @@ class Migration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$oldPreferences = $this->connection->createQueryBuilder();
|
$oldPreferences = $this->connection->getQueryBuilder();
|
||||||
$oldPreferences->select('*')
|
$oldPreferences->select('*')
|
||||||
->from('`*PREFIX*preferences`')
|
->from('`*PREFIX*preferences`')
|
||||||
->where($oldPreferences->expr()->eq('`appid`', ':appid'))
|
->where($oldPreferences->expr()->eq('`appid`', ':appid'))
|
||||||
|
|
|
@ -288,14 +288,14 @@ class MigrationTest extends \Test\TestCase {
|
||||||
|
|
||||||
// delete default values set by the encryption app during initialization
|
// delete default values set by the encryption app during initialization
|
||||||
|
|
||||||
/** @var \OC\DB\Connection $connection */
|
/** @var \OCP\IDBConnection $connection */
|
||||||
$connection = \OC::$server->getDatabaseConnection();
|
$connection = \OC::$server->getDatabaseConnection();
|
||||||
$query = $connection->createQueryBuilder();
|
$query = $connection->getQueryBuilder();
|
||||||
$query->delete('`*PREFIX*appconfig`')
|
$query->delete('`*PREFIX*appconfig`')
|
||||||
->where($query->expr()->eq('`appid`', ':appid'))
|
->where($query->expr()->eq('`appid`', ':appid'))
|
||||||
->setParameter('appid', 'encryption');
|
->setParameter('appid', 'encryption');
|
||||||
$query->execute();
|
$query->execute();
|
||||||
$query = $connection->createQueryBuilder();
|
$query = $connection->getQueryBuilder();
|
||||||
$query->delete('`*PREFIX*preferences`')
|
$query->delete('`*PREFIX*preferences`')
|
||||||
->where($query->expr()->eq('`appid`', ':appid'))
|
->where($query->expr()->eq('`appid`', ':appid'))
|
||||||
->setParameter('appid', 'encryption');
|
->setParameter('appid', 'encryption');
|
||||||
|
@ -368,9 +368,9 @@ class MigrationTest extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verifyDB($table, $appid, $expected) {
|
public function verifyDB($table, $appid, $expected) {
|
||||||
/** @var \OC\DB\Connection $connection */
|
/** @var \OCP\IDBConnection $connection */
|
||||||
$connection = \OC::$server->getDatabaseConnection();
|
$connection = \OC::$server->getDatabaseConnection();
|
||||||
$query = $connection->createQueryBuilder();
|
$query = $connection->getQueryBuilder();
|
||||||
$query->select('`appid`')
|
$query->select('`appid`')
|
||||||
->from($table)
|
->from($table)
|
||||||
->where($query->expr()->eq('`appid`', ':appid'))
|
->where($query->expr()->eq('`appid`', ':appid'))
|
||||||
|
@ -392,9 +392,9 @@ class MigrationTest extends \Test\TestCase {
|
||||||
|
|
||||||
// check results
|
// check results
|
||||||
|
|
||||||
/** @var \OC\DB\Connection $connection */
|
/** @var \OCP\IDBConnection $connection */
|
||||||
$connection = \OC::$server->getDatabaseConnection();
|
$connection = \OC::$server->getDatabaseConnection();
|
||||||
$query = $connection->createQueryBuilder();
|
$query = $connection->getQueryBuilder();
|
||||||
$query->select('*')
|
$query->select('*')
|
||||||
->from('`*PREFIX*filecache`');
|
->from('`*PREFIX*filecache`');
|
||||||
$result = $query->execute();
|
$result = $query->execute();
|
||||||
|
@ -411,17 +411,17 @@ class MigrationTest extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepareFileCache() {
|
public function prepareFileCache() {
|
||||||
/** @var \OC\DB\Connection $connection */
|
/** @var \OCP\IDBConnection $connection */
|
||||||
$connection = \OC::$server->getDatabaseConnection();
|
$connection = \OC::$server->getDatabaseConnection();
|
||||||
$query = $connection->createQueryBuilder();
|
$query = $connection->getQueryBuilder();
|
||||||
$query->delete('`*PREFIX*filecache`');
|
$query->delete('`*PREFIX*filecache`');
|
||||||
$query->execute();
|
$query->execute();
|
||||||
$query = $connection->createQueryBuilder();
|
$query = $connection->getQueryBuilder();
|
||||||
$result = $query->select('`fileid`')
|
$result = $query->select('`fileid`')
|
||||||
->from('`*PREFIX*filecache`')
|
->from('`*PREFIX*filecache`')
|
||||||
->setMaxResults(1)->execute()->fetchAll();
|
->setMaxResults(1)->execute()->fetchAll();
|
||||||
$this->assertEmpty($result);
|
$this->assertEmpty($result);
|
||||||
$query = $connection->createQueryBuilder();
|
$query = $connection->getQueryBuilder();
|
||||||
$query->insert('`*PREFIX*filecache`')
|
$query->insert('`*PREFIX*filecache`')
|
||||||
->values(
|
->values(
|
||||||
array(
|
array(
|
||||||
|
@ -442,7 +442,7 @@ class MigrationTest extends \Test\TestCase {
|
||||||
$query->execute()
|
$query->execute()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$query = $connection->createQueryBuilder();
|
$query = $connection->getQueryBuilder();
|
||||||
$result = $query->select('`fileid`')
|
$result = $query->select('`fileid`')
|
||||||
->from('`*PREFIX*filecache`')
|
->from('`*PREFIX*filecache`')
|
||||||
->execute()->fetchAll();
|
->execute()->fetchAll();
|
||||||
|
|
|
@ -38,7 +38,7 @@ class CleanUp extends Command {
|
||||||
/** @var IRootFolder */
|
/** @var IRootFolder */
|
||||||
protected $rootFolder;
|
protected $rootFolder;
|
||||||
|
|
||||||
/** @var \OC\DB\Connection */
|
/** @var \OCP\IDBConnection */
|
||||||
protected $dbConnection;
|
protected $dbConnection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,7 +107,7 @@ class CleanUp extends Command {
|
||||||
\OC_Util::setupFS($uid);
|
\OC_Util::setupFS($uid);
|
||||||
if ($this->rootFolder->nodeExists('/' . $uid . '/files_trashbin')) {
|
if ($this->rootFolder->nodeExists('/' . $uid . '/files_trashbin')) {
|
||||||
$this->rootFolder->get('/' . $uid . '/files_trashbin')->delete();
|
$this->rootFolder->get('/' . $uid . '/files_trashbin')->delete();
|
||||||
$query = $this->dbConnection->createQueryBuilder();
|
$query = $this->dbConnection->getQueryBuilder();
|
||||||
$query->delete('`*PREFIX*files_trash`')
|
$query->delete('`*PREFIX*files_trash`')
|
||||||
->where($query->expr()->eq('`user`', ':uid'))
|
->where($query->expr()->eq('`user`', ':uid'))
|
||||||
->setParameter('uid', $uid);
|
->setParameter('uid', $uid);
|
||||||
|
|
|
@ -64,7 +64,7 @@ class CleanUpTest extends TestCase {
|
||||||
* populate files_trash table with 10 dummy values
|
* populate files_trash table with 10 dummy values
|
||||||
*/
|
*/
|
||||||
public function initTable() {
|
public function initTable() {
|
||||||
$query = $this->dbConnection->createQueryBuilder();
|
$query = $this->dbConnection->getQueryBuilder();
|
||||||
$query->delete($this->trashTable)->execute();
|
$query->delete($this->trashTable)->execute();
|
||||||
for ($i = 0; $i < 10; $i++) {
|
for ($i = 0; $i < 10; $i++) {
|
||||||
$query->insert($this->trashTable)
|
$query->insert($this->trashTable)
|
||||||
|
@ -75,7 +75,7 @@ class CleanUpTest extends TestCase {
|
||||||
'`user`' => $query->expr()->literal('user'.$i%2)
|
'`user`' => $query->expr()->literal('user'.$i%2)
|
||||||
))->execute();
|
))->execute();
|
||||||
}
|
}
|
||||||
$getAllQuery = $this->dbConnection->createQueryBuilder();
|
$getAllQuery = $this->dbConnection->getQueryBuilder();
|
||||||
$result = $getAllQuery->select('`id`')->from($this->trashTable)->execute()->fetchAll();
|
$result = $getAllQuery->select('`id`')->from($this->trashTable)->execute()->fetchAll();
|
||||||
$this->assertSame(10, count($result));
|
$this->assertSame(10, count($result));
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ class CleanUpTest extends TestCase {
|
||||||
if ($nodeExists) {
|
if ($nodeExists) {
|
||||||
// if the delete operation was execute only files from user1
|
// if the delete operation was execute only files from user1
|
||||||
// should be left.
|
// should be left.
|
||||||
$query = $this->dbConnection->createQueryBuilder();
|
$query = $this->dbConnection->getQueryBuilder();
|
||||||
$result = $query->select('`user`')
|
$result = $query->select('`user`')
|
||||||
->from($this->trashTable)
|
->from($this->trashTable)
|
||||||
->execute()->fetchAll();
|
->execute()->fetchAll();
|
||||||
|
@ -117,7 +117,7 @@ class CleanUpTest extends TestCase {
|
||||||
} else {
|
} else {
|
||||||
// if no delete operation was execute we should still have all 10
|
// if no delete operation was execute we should still have all 10
|
||||||
// database entries
|
// database entries
|
||||||
$getAllQuery = $this->dbConnection->createQueryBuilder();
|
$getAllQuery = $this->dbConnection->getQueryBuilder();
|
||||||
$result = $getAllQuery->select('`id`')->from($this->trashTable)->execute()->fetchAll();
|
$result = $getAllQuery->select('`id`')->from($this->trashTable)->execute()->fetchAll();
|
||||||
$this->assertSame(10, count($result));
|
$this->assertSame(10, count($result));
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,14 +103,14 @@ class Repair extends BasicEmitter {
|
||||||
public static function getRepairSteps() {
|
public static function getRepairSteps() {
|
||||||
return array(
|
return array(
|
||||||
new RepairMimeTypes(),
|
new RepairMimeTypes(),
|
||||||
new RepairLegacyStorages(\OC::$server->getConfig(), \OC_DB::getConnection()),
|
new RepairLegacyStorages(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()),
|
||||||
new RepairConfig(),
|
new RepairConfig(),
|
||||||
new AssetCache(),
|
new AssetCache(),
|
||||||
new FillETags(\OC_DB::getConnection()),
|
new FillETags(\OC::$server->getDatabaseConnection()),
|
||||||
new CleanTags(\OC_DB::getConnection()),
|
new CleanTags(\OC::$server->getDatabaseConnection()),
|
||||||
new DropOldTables(\OC_DB::getConnection()),
|
new DropOldTables(\OC::$server->getDatabaseConnection()),
|
||||||
new DropOldJobs(\OC::$server->getJobList()),
|
new DropOldJobs(\OC::$server->getJobList()),
|
||||||
new RemoveGetETagEntries(\OC_DB::getConnection()),
|
new RemoveGetETagEntries(\OC::$server->getDatabaseConnection()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
namespace OC\Share;
|
namespace OC\Share;
|
||||||
|
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
use OC\DB\Connection;
|
use OCP\IDBConnection;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1195,13 +1195,13 @@ class Share extends Constants {
|
||||||
/**
|
/**
|
||||||
* Retrieve the owner of a connection
|
* Retrieve the owner of a connection
|
||||||
*
|
*
|
||||||
* @param Connection $connection
|
* @param IDBConnection $connection
|
||||||
* @param int $shareId
|
* @param int $shareId
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @return string uid of share owner
|
* @return string uid of share owner
|
||||||
*/
|
*/
|
||||||
private static function getShareOwner(Connection $connection, $shareId) {
|
private static function getShareOwner(IDBConnection $connection, $shareId) {
|
||||||
$qb = $connection->createQueryBuilder();
|
$qb = $connection->getQueryBuilder();
|
||||||
|
|
||||||
$qb->select('`uid_owner`')
|
$qb->select('`uid_owner`')
|
||||||
->from('`*PREFIX*share`')
|
->from('`*PREFIX*share`')
|
||||||
|
@ -1221,7 +1221,7 @@ class Share extends Constants {
|
||||||
* Set expiration date for a share
|
* Set expiration date for a share
|
||||||
*
|
*
|
||||||
* @param IUserSession $userSession
|
* @param IUserSession $userSession
|
||||||
* @param Connection $connection
|
* @param IDBConnection $connection
|
||||||
* @param IConfig $config
|
* @param IConfig $config
|
||||||
* @param int $shareId
|
* @param int $shareId
|
||||||
* @param string $password
|
* @param string $password
|
||||||
|
@ -1229,7 +1229,7 @@ class Share extends Constants {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function setPassword(IUserSession $userSession,
|
public static function setPassword(IUserSession $userSession,
|
||||||
Connection $connection,
|
IDBConnection $connection,
|
||||||
IConfig $config,
|
IConfig $config,
|
||||||
$shareId, $password) {
|
$shareId, $password) {
|
||||||
$user = $userSession->getUser();
|
$user = $userSession->getUser();
|
||||||
|
@ -1252,7 +1252,7 @@ class Share extends Constants {
|
||||||
throw new \Exception('Cannot remove password');
|
throw new \Exception('Cannot remove password');
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb = $connection->createQueryBuilder();
|
$qb = $connection->getQueryBuilder();
|
||||||
$qb->update('`*PREFIX*share`')
|
$qb->update('`*PREFIX*share`')
|
||||||
->set('`share_with`', ':pass')
|
->set('`share_with`', ':pass')
|
||||||
->where('`id` = :shareId')
|
->where('`id` = :shareId')
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
|
|
||||||
namespace OC\Repair;
|
namespace OC\Repair;
|
||||||
|
|
||||||
use OC\DB\Connection;
|
|
||||||
use OC\Hooks\BasicEmitter;
|
use OC\Hooks\BasicEmitter;
|
||||||
use OC\RepairStep;
|
use OC\RepairStep;
|
||||||
|
use OCP\IDBConnection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RepairConfig
|
* Class RepairConfig
|
||||||
|
@ -33,13 +33,13 @@ use OC\RepairStep;
|
||||||
*/
|
*/
|
||||||
class CleanTags extends BasicEmitter implements RepairStep {
|
class CleanTags extends BasicEmitter implements RepairStep {
|
||||||
|
|
||||||
/** @var Connection */
|
/** @var IDBConnection */
|
||||||
protected $connection;
|
protected $connection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Connection $connection
|
* @param IDBConnection $connection
|
||||||
*/
|
*/
|
||||||
public function __construct(Connection $connection) {
|
public function __construct(IDBConnection $connection) {
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ class CleanTags extends BasicEmitter implements RepairStep {
|
||||||
* the entry is deleted in the $deleteTable
|
* the entry is deleted in the $deleteTable
|
||||||
*/
|
*/
|
||||||
protected function deleteOrphanEntries($repairInfo, $deleteTable, $deleteId, $sourceTable, $sourceId, $sourceNullColumn) {
|
protected function deleteOrphanEntries($repairInfo, $deleteTable, $deleteId, $sourceTable, $sourceId, $sourceNullColumn) {
|
||||||
$qb = $this->connection->createQueryBuilder();
|
$qb = $this->connection->getQueryBuilder();
|
||||||
|
|
||||||
$qb->select('d.`' . $deleteId . '`')
|
$qb->select('d.`' . $deleteId . '`')
|
||||||
->from('`' . $deleteTable . '`', 'd')
|
->from('`' . $deleteTable . '`', 'd')
|
||||||
|
|
|
@ -22,19 +22,19 @@
|
||||||
namespace OC\Repair;
|
namespace OC\Repair;
|
||||||
|
|
||||||
|
|
||||||
use OC\DB\Connection;
|
|
||||||
use OC\Hooks\BasicEmitter;
|
use OC\Hooks\BasicEmitter;
|
||||||
use OC\RepairStep;
|
use OC\RepairStep;
|
||||||
|
use OCP\IDBConnection;
|
||||||
|
|
||||||
class DropOldTables extends BasicEmitter implements RepairStep {
|
class DropOldTables extends BasicEmitter implements RepairStep {
|
||||||
|
|
||||||
/** @var Connection */
|
/** @var IDBConnection */
|
||||||
protected $connection;
|
protected $connection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Connection $connection
|
* @param IDBConnection $connection
|
||||||
*/
|
*/
|
||||||
public function __construct(Connection $connection) {
|
public function __construct(IDBConnection $connection) {
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,16 +22,15 @@
|
||||||
|
|
||||||
namespace OC\Repair;
|
namespace OC\Repair;
|
||||||
|
|
||||||
use Doctrine\DBAL\Query\QueryBuilder;
|
|
||||||
use OC\Hooks\BasicEmitter;
|
use OC\Hooks\BasicEmitter;
|
||||||
|
|
||||||
class FillETags extends BasicEmitter implements \OC\RepairStep {
|
class FillETags extends BasicEmitter implements \OC\RepairStep {
|
||||||
|
|
||||||
/** @var \OC\DB\Connection */
|
/** @var \OCP\IDBConnection */
|
||||||
protected $connection;
|
protected $connection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \OC\DB\Connection $connection
|
* @param \OCP\IDBConnection $connection
|
||||||
*/
|
*/
|
||||||
public function __construct($connection) {
|
public function __construct($connection) {
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
|
@ -42,7 +41,7 @@ class FillETags extends BasicEmitter implements \OC\RepairStep {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run() {
|
public function run() {
|
||||||
$qb = $this->connection->createQueryBuilder();
|
$qb = $this->connection->getQueryBuilder();
|
||||||
$qb->update('`*PREFIX*filecache`')
|
$qb->update('`*PREFIX*filecache`')
|
||||||
->set('`etag`', $qb->expr()->literal('xxx'))
|
->set('`etag`', $qb->expr()->literal('xxx'))
|
||||||
->where($qb->expr()->eq('`etag`', $qb->expr()->literal('')))
|
->where($qb->expr()->eq('`etag`', $qb->expr()->literal('')))
|
||||||
|
|
|
@ -18,7 +18,7 @@ class CleanTags extends \Test\TestCase {
|
||||||
/** @var \OC\RepairStep */
|
/** @var \OC\RepairStep */
|
||||||
protected $repair;
|
protected $repair;
|
||||||
|
|
||||||
/** @var \Doctrine\DBAL\Connection */
|
/** @var \OCP\IDBConnection */
|
||||||
protected $connection;
|
protected $connection;
|
||||||
|
|
||||||
/** @var int */
|
/** @var int */
|
||||||
|
@ -39,7 +39,7 @@ class CleanTags extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function cleanUpTables() {
|
protected function cleanUpTables() {
|
||||||
$qb = $this->connection->createQueryBuilder();
|
$qb = $this->connection->getQueryBuilder();
|
||||||
$qb->delete('`*PREFIX*vcategory`')
|
$qb->delete('`*PREFIX*vcategory`')
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class CleanTags extends \Test\TestCase {
|
||||||
* @param string $message
|
* @param string $message
|
||||||
*/
|
*/
|
||||||
protected function assertEntryCount($tableName, $expected, $message = '') {
|
protected function assertEntryCount($tableName, $expected, $message = '') {
|
||||||
$qb = $this->connection->createQueryBuilder();
|
$qb = $this->connection->getQueryBuilder();
|
||||||
$result = $qb->select('COUNT(*)')
|
$result = $qb->select('COUNT(*)')
|
||||||
->from('`' . $tableName . '`')
|
->from('`' . $tableName . '`')
|
||||||
->execute();
|
->execute();
|
||||||
|
@ -99,7 +99,7 @@ class CleanTags extends \Test\TestCase {
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
protected function addTagCategory($category, $type) {
|
protected function addTagCategory($category, $type) {
|
||||||
$qb = $this->connection->createQueryBuilder();
|
$qb = $this->connection->getQueryBuilder();
|
||||||
$qb->insert('`*PREFIX*vcategory`')
|
$qb->insert('`*PREFIX*vcategory`')
|
||||||
->values([
|
->values([
|
||||||
'`uid`' => $qb->createNamedParameter('TestRepairCleanTags'),
|
'`uid`' => $qb->createNamedParameter('TestRepairCleanTags'),
|
||||||
|
@ -118,7 +118,7 @@ class CleanTags extends \Test\TestCase {
|
||||||
* @param string $type
|
* @param string $type
|
||||||
*/
|
*/
|
||||||
protected function addTagEntry($objectId, $category, $type) {
|
protected function addTagEntry($objectId, $category, $type) {
|
||||||
$qb = $this->connection->createQueryBuilder();
|
$qb = $this->connection->getQueryBuilder();
|
||||||
$qb->insert('`*PREFIX*vcategory_to_object`')
|
$qb->insert('`*PREFIX*vcategory_to_object`')
|
||||||
->values([
|
->values([
|
||||||
'`objid`' => $qb->createNamedParameter($objectId, \PDO::PARAM_INT),
|
'`objid`' => $qb->createNamedParameter($objectId, \PDO::PARAM_INT),
|
||||||
|
@ -137,7 +137,7 @@ class CleanTags extends \Test\TestCase {
|
||||||
return $this->createdFile;
|
return $this->createdFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
$qb = $this->connection->createQueryBuilder();
|
$qb = $this->connection->getQueryBuilder();
|
||||||
|
|
||||||
// We create a new file entry and delete it after the test again
|
// We create a new file entry and delete it after the test again
|
||||||
$fileName = $this->getUniqueID('TestRepairCleanTags', 12);
|
$fileName = $this->getUniqueID('TestRepairCleanTags', 12);
|
||||||
|
@ -174,7 +174,7 @@ class CleanTags extends \Test\TestCase {
|
||||||
// FIXME INSTEAD HELP FIXING DOCTRINE
|
// FIXME INSTEAD HELP FIXING DOCTRINE
|
||||||
// FIXME https://github.com/owncloud/core/issues/13303
|
// FIXME https://github.com/owncloud/core/issues/13303
|
||||||
// FIXME ALSO FIX https://github.com/owncloud/core/commit/2dd85ec984c12d3be401518f22c90d2327bec07a
|
// FIXME ALSO FIX https://github.com/owncloud/core/commit/2dd85ec984c12d3be401518f22c90d2327bec07a
|
||||||
$qb = $this->connection->createQueryBuilder();
|
$qb = $this->connection->getQueryBuilder();
|
||||||
$result = $qb->select("MAX($idName)")
|
$result = $qb->select("MAX($idName)")
|
||||||
->from($tableName)
|
->from($tableName)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
|
@ -1286,7 +1286,7 @@ class Test_Share extends \Test\TestCase {
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
// Find the share ID in the db
|
// Find the share ID in the db
|
||||||
$qb = $connection->createQueryBuilder();
|
$qb = $connection->getQueryBuilder();
|
||||||
$qb->select('`id`')
|
$qb->select('`id`')
|
||||||
->from('`*PREFIX*share`')
|
->from('`*PREFIX*share`')
|
||||||
->where('`item_type` = :type')
|
->where('`item_type` = :type')
|
||||||
|
@ -1307,7 +1307,7 @@ class Test_Share extends \Test\TestCase {
|
||||||
$this->assertTrue($res);
|
$this->assertTrue($res);
|
||||||
|
|
||||||
// Fetch the hash from the database
|
// Fetch the hash from the database
|
||||||
$qb = $connection->createQueryBuilder();
|
$qb = $connection->getQueryBuilder();
|
||||||
$qb->select('`share_with`')
|
$qb->select('`share_with`')
|
||||||
->from('`*PREFIX*share`')
|
->from('`*PREFIX*share`')
|
||||||
->where('`id` = :id')
|
->where('`id` = :id')
|
||||||
|
@ -1335,10 +1335,10 @@ class Test_Share extends \Test\TestCase {
|
||||||
$userSession->method('getUser')->willReturn($user);
|
$userSession->method('getUser')->willReturn($user);
|
||||||
|
|
||||||
|
|
||||||
$ex = $this->getMockBuilder('\Doctrine\DBAL\Query\Expression\ExpressionBuilder')
|
$ex = $this->getMockBuilder('\OC\DB\ExpressionBuilder')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$qb = $this->getMockBuilder('\Doctrine\DBAL\Query\QueryBuilder')
|
$qb = $this->getMockBuilder('\OC\DB\QueryBuilder')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$qb->method('update')->will($this->returnSelf());
|
$qb->method('update')->will($this->returnSelf());
|
||||||
|
@ -1360,7 +1360,7 @@ class Test_Share extends \Test\TestCase {
|
||||||
$connection = $this->getMockBuilder('\OC\DB\Connection')
|
$connection = $this->getMockBuilder('\OC\DB\Connection')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$connection->method('createQueryBuilder')->willReturn($qb);
|
$connection->method('getQueryBuilder')->willReturn($qb);
|
||||||
|
|
||||||
$config = $this->getMockBuilder('\OCP\IConfig')
|
$config = $this->getMockBuilder('\OCP\IConfig')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
@ -1390,10 +1390,10 @@ class Test_Share extends \Test\TestCase {
|
||||||
$userSession->method('getUser')->willReturn($user);
|
$userSession->method('getUser')->willReturn($user);
|
||||||
|
|
||||||
|
|
||||||
$ex = $this->getMockBuilder('\Doctrine\DBAL\Query\Expression\ExpressionBuilder')
|
$ex = $this->getMockBuilder('\OC\DB\ExpressionBuilder')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$qb = $this->getMockBuilder('\Doctrine\DBAL\Query\QueryBuilder')
|
$qb = $this->getMockBuilder('\OC\DB\QueryBuilder')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$qb->method('update')->will($this->returnSelf());
|
$qb->method('update')->will($this->returnSelf());
|
||||||
|
@ -1415,7 +1415,7 @@ class Test_Share extends \Test\TestCase {
|
||||||
$connection = $this->getMockBuilder('\OC\DB\Connection')
|
$connection = $this->getMockBuilder('\OC\DB\Connection')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$connection->method('createQueryBuilder')->willReturn($qb);
|
$connection->method('getQueryBuilder')->willReturn($qb);
|
||||||
|
|
||||||
$config = $this->getMockBuilder('\OCP\IConfig')
|
$config = $this->getMockBuilder('\OCP\IConfig')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
@ -1443,10 +1443,10 @@ class Test_Share extends \Test\TestCase {
|
||||||
$userSession->method('getUser')->willReturn($user);
|
$userSession->method('getUser')->willReturn($user);
|
||||||
|
|
||||||
|
|
||||||
$ex = $this->getMockBuilder('\Doctrine\DBAL\Query\Expression\ExpressionBuilder')
|
$ex = $this->getMockBuilder('\OC\DB\ExpressionBuilder')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$qb = $this->getMockBuilder('\Doctrine\DBAL\Query\QueryBuilder')
|
$qb = $this->getMockBuilder('\OC\DB\QueryBuilder')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$qb->method('update')->will($this->returnSelf());
|
$qb->method('update')->will($this->returnSelf());
|
||||||
|
@ -1468,7 +1468,7 @@ class Test_Share extends \Test\TestCase {
|
||||||
$connection = $this->getMockBuilder('\OC\DB\Connection')
|
$connection = $this->getMockBuilder('\OC\DB\Connection')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$connection->method('createQueryBuilder')->willReturn($qb);
|
$connection->method('getQueryBuilder')->willReturn($qb);
|
||||||
|
|
||||||
$config = $this->getMockBuilder('\OCP\IConfig')
|
$config = $this->getMockBuilder('\OCP\IConfig')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
@ -1496,10 +1496,10 @@ class Test_Share extends \Test\TestCase {
|
||||||
$userSession->method('getUser')->willReturn($user);
|
$userSession->method('getUser')->willReturn($user);
|
||||||
|
|
||||||
|
|
||||||
$ex = $this->getMockBuilder('\Doctrine\DBAL\Query\Expression\ExpressionBuilder')
|
$ex = $this->getMockBuilder('\OC\DB\ExpressionBuilder')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$qb = $this->getMockBuilder('\Doctrine\DBAL\Query\QueryBuilder')
|
$qb = $this->getMockBuilder('\OC\DB\QueryBuilder')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$qb->method('update')->will($this->returnSelf());
|
$qb->method('update')->will($this->returnSelf());
|
||||||
|
@ -1521,7 +1521,7 @@ class Test_Share extends \Test\TestCase {
|
||||||
$connection = $this->getMockBuilder('\OC\DB\Connection')
|
$connection = $this->getMockBuilder('\OC\DB\Connection')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$connection->method('createQueryBuilder')->willReturn($qb);
|
$connection->method('getQueryBuilder')->willReturn($qb);
|
||||||
|
|
||||||
$config = $this->getMockBuilder('\OCP\IConfig')
|
$config = $this->getMockBuilder('\OCP\IConfig')
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
|
|
Loading…
Reference in New Issue