summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-11-26 15:49:14 +0100
committerVincent Petry <pvince81@owncloud.com>2015-11-27 17:54:29 +0100
commitb666367a7902c5d935f7aef1704711b8695690b2 (patch)
treefc65f2208512f53e8390c55d84bfcf54ab60fdb7 /lib
parent129ec4fb4054f2f145285772b94d7d5e1cd56286 (diff)
downloadnextcloud-server-b666367a7902c5d935f7aef1704711b8695690b2.tar.gz
nextcloud-server-b666367a7902c5d935f7aef1704711b8695690b2.zip
Added system tags data structure and PHP side managers
Added SystemTagManager and SystemTagObjectMapper
Diffstat (limited to 'lib')
-rw-r--r--lib/private/server.php29
-rw-r--r--lib/private/systemtag/systemtag.php90
-rw-r--r--lib/private/systemtag/systemtagmanager.php264
-rw-r--r--lib/private/systemtag/systemtagobjectmapper.php213
-rw-r--r--lib/public/iservercontainer.php18
-rw-r--r--lib/public/systemtag/isystemtag.php2
-rw-r--r--lib/public/systemtag/isystemtagmanager.php (renamed from lib/public/systemtag/isystemtagsmanager.php)10
-rw-r--r--lib/public/systemtag/isystemtagobjectmapper.php10
8 files changed, 631 insertions, 5 deletions
diff --git a/lib/private/server.php b/lib/private/server.php
index ea5937dfea4..8171a00b3d1 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -138,6 +138,12 @@ class Server extends SimpleContainer implements IServerContainer {
$tagMapper = $c->query('TagMapper');
return new TagManager($tagMapper, $c->getUserSession());
});
+ $this->registerService('SystemTagManager', function (Server $c) {
+ return new SystemTag\SystemTagManager($c->getDatabaseConnection());
+ });
+ $this->registerService('SystemTagObjectMapper', function (Server $c) {
+ return new SystemTag\SystemTagObjectMapper($c->getDatabaseConnection(), $c->getSystemTagManager());
+ });
$this->registerService('RootFolder', function (Server $c) {
// TODO: get user and user manager from container as well
$user = \OC_User::getUser();
@@ -582,6 +588,29 @@ class Server extends SimpleContainer implements IServerContainer {
}
/**
+ * Returns the system-tag manager
+ *
+ * @return \OCP\SystemTag\ISystemTagManager
+ *
+ * @since 9.0.0
+ */
+ public function getSystemTagManager() {
+ return $this->query('SystemTagManager');
+ }
+
+ /**
+ * Returns the system-tag object mapper
+ *
+ * @return \OCP\SystemTag\ISystemTagObjectMapper
+ *
+ * @since 9.0.0
+ */
+ public function getSystemTagObjectMapper() {
+ return $this->query('SystemTagObjectMapper');
+ }
+
+
+ /**
* Returns the avatar manager, used for avatar functionality
*
* @return \OCP\IAvatarManager
diff --git a/lib/private/systemtag/systemtag.php b/lib/private/systemtag/systemtag.php
new file mode 100644
index 00000000000..b79cc33cfb2
--- /dev/null
+++ b/lib/private/systemtag/systemtag.php
@@ -0,0 +1,90 @@
+<?php
+/**
+ * @author Vincent Petry <pvince81@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\SystemTag;
+
+use \OCP\IDBConnection;
+
+class SystemTag implements \OCP\SystemTag\ISystemTag {
+
+ /**
+ * @var string
+ */
+ private $id;
+
+ /**
+ * @var string
+ */
+ private $name;
+
+ /**
+ * @var bool
+ */
+ private $userVisible;
+
+ /**
+ * @var bool
+ */
+ private $userAssignable;
+
+ /**
+ * Constructor.
+ *
+ * @param string $id tag id
+ * @param string $name tag name
+ * @param bool $userVisible whether the tag is user visible
+ * @param bool $userAssignable whether the tag is user assignable
+ */
+ public function __construct($id, $name, $userVisible, $userAssignable) {
+ $this->id = $id;
+ $this->name = $name;
+ $this->userVisible = $userVisible;
+ $this->userAssignable = $userAssignable;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getId() {
+ return $this->id;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getName() {
+ return $this->name;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isUserVisible() {
+ return $this->userVisible;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isUserAssignable() {
+ return $this->userAssignable;
+ }
+}
diff --git a/lib/private/systemtag/systemtagmanager.php b/lib/private/systemtag/systemtagmanager.php
new file mode 100644
index 00000000000..e307825ecfa
--- /dev/null
+++ b/lib/private/systemtag/systemtagmanager.php
@@ -0,0 +1,264 @@
+<?php
+/**
+ * @author Vincent Petry <pvince81@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\SystemTag;
+
+use \OCP\IDBConnection;
+use \OCP\SystemTag\TagNotFoundException;
+use \OCP\SystemTag\TagAlreadyExistsException;
+
+use \Doctrine\DBAL\Exception\UniqueConstraintViolationException;
+
+class SystemTagManager implements \OCP\SystemTag\ISystemTagManager {
+
+ const TAG_TABLE = 'systemtag';
+
+ /**
+ * @var IDBConnection
+ */
+ private $connection;
+
+ /**
+ * Prepared query for selecting tags directly
+ *
+ * @var \OCP\DB\QueryBuilder\IQueryBuilder
+ */
+ private $selectTagQuery;
+
+ /**
+ * Constructor.
+ *
+ * @param IDBConnection $connection database connection
+ */
+ public function __construct(IDBConnection $connection) {
+ $this->connection = $connection;
+
+ $query = $this->connection->getQueryBuilder();
+ $this->selectTagQuery = $query->select('*')
+ ->from(self::TAG_TABLE)
+ ->where($query->expr()->eq('name', $query->createParameter('name')))
+ ->andWhere($query->expr()->eq('visibility', $query->createParameter('visibility')))
+ ->andWhere($query->expr()->eq('editable', $query->createParameter('editable')));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getTagsById($tagIds) {
+ if (!is_array($tagIds)) {
+ $tagIds = [$tagIds];
+ }
+
+ $tags = [];
+
+ // note: not all databases will fail if it's a string or starts with a number
+ foreach ($tagIds as $tagId) {
+ if (!is_numeric($tagId)) {
+ throw new \InvalidArgumentException('Tag id must be integer');
+ }
+ }
+
+ $query = $this->connection->getQueryBuilder();
+ $query->select('*')
+ ->from(self::TAG_TABLE)
+ ->where($query->expr()->in('id', $query->createParameter('tagids')))
+ ->addOrderBy('name', 'ASC')
+ ->addOrderBy('visibility', 'ASC')
+ ->addOrderBy('editable', 'ASC')
+ ->setParameter('tagids', $tagIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY);
+
+ $result = $query->execute();
+ while ($row = $result->fetch()) {
+ $tags[$row['id']] = $this->createSystemTagFromRow($row);
+ }
+
+ $result->closeCursor();
+
+ if (count($tags) !== count($tagIds)) {
+ throw new TagNotFoundException(
+ 'Tag(s) with id(s) ' . json_encode(array_diff($tagIds, array_keys($tags))) . ' not found'
+ );
+ }
+
+ return $tags;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getAllTags($visibilityFilter = null, $nameSearchPattern = null) {
+ $tags = [];
+
+ $query = $this->connection->getQueryBuilder();
+ $query->select('*')
+ ->from(self::TAG_TABLE);
+
+ if (!is_null($visibilityFilter)) {
+ $query->andWhere($query->expr()->eq('visibility', $query->createNamedParameter((int)$visibilityFilter)));
+ }
+
+ if (!empty($nameSearchPattern)) {
+ $query->andWhere(
+ $query->expr()->like(
+ 'name',
+ $query->expr()->literal('%' . $this->connection->escapeLikeParameter($nameSearchPattern). '%')
+ )
+ );
+ }
+
+ $query
+ ->addOrderBy('name', 'ASC')
+ ->addOrderBy('visibility', 'ASC')
+ ->addOrderBy('editable', 'ASC');
+
+ $result = $query->execute();
+ while ($row = $result->fetch()) {
+ $tags[$row['id']] = $this->createSystemTagFromRow($row);
+ }
+
+ $result->closeCursor();
+
+ return $tags;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getTag($tagName, $userVisible, $userAssignable) {
+ $userVisible = (int)$userVisible;
+ $userAssignable = (int)$userAssignable;
+
+ $result = $this->selectTagQuery
+ ->setParameter('name', $tagName)
+ ->setParameter('visibility', $userVisible)
+ ->setParameter('editable', $userAssignable)
+ ->execute();
+
+ $row = $result->fetch();
+ $result->closeCursor();
+ if (!$row) {
+ throw new TagNotFoundException(
+ 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') does not exist'
+ );
+ }
+
+ return $this->createSystemTagFromRow($row);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function createTag($tagName, $userVisible, $userAssignable) {
+ $userVisible = (int)$userVisible;
+ $userAssignable = (int)$userAssignable;
+
+ $query = $this->connection->getQueryBuilder();
+ $query->insert(self::TAG_TABLE)
+ ->values([
+ 'name' => $query->createNamedParameter($tagName),
+ 'visibility' => $query->createNamedParameter($userVisible),
+ 'editable' => $query->createNamedParameter($userAssignable),
+ ]);
+
+ try {
+ $query->execute();
+ } catch (UniqueConstraintViolationException $e) {
+ throw new TagAlreadyExistsException(
+ 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') already exists',
+ 0,
+ $e
+ );
+ }
+
+ $tagId = $this->connection->lastInsertId('*PREFIX*' . self::TAG_TABLE);
+
+ return new SystemTag(
+ (int)$tagId,
+ $tagName,
+ (bool)$userVisible,
+ (bool)$userAssignable
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function updateTag($tagId, $tagName, $userVisible, $userAssignable) {
+ $userVisible = (int)$userVisible;
+ $userAssignable = (int)$userAssignable;
+
+ $query = $this->connection->getQueryBuilder();
+ $query->update(self::TAG_TABLE)
+ ->set('name', $query->createParameter('name'))
+ ->set('visibility', $query->createParameter('visibility'))
+ ->set('editable', $query->createParameter('editable'))
+ ->where($query->expr()->eq('id', $query->createParameter('tagid')))
+ ->setParameter('name', $tagName)
+ ->setParameter('visibility', $userVisible)
+ ->setParameter('editable', $userAssignable)
+ ->setParameter('tagid', $tagId);
+
+ try {
+ if ($query->execute() === 0) {
+ throw new TagNotFoundException(
+ 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') does not exist'
+ );
+ }
+ } catch (UniqueConstraintViolationException $e) {
+ throw new TagAlreadyExistsException(
+ 'Tag ("' . $tagName . '", '. $userVisible . ', ' . $userAssignable . ') already exists',
+ 0,
+ $e
+ );
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function deleteTags($tagIds) {
+ if (!is_array($tagIds)) {
+ $tagIds = [$tagIds];
+ }
+
+ // delete relationships first
+ $query = $this->connection->getQueryBuilder();
+ $query->delete(SystemTagObjectMapper::RELATION_TABLE)
+ ->where($query->expr()->in('systemtagid', $query->createParameter('tagids')))
+ ->setParameter('tagids', $tagIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY)
+ ->execute();
+
+ $query = $this->connection->getQueryBuilder();
+ $query->delete(self::TAG_TABLE)
+ ->where($query->expr()->in('id', $query->createParameter('tagids')))
+ ->setParameter('tagids', $tagIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY);
+
+ if ($query->execute() === 0) {
+ throw new TagNotFoundException(
+ 'Tag does not exist'
+ );
+ }
+ }
+
+ private function createSystemTagFromRow($row) {
+ return new SystemTag((int)$row['id'], $row['name'], (bool)$row['visibility'], (bool)$row['editable']);
+ }
+}
diff --git a/lib/private/systemtag/systemtagobjectmapper.php b/lib/private/systemtag/systemtagobjectmapper.php
new file mode 100644
index 00000000000..f2adc2e3ebd
--- /dev/null
+++ b/lib/private/systemtag/systemtagobjectmapper.php
@@ -0,0 +1,213 @@
+<?php
+/**
+ * @author Vincent Petry <pvince81@owncloud.com>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * 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, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\SystemTag;
+
+use \OCP\SystemTag\ISystemTagManager;
+use \OCP\IDBConnection;
+use \OCP\SystemTag\TagNotFoundException;
+use \Doctrine\DBAL\Exception\UniqueConstraintViolationException;
+
+class SystemTagObjectMapper implements \OCP\SystemTag\ISystemTagObjectMapper {
+
+ const RELATION_TABLE = 'systemtag_object_mapping';
+
+ /**
+ * @var ISystemTagManager
+ */
+ private $tagManager;
+
+ /**
+ * @var IDBConnection
+ */
+ private $connection;
+
+ /**
+ * Constructor.
+ *
+ * @param IDBConnection $connection database connection
+ * @param ISystemTagManager $tagManager system tag manager
+ */
+ public function __construct(IDBConnection $connection, ISystemTagManager $tagManager) {
+ $this->connection = $connection;
+ $this->tagManager = $tagManager;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getTagIdsForObjects($objIds, $objectType) {
+ if (!is_array($objIds)) {
+ $objIds = [$objIds];
+ }
+
+ $query = $this->connection->getQueryBuilder();
+ $query->select(['systemtagid', 'objectid'])
+ ->from(self::RELATION_TABLE)
+ ->where($query->expr()->in('objectid', $query->createParameter('objectids')))
+ ->andWhere($query->expr()->eq('objecttype', $query->createParameter('objecttype')))
+ ->setParameter('objectids', $objIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY)
+ ->setParameter('objecttype', $objectType)
+ ->addOrderBy('objectid', 'ASC')
+ ->addOrderBy('systemtagid', 'ASC');
+
+ $mapping = [];
+ foreach ($objIds as $objId) {
+ $mapping[$objId] = [];
+ }
+
+ $result = $query->execute();
+ while ($row = $result->fetch()) {
+ $objectId = $row['objectid'];
+ $mapping[$objectId][] = $row['systemtagid'];
+ }
+
+ $result->closeCursor();
+
+ return $mapping;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getObjectIdsForTags($tagIds, $objectType) {
+ if (!is_array($tagIds)) {
+ $tagIds = [$tagIds];
+ }
+
+ $this->assertTagsExist($tagIds);
+
+ $query = $this->connection->getQueryBuilder();
+ $query->select($query->createFunction('DISTINCT(objectid)'))
+ ->from(self::RELATION_TABLE)
+ ->where($query->expr()->in('systemtagid', $query->createParameter('tagids')))
+ ->andWhere($query->expr()->eq('objecttype', $query->createParameter('objecttype')))
+ ->setParameter('tagids', $tagIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY)
+ ->setParameter('objecttype', $objectType);
+
+ $objectIds = [];
+
+ $result = $query->execute();
+ while ($row = $result->fetch()) {
+ $objectIds[] = $row['objectid'];
+ }
+
+ return $objectIds;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function assignTags($objId, $objectType, $tagIds) {
+ if (!is_array($tagIds)) {
+ $tagIds = [$tagIds];
+ }
+
+ $this->assertTagsExist($tagIds);
+
+ $query = $this->connection->getQueryBuilder();
+ $query->insert(self::RELATION_TABLE)
+ ->values([
+ 'objectid' => $query->createNamedParameter($objId),
+ 'objecttype' => $query->createNamedParameter($objectType),
+ 'systemtagid' => $query->createParameter('tagid'),
+ ]);
+
+ foreach ($tagIds as $tagId) {
+ try {
+ $query->setParameter('tagid', $tagId);
+ $query->execute();
+ } catch (UniqueConstraintViolationException $e) {
+ // ignore existing relations
+ }
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function unassignTags($objId, $objectType, $tagIds) {
+ if (!is_array($tagIds)) {
+ $tagIds = [$tagIds];
+ }
+
+ $this->assertTagsExist($tagIds);
+
+ $query = $this->connection->getQueryBuilder();
+ $query->delete(self::RELATION_TABLE)
+ ->where($query->expr()->eq('objectid', $query->createParameter('objectid')))
+ ->andWhere($query->expr()->eq('objecttype', $query->createParameter('objecttype')))
+ ->andWhere($query->expr()->in('systemtagid', $query->createParameter('tagids')))
+ ->setParameter('objectid', $objId)
+ ->setParameter('objecttype', $objectType)
+ ->setParameter('tagids', $tagIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY)
+ ->execute();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function haveTag($objIds, $objectType, $tagId, $all = true) {
+ $this->assertTagsExist([$tagId]);
+
+ $query = $this->connection->getQueryBuilder();
+ $query->select($query->createFunction('COUNT(1)'))
+ ->from(self::RELATION_TABLE)
+ ->where($query->expr()->in('objectid', $query->createParameter('objectids')))
+ ->andWhere($query->expr()->eq('objecttype', $query->createParameter('objecttype')))
+ ->andWhere($query->expr()->eq('systemtagid', $query->createParameter('tagid')))
+ ->setParameter('objectids', $objIds, \Doctrine\DBAL\Connection::PARAM_INT_ARRAY)
+ ->setParameter('tagid', $tagId)
+ ->setParameter('objecttype', $objectType)
+ ->setMaxResults(1);
+
+ $result = $query->execute();
+ $row = $result->fetch(\PDO::FETCH_NUM);
+ $result->closeCursor();
+ if ($all) {
+ return ((int)$row[0] === count($objIds));
+ } else {
+ return (int)$row[0] > 0;
+ }
+ }
+
+ /**
+ * Asserts that all the given tag ids exist.
+ *
+ * @param string[] $tagIds tag ids to check
+ *
+ * @throws \OCP\SystemTag\TagNotFoundException if at least one tag did not exist
+ */
+ private function assertTagsExist($tagIds) {
+ $tags = $this->tagManager->getTagsById($tagIds);
+ if (count($tags) !== count($tagIds)) {
+ // at least one tag missing, bail out
+ $foundTagIds = array_map(
+ function($tag) {
+ return $tag->getId();
+ },
+ $tags
+ );
+ $missingTagIds = array_diff($tagIds, $foundTagIds);
+ throw new TagNotFoundException('Tags ' . json_encode($missingTagIds) . ' do not exist');
+ }
+ }
+}
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php
index d85f812b2e7..7cb2672254b 100644
--- a/lib/public/iservercontainer.php
+++ b/lib/public/iservercontainer.php
@@ -470,4 +470,22 @@ interface IServerContainer {
* @since 8.2.0
*/
public function getNotificationManager();
+
+ /**
+ * Returns the system-tag manager
+ *
+ * @return \OCP\SystemTag\ISystemTagManager
+ *
+ * @since 9.0.0
+ */
+ public function getSystemTagManager();
+
+ /**
+ * Returns the system-tag object mapper
+ *
+ * @return \OCP\SystemTag\ISystemTagObjectMapper
+ *
+ * @since 9.0.0
+ */
+ public function getSystemTagObjectMapper();
}
diff --git a/lib/public/systemtag/isystemtag.php b/lib/public/systemtag/isystemtag.php
index 76a812f38dc..26609fd8af7 100644
--- a/lib/public/systemtag/isystemtag.php
+++ b/lib/public/systemtag/isystemtag.php
@@ -62,7 +62,7 @@ interface ISystemTag {
*
* @since 9.0.0
*/
- public function isUserAsssignable();
+ public function isUserAssignable();
}
diff --git a/lib/public/systemtag/isystemtagsmanager.php b/lib/public/systemtag/isystemtagmanager.php
index df59cc48d52..2020ec52900 100644
--- a/lib/public/systemtag/isystemtagsmanager.php
+++ b/lib/public/systemtag/isystemtagmanager.php
@@ -31,9 +31,11 @@ interface ISystemTagManager {
/**
* Returns the tag objects matching the given tag ids.
*
- * @param array|string $tagIds The ID or array of IDs of the tags to retrieve
+ * @param array|string $tagIds id or array of unique ids of the tag to retrieve
*
- * @return \OCP\SystemTag\ISystemTag[] array of system tags or empty array if none found
+ * @return \OCP\SystemTag\ISystemTag[] array of system tags with tag id as key
+ *
+ * @throws \OCP\SystemTag\TagNotFoundException if at least one given tag id did no exist
*
* @since 9.0.0
*/
@@ -72,14 +74,14 @@ interface ISystemTagManager {
/**
* Returns all known tags, optionally filtered by visibility.
*
- * @param bool $visibleOnly whether to only return user visible tags
+ * @param bool|null $visibilityFilter filter by visibility if non-null
* @param string $nameSearchPattern optional search pattern for the tag name
*
* @return \OCP\SystemTag\ISystemTag[] array of system tags or empty array if none found
*
* @since 9.0.0
*/
- public function getAllTags($visibleOnly = false, $nameSearchPattern = null);
+ public function getAllTags($visibilityFilter = null, $nameSearchPattern = null);
/**
* Updates the given tag
diff --git a/lib/public/systemtag/isystemtagobjectmapper.php b/lib/public/systemtag/isystemtagobjectmapper.php
index 8c6c27c4846..e2ac1fab124 100644
--- a/lib/public/systemtag/isystemtagobjectmapper.php
+++ b/lib/public/systemtag/isystemtagobjectmapper.php
@@ -69,6 +69,11 @@ interface ISystemTagObjectMapper {
/**
* Assign the given tags to the given object.
*
+ * If at least one of the given tag ids doesn't exist, none of the tags
+ * will be assigned.
+ *
+ * If the relationship already existed, fail silently.
+ *
* @param string $objId object id
* @param string $objectType object type
* @param string|array $tagIds tag id or array of tag ids to assign
@@ -83,6 +88,11 @@ interface ISystemTagObjectMapper {
/**
* Unassign the given tags from the given object.
*
+ * If at least one of the given tag ids doesn't exist, none of the tags
+ * will be unassigned.
+ *
+ * If the relationship did not exist in the first place, fail silently.
+ *
* @param string $objId object id
* @param string $objectType object type
* @param string|array $tagIds tag id or array of tag ids to unassign