Package requirements are now properly checked
authorAlexander Ebert <ebert@woltlab.com>
Thu, 23 Feb 2012 22:53:20 +0000 (23:53 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 23 Feb 2012 22:53:20 +0000 (23:53 +0100)
wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php

index 5e54ede90c11d7f27fd848df14faf18354993429..502e2eace7ebf1687af4631a05c70236b469c377 100644 (file)
@@ -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;
                        }