From 5efa06c9fc06ad75ca4a334da01252d95f3681d1 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 12 Jun 2013 17:46:42 +0200 Subject: [PATCH] Fixes issue with SystemException during package installation --- .../SQLPackageInstallationPlugin.class.php | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) 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 -- 2.20.1