From 6cbea15c8a17d2bdc58eeb191d02660b31adac5e Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 31 Dec 2012 23:12:02 +0100 Subject: [PATCH] Fixes Package::isRequired() --- .../files/lib/data/package/Package.class.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/data/package/Package.class.php b/wcfsetup/install/files/lib/data/package/Package.class.php index 055ff7908a..ec7c23e39f 100644 --- a/wcfsetup/install/files/lib/data/package/Package.class.php +++ b/wcfsetup/install/files/lib/data/package/Package.class.php @@ -1,8 +1,6 @@ */ + protected static $requiredPackageIDs = null; + + /** + * package requirements + * @var array + */ protected static $requirements = null; /** @@ -63,7 +67,7 @@ class Package extends DatabaseObject { public function isRequired() { self::loadRequirements(); - return isset(self::$requirements[$this->packageID]); + return in_array($this->packageID, self::$requiredPackageIDs); } /** @@ -122,7 +126,7 @@ class Package extends DatabaseObject { /** * Returns a list of the requirements of this package. - * Contains the content of the tag in the package.xml of this package. + * Contains the content of the tag in the package.xml of this package. * * @return array */ @@ -196,6 +200,7 @@ class Package extends DatabaseObject { $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); + self::$requiredPackageIDs = array(); self::$requirements = array(); while ($row = $statement->fetchArray()) { if (!isset(self::$requirements[$row['packageID']])) { @@ -203,6 +208,10 @@ class Package extends DatabaseObject { } self::$requirements[$row['packageID']][] = $row['requirement']; + + if (!in_array($row['requirement'], self::$requiredPackageIDs)) { + self::$requiredPackageIDs[] = $row['requirement']; + } } } } -- 2.20.1