diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-03-12 15:09:55 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-03-12 17:45:49 +0100 |
commit | 2b335fd607e15c9955d6d42f50c460f04f7fe445 (patch) | |
tree | fe30052a2a6c01794f15c7c934bd23ff946028e9 /lib | |
parent | 3655951dd7372be9193e9ddd6f4b717f8d2cc6b4 (diff) | |
download | nextcloud-server-2b335fd607e15c9955d6d42f50c460f04f7fe445.tar.gz nextcloud-server-2b335fd607e15c9955d6d42f50c460f04f7fe445.zip |
Use insertIfNotExist of the new interface
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Tags.php | 5 | ||||
-rw-r--r-- | lib/public/DB.php | 17 |
2 files changed, 3 insertions, 19 deletions
diff --git a/lib/private/Tags.php b/lib/private/Tags.php index cc7bbf01ab4..2bc5572c40f 100644 --- a/lib/private/Tags.php +++ b/lib/private/Tags.php @@ -491,12 +491,13 @@ class Tags implements \OCP\ITags { $tags = $this->tags; // For some reason this is needed or array_search(i) will return 0..? ksort($tags); + $dbConnection = \OC::$server->getDatabaseConnection(); foreach(self::$relations as $relation) { $tagId = $this->getTagId($relation['tag']); \OCP\Util::writeLog('core', __METHOD__ . 'catid, ' . $relation['tag'] . ' ' . $tagId, \OCP\Util::DEBUG); if($tagId) { try { - \OCP\DB::insertIfNotExist(self::RELATION_TABLE, + $dbConnection->insertIfNotExist(self::RELATION_TABLE, array( 'objid' => $relation['objid'], 'categoryid' => $tagId, @@ -679,7 +680,7 @@ class Tags implements \OCP\ITags { $tagId = $tag; } try { - \OCP\DB::insertIfNotExist(self::RELATION_TABLE, + \OC::$server->getDatabaseConnection()->insertIfNotExist(self::RELATION_TABLE, array( 'objid' => $objid, 'categoryid' => $tagId, diff --git a/lib/public/DB.php b/lib/public/DB.php index f62f718029d..23ebdceccd0 100644 --- a/lib/public/DB.php +++ b/lib/public/DB.php @@ -62,23 +62,6 @@ class DB { } /** - * Insert a row if the matching row does not exists. - * - * @param string $table The table name (will replace *PREFIX* with the actual prefix) - * @param array $input data that should be inserted into the table (column name => value) - * @param array|null $compare List of values that should be checked for "if not exists" - * If this is null or an empty array, all keys of $input will be compared - * @return int number of inserted rows - * @throws \Doctrine\DBAL\DBALException - * @deprecated 8.1.0 use insertIfNotExist() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection() - * @since 5.0.0 - parameter $compare was added in 8.1.0 - * - */ - public static function insertIfNotExist($table, $input, array $compare = null) { - return \OC::$server->getDatabaseConnection()->insertIfNotExist($table, $input, $compare); - } - - /** * Start a transaction * @deprecated 8.1.0 use beginTransaction() of \OCP\IDBConnection - \OC::$server->getDatabaseConnection() * @since 4.5.0 |