Merge pull request #1734 from nextcloud/setvalue_opt
AllConfig setUserValue opt
This commit is contained in:
commit
c55a737b26
|
@ -343,6 +343,10 @@ class MigrationTest extends \Test\TestCase {
|
||||||
unset($cache['files_encryption']);
|
unset($cache['files_encryption']);
|
||||||
$this->invokePrivate(\OC::$server->getAppConfig(), 'cache', [$cache]);
|
$this->invokePrivate(\OC::$server->getAppConfig(), 'cache', [$cache]);
|
||||||
|
|
||||||
|
$cache = $this->invokePrivate($config, 'userCache');
|
||||||
|
unset($cache[self::TEST_ENCRYPTION_MIGRATION_USER1]);
|
||||||
|
$this->invokePrivate(\OC::$server->getAppConfig(), 'userCache', [$cache]);
|
||||||
|
|
||||||
// delete default values set by the encryption app during initialization
|
// delete default values set by the encryption app during initialization
|
||||||
|
|
||||||
/** @var \OCP\IDBConnection $connection */
|
/** @var \OCP\IDBConnection $connection */
|
||||||
|
|
|
@ -215,6 +215,25 @@ class AllConfig implements \OCP\IConfig {
|
||||||
// TODO - FIXME
|
// TODO - FIXME
|
||||||
$this->fixDIInit();
|
$this->fixDIInit();
|
||||||
|
|
||||||
|
if (isset($this->userCache[$userId][$appName][$key])) {
|
||||||
|
if ($this->userCache[$userId][$appName][$key] === (string)$value) {
|
||||||
|
return;
|
||||||
|
} else if ($preCondition !== null && $this->userCache[$userId][$appName][$key] !== (string)$preCondition) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
$qb = $this->connection->getQueryBuilder();
|
||||||
|
$qb->update('preferences')
|
||||||
|
->set('configvalue', $qb->createNamedParameter($value))
|
||||||
|
->where($qb->expr()->eq('userid', $qb->createNamedParameter($userId)))
|
||||||
|
->andWhere($qb->expr()->eq('appid', $qb->createNamedParameter($appName)))
|
||||||
|
->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key)));
|
||||||
|
$qb->execute();
|
||||||
|
|
||||||
|
$this->userCache[$userId][$appName][$key] = $value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$preconditionArray = [];
|
$preconditionArray = [];
|
||||||
if (isset($preCondition)) {
|
if (isset($preCondition)) {
|
||||||
$preconditionArray = [
|
$preconditionArray = [
|
||||||
|
|
Loading…
Reference in New Issue