From a56abd3f9bdb1107bddb6cd8982a2be8727a938e Mon Sep 17 00:00:00 2001
From: Thomas Tanghus <thomas@tanghus.net>
Date: Fri, 29 Mar 2013 14:54:08 +0100
Subject: [PATCH] Typehint and check $ids parameter.

---
 lib/vcategories.php | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/vcategories.php b/lib/vcategories.php
index a52c15f067..372706b185 100644
--- a/lib/vcategories.php
+++ b/lib/vcategories.php
@@ -541,9 +541,13 @@ class OC_VCategories {
 	* 	Defaults to the type set in the instance
 	* @returns boolean Returns false on error.
 	*/
-	public function purgeObjects($ids, $type = null) {
+	public function purgeObjects(array $ids, $type = null) {
 		$type = is_null($type) ? $this->type : $type;
-		$updates = array();
+		if(count($ids) === 0) {
+			// job done ;)
+			return true;
+		}
+		$updates = $ids();
 		try {
 			$query = 'DELETE FROM `' . self::RELATION_TABLE . '` ';
 			$query .= 'WHERE `objid` IN (' . str_repeat('?,', count($ids)-1) . '?) ';
@@ -557,7 +561,7 @@ class OC_VCategories {
 				return false;
 			}
 		} catch(Exception $e) {
-			OCP\Util::writeLog('core', __METHOD__.', exception: '.$e->getMessage(),
+			OCP\Util::writeLog('core', __METHOD__.', exception: ' . $e->getMessage(),
 				OCP\Util::ERROR);
 			return false;
 		}
-- 
GitLab