From: Matthias Schmidt Date: Wed, 12 Jun 2013 15:46:42 +0000 (+0200) Subject: Fixes issue with SystemException during package installation X-Git-Tag: 2.0.0_Beta_4~56^2~2^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5efa06c9fc06ad75ca4a334da01252d95f3681d1;p=GitHub%2FWoltLab%2FWCF.git Fixes issue with SystemException during package installation --- diff --git a/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php index 7499f45a78..1604cf46fb 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php @@ -52,11 +52,30 @@ class SQLPackageInstallationPlugin extends AbstractPackageInstallationPlugin { $parser = new PackageInstallationSQLParser($queries, $this->installation->getPackage(), $this->installation->getAction()); $conflicts = $parser->test(); if (!empty($conflicts) && (isset($conflicts['CREATE TABLE']) || isset($conflicts['DROP TABLE']))) { - WCF::getTPL()->assign(array( - 'conflicts' => $conflicts - )); + $unknownCreateTable = isset($conflicts['CREATE TABLE']) ? $conflicts['CREATE TABLE'] : array(); + $unknownDropTable = isset($conflicts['DROP TABLE']) ? $conflicts['DROP TABLE'] : array(); - throw new SystemException(WCF::getTPL()->fetch('packageInstallationDatabaseConflict')); + $errorMessage = "Can't"; + if (!empty($unknownDropTable)) { + $errorMessage .= " drop unknown table"; + if (count($unknownDropTable) > 1) { + $errorMessage .= "s"; + } + $errorMessage .= " '".implode("', '", $unknownDropTable)."'"; + } + if (!empty($unknownCreateTable)) { + if (!empty($unknownDropTable)) { + $errorMessage .= " and can't"; + } + + $errorMessage .= " overwrite unknown table"; + if (count($unknownCreateTable) > 1) { + $errorMessage .= "s"; + } + $errorMessage .= " '".implode("', '", $unknownCreateTable)."'"; + } + + throw new SystemException($errorMessage); } // execute queries