commit
c40352c030
20 changed files with 215 additions and 98 deletions
|
@ -61,6 +61,7 @@ class Install extends Command {
|
||||||
->addOption('database-user', null, InputOption::VALUE_REQUIRED, 'User name to connect to the database')
|
->addOption('database-user', null, InputOption::VALUE_REQUIRED, 'User name to connect to the database')
|
||||||
->addOption('database-pass', null, InputOption::VALUE_OPTIONAL, 'Password of the database user', null)
|
->addOption('database-pass', null, InputOption::VALUE_OPTIONAL, 'Password of the database user', null)
|
||||||
->addOption('database-table-prefix', null, InputOption::VALUE_OPTIONAL, 'Prefix for all tables (default: oc_)', null)
|
->addOption('database-table-prefix', null, InputOption::VALUE_OPTIONAL, 'Prefix for all tables (default: oc_)', null)
|
||||||
|
->addOption('database-table-space', null, InputOption::VALUE_OPTIONAL, 'Table space of the database (oci only)', null)
|
||||||
->addOption('admin-user', null, InputOption::VALUE_REQUIRED, 'User name of the admin account', 'admin')
|
->addOption('admin-user', null, InputOption::VALUE_REQUIRED, 'User name of the admin account', 'admin')
|
||||||
->addOption('admin-pass', null, InputOption::VALUE_REQUIRED, 'Password of the admin account')
|
->addOption('admin-pass', null, InputOption::VALUE_REQUIRED, 'Password of the admin account')
|
||||||
->addOption('data-dir', null, InputOption::VALUE_REQUIRED, 'Path to data directory', \OC::$SERVERROOT."/data");
|
->addOption('data-dir', null, InputOption::VALUE_REQUIRED, 'Path to data directory', \OC::$SERVERROOT."/data");
|
||||||
|
@ -171,6 +172,9 @@ class Install extends Command {
|
||||||
'adminpass' => $adminPassword,
|
'adminpass' => $adminPassword,
|
||||||
'directory' => $dataDir
|
'directory' => $dataDir
|
||||||
];
|
];
|
||||||
|
if ($db === 'oci') {
|
||||||
|
$options['dbtablespace'] = $input->getParameterOption('--database-table-space', '');
|
||||||
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ class DefaultTokenMapper extends Mapper {
|
||||||
public function deleteByName($name) {
|
public function deleteByName($name) {
|
||||||
$qb = $this->db->getQueryBuilder();
|
$qb = $this->db->getQueryBuilder();
|
||||||
$qb->delete('authtoken')
|
$qb->delete('authtoken')
|
||||||
->where($qb->expr()->eq('name', $qb->createNamedParameter($name)));
|
->where($qb->expr()->eq('name', $qb->createNamedParameter($name), IQueryBuilder::PARAM_STR));
|
||||||
$qb->execute();
|
$qb->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -411,9 +411,12 @@ class Manager implements ICommentsManager {
|
||||||
*/
|
*/
|
||||||
public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user) {
|
public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user) {
|
||||||
$qb = $this->dbConn->getQueryBuilder();
|
$qb = $this->dbConn->getQueryBuilder();
|
||||||
$query = $qb->select('fileid', $qb->createFunction(
|
$query = $qb->select('f.fileid')
|
||||||
'COUNT(' . $qb->getColumnName('c.id') . ')')
|
->selectAlias(
|
||||||
)->from('comments', 'c')
|
$qb->createFunction('COUNT(' . $qb->getColumnName('c.id') . ')'),
|
||||||
|
'num_ids'
|
||||||
|
)
|
||||||
|
->from('comments', 'c')
|
||||||
->innerJoin('c', 'filecache', 'f', $qb->expr()->andX(
|
->innerJoin('c', 'filecache', 'f', $qb->expr()->andX(
|
||||||
$qb->expr()->eq('c.object_type', $qb->createNamedParameter('files')),
|
$qb->expr()->eq('c.object_type', $qb->createNamedParameter('files')),
|
||||||
$qb->expr()->eq('f.fileid', $qb->expr()->castColumn('c.object_id', IQueryBuilder::PARAM_INT))
|
$qb->expr()->eq('f.fileid', $qb->expr()->castColumn('c.object_id', IQueryBuilder::PARAM_INT))
|
||||||
|
@ -431,9 +434,13 @@ class Manager implements ICommentsManager {
|
||||||
->groupBy('f.fileid');
|
->groupBy('f.fileid');
|
||||||
|
|
||||||
$resultStatement = $query->execute();
|
$resultStatement = $query->execute();
|
||||||
return array_map(function ($count) {
|
|
||||||
return (int)$count;
|
$results = [];
|
||||||
}, $resultStatement->fetchAll(\PDO::FETCH_KEY_PAIR));
|
while ($row = $resultStatement->fetch()) {
|
||||||
|
$results[$row['fileid']] = (int) $row['num_ids'];
|
||||||
|
}
|
||||||
|
$resultStatement->closeCursor();
|
||||||
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,6 +31,7 @@ use OC\DB\QueryBuilder\QueryFunction;
|
||||||
use OC\DB\QueryBuilder\QuoteHelper;
|
use OC\DB\QueryBuilder\QuoteHelper;
|
||||||
use OCP\DB\QueryBuilder\IExpressionBuilder;
|
use OCP\DB\QueryBuilder\IExpressionBuilder;
|
||||||
use OCP\DB\QueryBuilder\ILiteral;
|
use OCP\DB\QueryBuilder\ILiteral;
|
||||||
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
use OCP\DB\QueryBuilder\IQueryFunction;
|
use OCP\DB\QueryBuilder\IQueryFunction;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
|
|
||||||
|
@ -350,6 +351,28 @@ class ExpressionBuilder implements IExpressionBuilder {
|
||||||
return $this->expressionBuilder->notIn($x, $y);
|
return $this->expressionBuilder->notIn($x, $y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a $x = '' statement, because Oracle needs a different check
|
||||||
|
*
|
||||||
|
* @param string $x The field in string format to be inspected by the comparison.
|
||||||
|
* @return string
|
||||||
|
* @since 13.0.0
|
||||||
|
*/
|
||||||
|
public function emptyString($x) {
|
||||||
|
return $this->eq($x, $this->literal('', IQueryBuilder::PARAM_STR));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a `$x <> ''` statement, because Oracle needs a different check
|
||||||
|
*
|
||||||
|
* @param string $x The field in string format to be inspected by the comparison.
|
||||||
|
* @return string
|
||||||
|
* @since 13.0.0
|
||||||
|
*/
|
||||||
|
public function nonEmptyString($x) {
|
||||||
|
return $this->neq($x, $this->literal('', IQueryBuilder::PARAM_STR));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binary AND Operator copies a bit to the result if it exists in both operands.
|
* Binary AND Operator copies a bit to the result if it exists in both operands.
|
||||||
*
|
*
|
||||||
|
|
|
@ -137,6 +137,28 @@ class OCIExpressionBuilder extends ExpressionBuilder {
|
||||||
return $this->expressionBuilder->notIn($x, $y);
|
return $this->expressionBuilder->notIn($x, $y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a $x = '' statement, because Oracle needs a different check
|
||||||
|
*
|
||||||
|
* @param string $x The field in string format to be inspected by the comparison.
|
||||||
|
* @return string
|
||||||
|
* @since 13.0.0
|
||||||
|
*/
|
||||||
|
public function emptyString($x) {
|
||||||
|
return $this->isNull($x);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a `$x <> ''` statement, because Oracle needs a different check
|
||||||
|
*
|
||||||
|
* @param string $x The field in string format to be inspected by the comparison.
|
||||||
|
* @return string
|
||||||
|
* @since 13.0.0
|
||||||
|
*/
|
||||||
|
public function nonEmptyString($x) {
|
||||||
|
return $this->isNotNull($x);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a IQueryFunction that casts the column to the given type
|
* Returns a IQueryFunction that casts the column to the given type
|
||||||
*
|
*
|
||||||
|
@ -166,6 +188,6 @@ class OCIExpressionBuilder extends ExpressionBuilder {
|
||||||
public function iLike($x, $y, $type = null) {
|
public function iLike($x, $y, $type = null) {
|
||||||
$x = $this->helper->quoteColumnName($x);
|
$x = $this->helper->quoteColumnName($x);
|
||||||
$y = $this->helper->quoteColumnName($y);
|
$y = $this->helper->quoteColumnName($y);
|
||||||
return new QueryFunction('REGEXP_LIKE('.$x.', \'^\' || REPLACE('.$y.', \'%\', \'.*\') || \'$\', \'i\')');
|
return new QueryFunction('REGEXP_LIKE(' . $x . ', \'^\' || REPLACE(REPLACE(' . $y . ', \'%\', \'.*\'), \'_\', \'.\') || \'$\', \'i\')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -560,7 +560,7 @@ class QueryBuilder implements IQueryBuilder {
|
||||||
public function from($from, $alias = null) {
|
public function from($from, $alias = null) {
|
||||||
$this->queryBuilder->from(
|
$this->queryBuilder->from(
|
||||||
$this->getTableName($from),
|
$this->getTableName($from),
|
||||||
$alias
|
$this->quoteAlias($alias)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -585,9 +585,9 @@ class QueryBuilder implements IQueryBuilder {
|
||||||
*/
|
*/
|
||||||
public function join($fromAlias, $join, $alias, $condition = null) {
|
public function join($fromAlias, $join, $alias, $condition = null) {
|
||||||
$this->queryBuilder->join(
|
$this->queryBuilder->join(
|
||||||
$fromAlias,
|
$this->quoteAlias($fromAlias),
|
||||||
$this->getTableName($join),
|
$this->getTableName($join),
|
||||||
$alias,
|
$this->quoteAlias($alias),
|
||||||
$condition
|
$condition
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -613,9 +613,9 @@ class QueryBuilder implements IQueryBuilder {
|
||||||
*/
|
*/
|
||||||
public function innerJoin($fromAlias, $join, $alias, $condition = null) {
|
public function innerJoin($fromAlias, $join, $alias, $condition = null) {
|
||||||
$this->queryBuilder->innerJoin(
|
$this->queryBuilder->innerJoin(
|
||||||
$fromAlias,
|
$this->quoteAlias($fromAlias),
|
||||||
$this->getTableName($join),
|
$this->getTableName($join),
|
||||||
$alias,
|
$this->quoteAlias($alias),
|
||||||
$condition
|
$condition
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -641,9 +641,9 @@ class QueryBuilder implements IQueryBuilder {
|
||||||
*/
|
*/
|
||||||
public function leftJoin($fromAlias, $join, $alias, $condition = null) {
|
public function leftJoin($fromAlias, $join, $alias, $condition = null) {
|
||||||
$this->queryBuilder->leftJoin(
|
$this->queryBuilder->leftJoin(
|
||||||
$fromAlias,
|
$this->quoteAlias($fromAlias),
|
||||||
$this->getTableName($join),
|
$this->getTableName($join),
|
||||||
$alias,
|
$this->quoteAlias($alias),
|
||||||
$condition
|
$condition
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -669,9 +669,9 @@ class QueryBuilder implements IQueryBuilder {
|
||||||
*/
|
*/
|
||||||
public function rightJoin($fromAlias, $join, $alias, $condition = null) {
|
public function rightJoin($fromAlias, $join, $alias, $condition = null) {
|
||||||
$this->queryBuilder->rightJoin(
|
$this->queryBuilder->rightJoin(
|
||||||
$fromAlias,
|
$this->quoteAlias($fromAlias),
|
||||||
$this->getTableName($join),
|
$this->getTableName($join),
|
||||||
$alias,
|
$this->quoteAlias($alias),
|
||||||
$condition
|
$condition
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1193,4 +1193,18 @@ class QueryBuilder implements IQueryBuilder {
|
||||||
|
|
||||||
return $this->helper->quoteColumnName($tableAlias . $column);
|
return $this->helper->quoteColumnName($tableAlias . $column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the column name quoted and with table alias prefix as needed by the implementation
|
||||||
|
*
|
||||||
|
* @param string $alias
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function quoteAlias($alias) {
|
||||||
|
if ($alias === '' || $alias === null) {
|
||||||
|
return $alias;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->helper->quoteColumnName($alias);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ class QuoteHelper {
|
||||||
list($alias, $columnName) = explode('.', $string, 2);
|
list($alias, $columnName) = explode('.', $string, 2);
|
||||||
|
|
||||||
if ($columnName === '*') {
|
if ($columnName === '*') {
|
||||||
return $string;
|
return '`' . $alias . '`.*';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '`' . $alias . '`.`' . $columnName . '`';
|
return '`' . $alias . '`.`' . $columnName . '`';
|
||||||
|
|
|
@ -365,6 +365,11 @@ class UserMountCache implements IUserMountCache {
|
||||||
|
|
||||||
$result = $query->execute();
|
$result = $query->execute();
|
||||||
|
|
||||||
return $result->fetchAll(\PDO::FETCH_KEY_PAIR);
|
$results = [];
|
||||||
|
while ($row = $result->fetch()) {
|
||||||
|
$results[$row['user_id']] = $row['size'];
|
||||||
|
}
|
||||||
|
$result->closeCursor();
|
||||||
|
return $results;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
namespace OC\Repair\NC12;
|
namespace OC\Repair\NC12;
|
||||||
|
|
||||||
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\Migration\IOutput;
|
use OCP\Migration\IOutput;
|
||||||
|
@ -80,7 +81,7 @@ class UpdateLanguageCodes implements IRepairStep {
|
||||||
->set('configvalue', $qb->createNamedParameter($newCode))
|
->set('configvalue', $qb->createNamedParameter($newCode))
|
||||||
->where($qb->expr()->eq('appid', $qb->createNamedParameter('core')))
|
->where($qb->expr()->eq('appid', $qb->createNamedParameter('core')))
|
||||||
->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang')))
|
->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang')))
|
||||||
->andWhere($qb->expr()->eq('configvalue', $qb->createNamedParameter($oldCode)))
|
->andWhere($qb->expr()->eq('configvalue', $qb->createNamedParameter($oldCode), IQueryBuilder::PARAM_STR))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$output->info('Changed ' . $affectedRows . ' setting(s) from "' . $oldCode . '" to "' . $newCode . '" in preferences table.');
|
$output->info('Changed ' . $affectedRows . ' setting(s) from "' . $oldCode . '" to "' . $newCode . '" in preferences table.');
|
||||||
|
|
|
@ -64,17 +64,19 @@ class RepairInvalidPaths implements IRepairStep {
|
||||||
);
|
);
|
||||||
|
|
||||||
//select f.path, f.parent,p.path from oc_filecache f inner join oc_filecache p on f.parent=p.fileid and p.path!='' where f.path != p.path || '/' || f.name;
|
//select f.path, f.parent,p.path from oc_filecache f inner join oc_filecache p on f.parent=p.fileid and p.path!='' where f.path != p.path || '/' || f.name;
|
||||||
$query = $builder->select('f.fileid', 'f.path', 'p.path AS parent_path', 'f.name', 'f.parent', 'f.storage', 'p.storage as parent_storage')
|
$builder->select('f.fileid', 'f.path', 'f.name', 'f.parent', 'f.storage')
|
||||||
|
->selectAlias('p.path', 'parent_path')
|
||||||
|
->selectAlias('p.storage', 'parent_storage')
|
||||||
->from('filecache', 'f')
|
->from('filecache', 'f')
|
||||||
->innerJoin('f', 'filecache', 'p', $builder->expr()->andX(
|
->innerJoin('f', 'filecache', 'p', $builder->expr()->andX(
|
||||||
$builder->expr()->eq('f.parent', 'p.fileid'),
|
$builder->expr()->eq('f.parent', 'p.fileid'),
|
||||||
$builder->expr()->neq('p.name', $builder->createNamedParameter(''))
|
$builder->expr()->nonEmptyString('p.name')
|
||||||
))
|
))
|
||||||
->where($builder->expr()->neq('f.path', $computedPath))
|
->where($builder->expr()->neq('f.path', $computedPath))
|
||||||
->setMaxResults(self::MAX_ROWS);
|
->setMaxResults(self::MAX_ROWS);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$result = $query->execute();
|
$result = $builder->execute();
|
||||||
$rows = $result->fetchAll();
|
$rows = $result->fetchAll();
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
yield $row;
|
yield $row;
|
||||||
|
|
|
@ -338,6 +338,7 @@ class Share extends Constants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$result->closeCursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1460,8 +1461,9 @@ class Share extends Constants {
|
||||||
->from('share')
|
->from('share')
|
||||||
->where($qb->expr()->eq('id', $qb->createParameter('shareId')))
|
->where($qb->expr()->eq('id', $qb->createParameter('shareId')))
|
||||||
->setParameter(':shareId', $shareId);
|
->setParameter(':shareId', $shareId);
|
||||||
$result = $qb->execute();
|
$dbResult = $qb->execute();
|
||||||
$result = $result->fetch();
|
$result = $dbResult->fetch();
|
||||||
|
$dbResult->closeCursor();
|
||||||
|
|
||||||
if (empty($result)) {
|
if (empty($result)) {
|
||||||
throw new \Exception('Share not found');
|
throw new \Exception('Share not found');
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
namespace OC\User;
|
namespace OC\User;
|
||||||
|
|
||||||
use OC\Hooks\PublicEmitter;
|
use OC\Hooks\PublicEmitter;
|
||||||
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
use OCP\IUser;
|
use OCP\IUser;
|
||||||
use OCP\IUserBackend;
|
use OCP\IUserBackend;
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
|
@ -436,7 +437,7 @@ class Manager extends PublicEmitter implements IUserManager {
|
||||||
->from('preferences')
|
->from('preferences')
|
||||||
->where($queryBuilder->expr()->eq('appid', $queryBuilder->createNamedParameter('core')))
|
->where($queryBuilder->expr()->eq('appid', $queryBuilder->createNamedParameter('core')))
|
||||||
->andWhere($queryBuilder->expr()->eq('configkey', $queryBuilder->createNamedParameter('enabled')))
|
->andWhere($queryBuilder->expr()->eq('configkey', $queryBuilder->createNamedParameter('enabled')))
|
||||||
->andWhere($queryBuilder->expr()->eq('configvalue', $queryBuilder->createNamedParameter('false')));
|
->andWhere($queryBuilder->expr()->eq('configvalue', $queryBuilder->createNamedParameter('false'), IQueryBuilder::PARAM_STR));
|
||||||
|
|
||||||
$query = $queryBuilder->execute();
|
$query = $queryBuilder->execute();
|
||||||
|
|
||||||
|
|
|
@ -305,6 +305,24 @@ interface IExpressionBuilder {
|
||||||
*/
|
*/
|
||||||
public function notIn($x, $y, $type = null);
|
public function notIn($x, $y, $type = null);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a $x = '' statement, because Oracle needs a different check
|
||||||
|
*
|
||||||
|
* @param string $x The field in string format to be inspected by the comparison.
|
||||||
|
* @return string
|
||||||
|
* @since 13.0.0
|
||||||
|
*/
|
||||||
|
public function emptyString($x);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a `$x <> ''` statement, because Oracle needs a different check
|
||||||
|
*
|
||||||
|
* @param string $x The field in string format to be inspected by the comparison.
|
||||||
|
* @return string
|
||||||
|
* @since 13.0.0
|
||||||
|
*/
|
||||||
|
public function nonEmptyString($x);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a bitwise AND comparison
|
* Creates a bitwise AND comparison
|
||||||
|
|
|
@ -307,29 +307,9 @@ class ManagerTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetNumberOfUnreadCommentsForFolder() {
|
public function testGetNumberOfUnreadCommentsForFolder() {
|
||||||
// 2 comment for 1111 with 1 before read marker
|
|
||||||
// 2 comments for 1112 with no read marker
|
|
||||||
// 1 comment for 1113 before read marker
|
|
||||||
// 1 comment for 1114 with no read marker
|
|
||||||
$this->addDatabaseEntry(0, 0, null, null, '1112');
|
|
||||||
for ($i = 1; $i < 5; $i++) {
|
|
||||||
$this->addDatabaseEntry(0, 0, null, null, '111' . $i);
|
|
||||||
}
|
|
||||||
$this->addDatabaseEntry(0, 0, (new \DateTime())->modify('-2 days'), null, '1111');
|
|
||||||
$user = $this->createMock(IUser::class);
|
|
||||||
$user->expects($this->any())
|
|
||||||
->method('getUID')
|
|
||||||
->will($this->returnValue('comment_test'));
|
|
||||||
|
|
||||||
$manager = $this->getManager();
|
|
||||||
|
|
||||||
$manager->setReadMark('files', '1111', (new \DateTime())->modify('-1 days'), $user);
|
|
||||||
$manager->setReadMark('files', '1113', (new \DateTime()), $user);
|
|
||||||
|
|
||||||
$query = $this->connection->getQueryBuilder();
|
$query = $this->connection->getQueryBuilder();
|
||||||
$query->insert('filecache')
|
$query->insert('filecache')
|
||||||
->values([
|
->values([
|
||||||
'fileid' => $query->createParameter('fileid'),
|
|
||||||
'parent' => $query->createNamedParameter(1000),
|
'parent' => $query->createNamedParameter(1000),
|
||||||
'size' => $query->createNamedParameter(10),
|
'size' => $query->createNamedParameter(10),
|
||||||
'mtime' => $query->createNamedParameter(10),
|
'mtime' => $query->createNamedParameter(10),
|
||||||
|
@ -338,17 +318,37 @@ class ManagerTest extends TestCase {
|
||||||
'path_hash' => $query->createParameter('path'),
|
'path_hash' => $query->createParameter('path'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
for ($i = 1111; $i < 1115; $i++) {
|
$fileIds = [];
|
||||||
|
for ($i = 0; $i < 4; $i++) {
|
||||||
$query->setParameter('path', 'path_' . $i);
|
$query->setParameter('path', 'path_' . $i);
|
||||||
$query->setParameter('fileid', $i);
|
|
||||||
$query->execute();
|
$query->execute();
|
||||||
|
$fileIds[] = $query->getLastInsertId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 2 comment for 1111 with 1 before read marker
|
||||||
|
// 2 comments for 1112 with no read marker
|
||||||
|
// 1 comment for 1113 before read marker
|
||||||
|
// 1 comment for 1114 with no read marker
|
||||||
|
$this->addDatabaseEntry(0, 0, null, null, $fileIds[1]);
|
||||||
|
for ($i = 0; $i < 4; $i++) {
|
||||||
|
$this->addDatabaseEntry(0, 0, null, null, $fileIds[$i]);
|
||||||
|
}
|
||||||
|
$this->addDatabaseEntry(0, 0, (new \DateTime())->modify('-2 days'), null, $fileIds[0]);
|
||||||
|
$user = $this->createMock(IUser::class);
|
||||||
|
$user->expects($this->any())
|
||||||
|
->method('getUID')
|
||||||
|
->will($this->returnValue('comment_test'));
|
||||||
|
|
||||||
|
$manager = $this->getManager();
|
||||||
|
|
||||||
|
$manager->setReadMark('files', (string) $fileIds[0], (new \DateTime())->modify('-1 days'), $user);
|
||||||
|
$manager->setReadMark('files', (string) $fileIds[2], (new \DateTime()), $user);
|
||||||
|
|
||||||
$amount = $manager->getNumberOfUnreadCommentsForFolder(1000, $user);
|
$amount = $manager->getNumberOfUnreadCommentsForFolder(1000, $user);
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
'1111' => 1,
|
$fileIds[0] => 1,
|
||||||
'1112' => 2,
|
$fileIds[1] => 2,
|
||||||
'1114' => 1,
|
$fileIds[3] => 1,
|
||||||
], $amount);
|
], $amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ class FunctionBuilderTest extends TestCase {
|
||||||
$query = $this->connection->getQueryBuilder();
|
$query = $this->connection->getQueryBuilder();
|
||||||
|
|
||||||
$query->select($query->func()->concat($query->createNamedParameter('foo'), new Literal("'bar'")));
|
$query->select($query->func()->concat($query->createNamedParameter('foo'), new Literal("'bar'")));
|
||||||
|
$query->from('appconfig')
|
||||||
|
->setMaxResults(1);
|
||||||
|
|
||||||
$this->assertEquals('foobar', $query->execute()->fetchColumn());
|
$this->assertEquals('foobar', $query->execute()->fetchColumn());
|
||||||
}
|
}
|
||||||
|
@ -52,6 +54,8 @@ class FunctionBuilderTest extends TestCase {
|
||||||
$query = $this->connection->getQueryBuilder();
|
$query = $this->connection->getQueryBuilder();
|
||||||
|
|
||||||
$query->select($query->func()->md5($query->createNamedParameter('foobar')));
|
$query->select($query->func()->md5($query->createNamedParameter('foobar')));
|
||||||
|
$query->from('appconfig')
|
||||||
|
->setMaxResults(1);
|
||||||
|
|
||||||
$this->assertEquals(md5('foobar'), $query->execute()->fetchColumn());
|
$this->assertEquals(md5('foobar'), $query->execute()->fetchColumn());
|
||||||
}
|
}
|
||||||
|
@ -60,6 +64,8 @@ class FunctionBuilderTest extends TestCase {
|
||||||
$query = $this->connection->getQueryBuilder();
|
$query = $this->connection->getQueryBuilder();
|
||||||
|
|
||||||
$query->select($query->func()->substring($query->createNamedParameter('foobar'), new Literal(2), $query->createNamedParameter(2)));
|
$query->select($query->func()->substring($query->createNamedParameter('foobar'), new Literal(2), $query->createNamedParameter(2)));
|
||||||
|
$query->from('appconfig')
|
||||||
|
->setMaxResults(1);
|
||||||
|
|
||||||
$this->assertEquals('oo', $query->execute()->fetchColumn());
|
$this->assertEquals('oo', $query->execute()->fetchColumn());
|
||||||
}
|
}
|
||||||
|
@ -68,6 +74,8 @@ class FunctionBuilderTest extends TestCase {
|
||||||
$query = $this->connection->getQueryBuilder();
|
$query = $this->connection->getQueryBuilder();
|
||||||
|
|
||||||
$query->select($query->func()->substring($query->createNamedParameter('foobar'), new Literal(2)));
|
$query->select($query->func()->substring($query->createNamedParameter('foobar'), new Literal(2)));
|
||||||
|
$query->from('appconfig')
|
||||||
|
->setMaxResults(1);
|
||||||
|
|
||||||
$this->assertEquals('oobar', $query->execute()->fetchColumn());
|
$this->assertEquals('oobar', $query->execute()->fetchColumn());
|
||||||
}
|
}
|
||||||
|
|
|
@ -472,15 +472,15 @@ class QueryBuilderTest extends \Test\TestCase {
|
||||||
public function dataFrom() {
|
public function dataFrom() {
|
||||||
return [
|
return [
|
||||||
['data', null, null, null, [['table' => '`*PREFIX*data`', 'alias' => null]], '`*PREFIX*data`'],
|
['data', null, null, null, [['table' => '`*PREFIX*data`', 'alias' => null]], '`*PREFIX*data`'],
|
||||||
['data', 't', null, null, [['table' => '`*PREFIX*data`', 'alias' => 't']], '`*PREFIX*data` t'],
|
['data', 't', null, null, [['table' => '`*PREFIX*data`', 'alias' => '`t`']], '`*PREFIX*data` `t`'],
|
||||||
['data1', null, 'data2', null, [
|
['data1', null, 'data2', null, [
|
||||||
['table' => '`*PREFIX*data1`', 'alias' => null],
|
['table' => '`*PREFIX*data1`', 'alias' => null],
|
||||||
['table' => '`*PREFIX*data2`', 'alias' => null]
|
['table' => '`*PREFIX*data2`', 'alias' => null]
|
||||||
], '`*PREFIX*data1`, `*PREFIX*data2`'],
|
], '`*PREFIX*data1`, `*PREFIX*data2`'],
|
||||||
['data', 't1', 'data', 't2', [
|
['data', 't1', 'data', 't2', [
|
||||||
['table' => '`*PREFIX*data`', 'alias' => 't1'],
|
['table' => '`*PREFIX*data`', 'alias' => '`t1`'],
|
||||||
['table' => '`*PREFIX*data`', 'alias' => 't2']
|
['table' => '`*PREFIX*data`', 'alias' => '`t2`']
|
||||||
], '`*PREFIX*data` t1, `*PREFIX*data` t2'],
|
], '`*PREFIX*data` `t1`, `*PREFIX*data` `t2`'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,18 +515,18 @@ class QueryBuilderTest extends \Test\TestCase {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
'd1', 'data2', null, null,
|
'd1', 'data2', null, null,
|
||||||
['d1' => [['joinType' => 'inner', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => null, 'joinCondition' => null]]],
|
['`d1`' => [['joinType' => 'inner', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => null, 'joinCondition' => null]]],
|
||||||
'`*PREFIX*data1` d1 INNER JOIN `*PREFIX*data2` ON '
|
'`*PREFIX*data1` `d1` INNER JOIN `*PREFIX*data2` ON '
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'd1', 'data2', 'd2', null,
|
'd1', 'data2', 'd2', null,
|
||||||
['d1' => [['joinType' => 'inner', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => 'd2', 'joinCondition' => null]]],
|
['`d1`' => [['joinType' => 'inner', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => '`d2`', 'joinCondition' => null]]],
|
||||||
'`*PREFIX*data1` d1 INNER JOIN `*PREFIX*data2` d2 ON '
|
'`*PREFIX*data1` `d1` INNER JOIN `*PREFIX*data2` `d2` ON '
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'd1', 'data2', 'd2', 'd1.`field1` = d2.`field2`',
|
'd1', 'data2', 'd2', '`d1`.`field1` = `d2`.`field2`',
|
||||||
['d1' => [['joinType' => 'inner', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => 'd2', 'joinCondition' => 'd1.`field1` = d2.`field2`']]],
|
['`d1`' => [['joinType' => 'inner', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => '`d2`', 'joinCondition' => '`d1`.`field1` = `d2`.`field2`']]],
|
||||||
'`*PREFIX*data1` d1 INNER JOIN `*PREFIX*data2` d2 ON d1.`field1` = d2.`field2`'
|
'`*PREFIX*data1` `d1` INNER JOIN `*PREFIX*data2` `d2` ON `d1`.`field1` = `d2`.`field2`'
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -596,18 +596,18 @@ class QueryBuilderTest extends \Test\TestCase {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
'd1', 'data2', null, null,
|
'd1', 'data2', null, null,
|
||||||
['d1' => [['joinType' => 'left', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => null, 'joinCondition' => null]]],
|
['`d1`' => [['joinType' => 'left', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => null, 'joinCondition' => null]]],
|
||||||
'`*PREFIX*data1` d1 LEFT JOIN `*PREFIX*data2` ON '
|
'`*PREFIX*data1` `d1` LEFT JOIN `*PREFIX*data2` ON '
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'd1', 'data2', 'd2', null,
|
'd1', 'data2', 'd2', null,
|
||||||
['d1' => [['joinType' => 'left', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => 'd2', 'joinCondition' => null]]],
|
['`d1`' => [['joinType' => 'left', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => '`d2`', 'joinCondition' => null]]],
|
||||||
'`*PREFIX*data1` d1 LEFT JOIN `*PREFIX*data2` d2 ON '
|
'`*PREFIX*data1` `d1` LEFT JOIN `*PREFIX*data2` `d2` ON '
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'd1', 'data2', 'd2', 'd1.`field1` = d2.`field2`',
|
'd1', 'data2', 'd2', '`d1`.`field1` = `d2`.`field2`',
|
||||||
['d1' => [['joinType' => 'left', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => 'd2', 'joinCondition' => 'd1.`field1` = d2.`field2`']]],
|
['`d1`' => [['joinType' => 'left', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => '`d2`', 'joinCondition' => '`d1`.`field1` = `d2`.`field2`']]],
|
||||||
'`*PREFIX*data1` d1 LEFT JOIN `*PREFIX*data2` d2 ON d1.`field1` = d2.`field2`'
|
'`*PREFIX*data1` `d1` LEFT JOIN `*PREFIX*data2` `d2` ON `d1`.`field1` = `d2`.`field2`'
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -646,18 +646,18 @@ class QueryBuilderTest extends \Test\TestCase {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
'd1', 'data2', null, null,
|
'd1', 'data2', null, null,
|
||||||
['d1' => [['joinType' => 'right', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => null, 'joinCondition' => null]]],
|
['`d1`' => [['joinType' => 'right', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => null, 'joinCondition' => null]]],
|
||||||
'`*PREFIX*data1` d1 RIGHT JOIN `*PREFIX*data2` ON '
|
'`*PREFIX*data1` `d1` RIGHT JOIN `*PREFIX*data2` ON '
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'd1', 'data2', 'd2', null,
|
'd1', 'data2', 'd2', null,
|
||||||
['d1' => [['joinType' => 'right', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => 'd2', 'joinCondition' => null]]],
|
['`d1`' => [['joinType' => 'right', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => '`d2`', 'joinCondition' => null]]],
|
||||||
'`*PREFIX*data1` d1 RIGHT JOIN `*PREFIX*data2` d2 ON '
|
'`*PREFIX*data1` `d1` RIGHT JOIN `*PREFIX*data2` `d2` ON '
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'd1', 'data2', 'd2', 'd1.`field1` = d2.`field2`',
|
'd1', 'data2', 'd2', '`d1`.`field1` = `d2`.`field2`',
|
||||||
['d1' => [['joinType' => 'right', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => 'd2', 'joinCondition' => 'd1.`field1` = d2.`field2`']]],
|
['`d1`' => [['joinType' => 'right', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => '`d2`', 'joinCondition' => '`d1`.`field1` = `d2`.`field2`']]],
|
||||||
'`*PREFIX*data1` d1 RIGHT JOIN `*PREFIX*data2` d2 ON d1.`field1` = d2.`field2`'
|
'`*PREFIX*data1` `d1` RIGHT JOIN `*PREFIX*data2` `d2` ON `d1`.`field1` = `d2`.`field2`'
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,6 +129,8 @@ class QuerySearchHelperTest extends TestCase {
|
||||||
$builder->insert('filecache')
|
$builder->insert('filecache')
|
||||||
->values($values)
|
->values($values)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
|
return $builder->getLastInsertId();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function search(ISearchOperator $operator) {
|
private function search(ISearchOperator $operator) {
|
||||||
|
@ -139,34 +141,34 @@ class QuerySearchHelperTest extends TestCase {
|
||||||
|
|
||||||
public function comparisonProvider() {
|
public function comparisonProvider() {
|
||||||
return [
|
return [
|
||||||
[new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, 'mtime', 125), [1002]],
|
[new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, 'mtime', 125), [1]],
|
||||||
[new SearchComparison(ISearchComparison::COMPARE_LESS_THAN, 'mtime', 125), [1001]],
|
[new SearchComparison(ISearchComparison::COMPARE_LESS_THAN, 'mtime', 125), [0]],
|
||||||
[new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'size', 125), []],
|
[new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'size', 125), []],
|
||||||
[new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'size', 50), [1001, 1002]],
|
[new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'size', 50), [0, 1]],
|
||||||
[new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'name', 'foobar'), [1001]],
|
[new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'name', 'foobar'), [0]],
|
||||||
[new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', 'foo%'), [1001, 1002]],
|
[new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', 'foo%'), [0, 1]],
|
||||||
[new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'image/jpg'), [1001]],
|
[new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'image/jpg'), [0]],
|
||||||
[new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', 'image/%'), [1001, 1002]],
|
[new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', 'image/%'), [0, 1]],
|
||||||
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
|
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
|
||||||
new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'size', 50),
|
new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'size', 50),
|
||||||
new SearchComparison(ISearchComparison::COMPARE_LESS_THAN, 'mtime', 125), [1001]
|
new SearchComparison(ISearchComparison::COMPARE_LESS_THAN, 'mtime', 125), [0]
|
||||||
]), [1001]],
|
]), [0]],
|
||||||
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [
|
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [
|
||||||
new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mtime', 100),
|
new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mtime', 100),
|
||||||
new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mtime', 150),
|
new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mtime', 150),
|
||||||
]), [1001, 1002]],
|
]), [0, 1]],
|
||||||
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_NOT, [
|
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_NOT, [
|
||||||
new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mtime', 150),
|
new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mtime', 150),
|
||||||
]), [1001]],
|
]), [0]],
|
||||||
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_NOT, [
|
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_NOT, [
|
||||||
new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, 'mtime', 125),
|
new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, 'mtime', 125),
|
||||||
]), [1001]],
|
]), [0]],
|
||||||
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_NOT, [
|
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_NOT, [
|
||||||
new SearchComparison(ISearchComparison::COMPARE_LESS_THAN, 'mtime', 125),
|
new SearchComparison(ISearchComparison::COMPARE_LESS_THAN, 'mtime', 125),
|
||||||
]), [1002]],
|
]), [1]],
|
||||||
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_NOT, [
|
[new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_NOT, [
|
||||||
new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%bar'),
|
new SearchComparison(ISearchComparison::COMPARE_LIKE, 'name', '%bar'),
|
||||||
]), [1002]],
|
]), [1]],
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -178,22 +180,25 @@ class QuerySearchHelperTest extends TestCase {
|
||||||
* @param array $fileIds
|
* @param array $fileIds
|
||||||
*/
|
*/
|
||||||
public function testComparison(ISearchOperator $operator, array $fileIds) {
|
public function testComparison(ISearchOperator $operator, array $fileIds) {
|
||||||
$this->addCacheEntry([
|
$fileId = [];
|
||||||
|
$fileId[] = $this->addCacheEntry([
|
||||||
'path' => 'foobar',
|
'path' => 'foobar',
|
||||||
'fileid' => 1001,
|
|
||||||
'mtime' => 100,
|
'mtime' => 100,
|
||||||
'size' => 50,
|
'size' => 50,
|
||||||
'mimetype' => 'image/jpg'
|
'mimetype' => 'image/jpg'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->addCacheEntry([
|
$fileId[] = $this->addCacheEntry([
|
||||||
'path' => 'fooasd',
|
'path' => 'fooasd',
|
||||||
'fileid' => 1002,
|
|
||||||
'mtime' => 150,
|
'mtime' => 150,
|
||||||
'size' => 50,
|
'size' => 50,
|
||||||
'mimetype' => 'image/png'
|
'mimetype' => 'image/png'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$fileIds = array_map(function($i) use ($fileId) {
|
||||||
|
return $fileId[$i];
|
||||||
|
}, $fileIds);
|
||||||
|
|
||||||
$results = $this->search($operator);
|
$results = $this->search($operator);
|
||||||
|
|
||||||
sort($fileIds);
|
sort($fileIds);
|
||||||
|
|
|
@ -332,7 +332,7 @@ class UserMountCacheTest extends TestCase {
|
||||||
$id = (int)$this->connection->lastInsertId('*PREFIX*filecache');
|
$id = (int)$this->connection->lastInsertId('*PREFIX*filecache');
|
||||||
$this->fileIds[] = $id;
|
$this->fileIds[] = $id;
|
||||||
} else {
|
} else {
|
||||||
$sql = 'SELECT fileid FROM *PREFIX*filecache WHERE `storage` = ? AND `path_hash` =?';
|
$sql = 'SELECT `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` =?';
|
||||||
$query = $this->connection->prepare($sql);
|
$query = $this->connection->prepare($sql);
|
||||||
$query->execute([$storageId, md5($internalPath)]);
|
$query->execute([$storageId, md5($internalPath)]);
|
||||||
return (int)$query->fetchColumn();
|
return (int)$query->fetchColumn();
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
namespace Test\Repair\NC12;
|
namespace Test\Repair\NC12;
|
||||||
|
|
||||||
use OC\Repair\NC12\UpdateLanguageCodes;
|
use OC\Repair\NC12\UpdateLanguageCodes;
|
||||||
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\Migration\IOutput;
|
use OCP\Migration\IOutput;
|
||||||
use Test\TestCase;
|
use Test\TestCase;
|
||||||
|
@ -152,7 +153,7 @@ class UpdateLanguageCodesTest extends TestCase {
|
||||||
->where($qb->expr()->eq('userid', $qb->createNamedParameter($user['userid'])))
|
->where($qb->expr()->eq('userid', $qb->createNamedParameter($user['userid'])))
|
||||||
->andWhere($qb->expr()->eq('appid', $qb->createNamedParameter('core')))
|
->andWhere($qb->expr()->eq('appid', $qb->createNamedParameter('core')))
|
||||||
->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang')))
|
->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter('lang')))
|
||||||
->andWhere($qb->expr()->eq('configvalue', $qb->createNamedParameter($user['configvalue'])))
|
->andWhere($qb->expr()->eq('configvalue', $qb->createNamedParameter($user['configvalue']), IQueryBuilder::PARAM_STR))
|
||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1246,7 +1246,9 @@ class ShareTest extends \Test\TestCase {
|
||||||
->setParameter('owner', $this->user1->getUID())
|
->setParameter('owner', $this->user1->getUID())
|
||||||
->setParameter('share_type', \OCP\Share::SHARE_TYPE_LINK);
|
->setParameter('share_type', \OCP\Share::SHARE_TYPE_LINK);
|
||||||
|
|
||||||
$res = $qb->execute()->fetchAll();
|
$result = $qb->execute();
|
||||||
|
$res = $result->fetchAll();
|
||||||
|
$result->closeCursor();
|
||||||
$this->assertCount(1, $res);
|
$this->assertCount(1, $res);
|
||||||
$id = $res[0]['id'];
|
$id = $res[0]['id'];
|
||||||
|
|
||||||
|
@ -1260,7 +1262,9 @@ class ShareTest extends \Test\TestCase {
|
||||||
->from('share')
|
->from('share')
|
||||||
->where($qb->expr()->eq('id', $qb->createParameter('id')))
|
->where($qb->expr()->eq('id', $qb->createParameter('id')))
|
||||||
->setParameter('id', $id);
|
->setParameter('id', $id);
|
||||||
$hash = $qb->execute()->fetch()['share_with'];
|
$result = $qb->execute();
|
||||||
|
$hash = $result->fetch()['share_with'];
|
||||||
|
$result->closeCursor();
|
||||||
|
|
||||||
$hasher = \OC::$server->getHasher();
|
$hasher = \OC::$server->getHasher();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue