aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/DB/Connection.php2
-rw-r--r--lib/private/DB/ConnectionFactory.php1
-rw-r--r--lib/private/DB/SetTransactionIsolationLevel.php46
-rw-r--r--lib/private/Files/Cache/AbstractCacheEvent.php8
-rw-r--r--lib/private/Share20/Manager.php6
-rw-r--r--lib/private/Tags.php19
-rw-r--r--lib/private/Updater/ChangesCheck.php6
7 files changed, 73 insertions, 15 deletions
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php
index 560c29dfe6a..8150f08593f 100644
--- a/lib/private/DB/Connection.php
+++ b/lib/private/DB/Connection.php
@@ -151,8 +151,6 @@ class Connection extends ReconnectWrapper implements IDBConnection {
parent::__construct($params, $driver, $config, $eventManager);
$this->adapter = new $params['adapter']($this);
$this->tablePrefix = $params['tablePrefix'];
-
- $this->setTransactionIsolation(TransactionIsolationLevel::READ_COMMITTED);
}
/**
diff --git a/lib/private/DB/ConnectionFactory.php b/lib/private/DB/ConnectionFactory.php
index 2e8d77881b6..427a292b6b5 100644
--- a/lib/private/DB/ConnectionFactory.php
+++ b/lib/private/DB/ConnectionFactory.php
@@ -122,6 +122,7 @@ class ConnectionFactory {
public function getConnection($type, $additionalConnectionParams) {
$normalizedType = $this->normalizeType($type);
$eventManager = new EventManager();
+ $eventManager->addEventSubscriber(new SetTransactionIsolationLevel());
switch ($normalizedType) {
case 'mysql':
$eventManager->addEventSubscriber(
diff --git a/lib/private/DB/SetTransactionIsolationLevel.php b/lib/private/DB/SetTransactionIsolationLevel.php
new file mode 100644
index 00000000000..0a65cbbf463
--- /dev/null
+++ b/lib/private/DB/SetTransactionIsolationLevel.php
@@ -0,0 +1,46 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2019 Daniel Kesselberg <mail@danielkesselberg.de>
+ *
+ * @author Daniel Kesselberg <mail@danielkesselberg.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OC\DB;
+
+use Doctrine\Common\EventSubscriber;
+use Doctrine\DBAL\Event\ConnectionEventArgs;
+use Doctrine\DBAL\Events;
+use Doctrine\DBAL\TransactionIsolationLevel;
+
+class SetTransactionIsolationLevel implements EventSubscriber {
+ /**
+ * @param ConnectionEventArgs $args
+ * @return void
+ */
+ public function postConnect(ConnectionEventArgs $args) {
+ $args->getConnection()->setTransactionIsolation(TransactionIsolationLevel::READ_COMMITTED);
+ }
+
+ public function getSubscribedEvents() {
+ return [Events::postConnect];
+ }
+}
diff --git a/lib/private/Files/Cache/AbstractCacheEvent.php b/lib/private/Files/Cache/AbstractCacheEvent.php
index 0fd03779009..741c06f3490 100644
--- a/lib/private/Files/Cache/AbstractCacheEvent.php
+++ b/lib/private/Files/Cache/AbstractCacheEvent.php
@@ -65,6 +65,14 @@ class AbstractCacheEvent extends Event implements ICacheEvent {
}
/**
+ * @param string $path
+ * @since 19.0.0
+ */
+ public function setPath(string $path): void {
+ $this->path = $path;
+ }
+
+ /**
* @return int
* @since 16.0.0
*/
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 8ec025ebc26..ca668e24e7f 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -289,7 +289,8 @@ class Manager implements IManager {
// Check if we actually have share permissions
if (!$share->getNode()->isShareable()) {
- $message_t = $this->l->t('You are not allowed to share %s', [$share->getNode()->getPath()]);
+ $path = $userFolder->getRelativePath($share->getNode()->getPath());
+ $message_t = $this->l->t('You are not allowed to share %s', [$path]);
throw new GenericShareException($message_t, $message_t, 404);
}
@@ -333,7 +334,8 @@ class Manager implements IManager {
// Check that we do not share with more permissions than we have
if ($share->getPermissions() & ~$permissions) {
- $message_t = $this->l->t('Can’t increase permissions of %s', [$share->getNode()->getPath()]);
+ $path = $userFolder->getRelativePath($share->getNode()->getPath());
+ $message_t = $this->l->t('Can’t increase permissions of %s', [$path]);
throw new GenericShareException($message_t, $message_t, 404);
}
diff --git a/lib/private/Tags.php b/lib/private/Tags.php
index 0aa37161eb2..fe24391a1a5 100644
--- a/lib/private/Tags.php
+++ b/lib/private/Tags.php
@@ -48,8 +48,9 @@ use OC\Tagging\Tag;
use OC\Tagging\TagMapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\ILogger;
+use OCP\ITags;
-class Tags implements \OCP\ITags {
+class Tags implements ITags {
/**
* Tags
@@ -112,8 +113,6 @@ class Tags implements \OCP\ITags {
const TAG_TABLE = '*PREFIX*vcategory';
const RELATION_TABLE = '*PREFIX*vcategory_to_object';
- const TAG_FAVORITE = '_$!<Favorite>!$_';
-
/**
* Constructor.
*
@@ -186,7 +185,7 @@ class Tags implements \OCP\ITags {
$tagMap = array();
foreach($this->tags as $tag) {
- if($tag->getName() !== self::TAG_FAVORITE) {
+ if($tag->getName() !== ITags::TAG_FAVORITE) {
$tagMap[] = $this->tagMap($tag);
}
}
@@ -624,12 +623,12 @@ class Tags implements \OCP\ITags {
* @return array|false An array of object ids.
*/
public function getFavorites() {
- if(!$this->userHasTag(self::TAG_FAVORITE, $this->user)) {
+ if(!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) {
return [];
}
try {
- return $this->getIdsForTag(self::TAG_FAVORITE);
+ return $this->getIdsForTag(ITags::TAG_FAVORITE);
} catch(\Exception $e) {
\OC::$server->getLogger()->logException($e, [
'message' => __METHOD__,
@@ -647,10 +646,10 @@ class Tags implements \OCP\ITags {
* @return boolean
*/
public function addToFavorites($objid) {
- if(!$this->userHasTag(self::TAG_FAVORITE, $this->user)) {
- $this->add(self::TAG_FAVORITE);
+ if(!$this->userHasTag(ITags::TAG_FAVORITE, $this->user)) {
+ $this->add(ITags::TAG_FAVORITE);
}
- return $this->tagAs($objid, self::TAG_FAVORITE);
+ return $this->tagAs($objid, ITags::TAG_FAVORITE);
}
/**
@@ -660,7 +659,7 @@ class Tags implements \OCP\ITags {
* @return boolean
*/
public function removeFromFavorites($objid) {
- return $this->unTag($objid, self::TAG_FAVORITE);
+ return $this->unTag($objid, ITags::TAG_FAVORITE);
}
/**
diff --git a/lib/private/Updater/ChangesCheck.php b/lib/private/Updater/ChangesCheck.php
index f1f44cc59c8..7346ceab6b1 100644
--- a/lib/private/Updater/ChangesCheck.php
+++ b/lib/private/Updater/ChangesCheck.php
@@ -55,7 +55,11 @@ class ChangesCheck {
public function getChangesForVersion(string $version): array {
$version = $this->normalizeVersion($version);
$changesInfo = $this->mapper->getChanges($version);
- return json_decode($changesInfo->getData(), true);
+ $changesData = json_decode($changesInfo->getData(), true);
+ if(empty($changesData)) {
+ throw new DoesNotExistException();
+ }
+ return $changesData;
}
/**