From c6c4f7bfcc8d109d1b93472f2c9f56612aef2afc Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 5 Dec 2012 00:02:53 +0100 Subject: [PATCH] Fixed SQL PIP (again!) --- .../PackageInstallationSQLParser.class.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php index 3c5cfb7901..7a3647471d 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationSQLParser.class.php @@ -258,10 +258,8 @@ class PackageInstallationSQLParser extends SQLParser { protected function executeCreateTableStatement($tableName, $columns, $indices = array()) { if ($this->test) { if (in_array($tableName, $this->existingTables)) { - if (isset($this->knownTables[$tableName])) { - if ($this->knownTables[$tableName] != $this->package->packageID) { - throw new SystemException("Can not recreate table '.$tableName.'. A package can only overwrite own tables."); - } + if (isset($this->knownTables[$tableName]) && $this->knownTables[$tableName] != $this->package->packageID) { + throw new SystemException("Can not recreate table '.$tableName.'. A package can only overwrite own tables."); } else { if (!isset($this->conflicts['CREATE TABLE'])) $this->conflicts['CREATE TABLE'] = array(); @@ -324,10 +322,8 @@ class PackageInstallationSQLParser extends SQLParser { */ protected function executeAddIndexStatement($tableName, $indexName, $indexData) { if ($this->test) { - if (isset($this->knownTables[$tableName])) { - if ($this->knownTables[$tableName] != $this->package->packageID) { - throw new SystemException("Can not add index '".$indexName."' to table '.$tableName.'."); - } + if (!isset($this->knownTables[$tableName])) { + throw new SystemException("Can not add index '".$indexName."' to table '.$tableName.'."); } } else { @@ -344,10 +340,8 @@ class PackageInstallationSQLParser extends SQLParser { */ protected function executeAddForeignKeyStatement($tableName, $indexName, $indexData) { if ($this->test) { - if (isset($this->knownTables[$tableName])) { - if ($this->knownTables[$tableName] != $this->package->packageID) { - throw new SystemException("Can not add foreign key '".$indexName."' to table '.$tableName.'."); - } + if (!isset($this->knownTables[$tableName])) { + throw new SystemException("Can not add foreign key '".$indexName."' to table '.$tableName.'."); } } else { -- 2.20.1