From e0431d96a1384ad98a985db34baaab5120e0047f Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 23 Feb 2012 23:53:20 +0100 Subject: [PATCH] Package requirements are now properly checked --- .../PackageInstallationNodeBuilder.class.php | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php index 5e54ede90c..502e2eace7 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php @@ -414,7 +414,25 @@ class PackageInstallationNodeBuilder { $requiredPackages = $this->installation->getArchive()->getOpenRequirements(); foreach ($requiredPackages as $packageName => $package) { if (!isset($package['file'])) { - // ignore requirements which are not to be installed + // package is installed but version does not match + if ($package['packageID']) { + // get package version + $sql = "SELECT packageVersion + FROM wcf".WCF_N."_package + WHERE packageID = ?"; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute(array($package['packageID'])); + $row = $statement->fetchArray(); + + throw new SystemException("Package '".$this->installation->getArchive()->getPackageInfo('packageName')."' requires the package '".$packageName."' in version '".$package['minversion']."', but '".$row['packageVersion']."' is installed."); + } + + // package is required but not installed + if (!$package['packageID']) { + throw new SystemException("Package '".$this->installation->getArchive()->getPackageInfo('packageName')."' requires the package '".$packageName."', but it is neither installed nor shipped."); + } + + // ignore requirements which are not to be installed, but are already available continue; } -- 2.20.1