From 0c4fbc5f5fdb29652c048d5893d242bbaa5be7cc Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 15 Oct 2012 14:45:18 +0200 Subject: [PATCH] Fixed dependency rebuilding Fixes #603 --- .../files/lib/data/package/Package.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wcfsetup/install/files/lib/data/package/Package.class.php b/wcfsetup/install/files/lib/data/package/Package.class.php index 9eceb10765..19f8cba493 100644 --- a/wcfsetup/install/files/lib/data/package/Package.class.php +++ b/wcfsetup/install/files/lib/data/package/Package.class.php @@ -436,8 +436,16 @@ class Package extends DatabaseObject { (packageID, dependency, priority) VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); + + $insertedDependencies = array(); foreach ($requirements as $dependency => $priority) { $statement->execute(array($packageID, $dependency, $priority)); + + if (!isset($insertedDependencies[$packageID])) { + $insertedDependencies[$packageID] = array(); + } + + $insertedDependencies[$packageID][] = $dependency; } // select plugins @@ -467,6 +475,11 @@ class Package extends DatabaseObject { VALUES (?, ?, ?)"; $statement = WCF::getDB()->prepareStatement($sql); foreach ($plugins as $dependency => $priority) { + // ignore already inserted dependencies + if (isset($insertedDependencies[$packageID]) && in_array($dependency, $insertedDependencies[$packageID])) { + continue; + } + $statement->execute(array($packageID, $dependency, $priority)); } -- 2.20.1