From 07c78f25d86870906fc5a899552530771d860cfd Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 7 Dec 2012 03:30:18 +0100 Subject: [PATCH] Removed instanceName for packages and some fixes --- wcfsetup/install/files/acp/templates/package.tpl | 8 ++++---- .../files/acp/templates/packageListDetailed.tpl | 4 ++-- .../acp/page/PackageUpdateSearchResultPage.class.php | 5 +++-- .../install/files/lib/data/package/Package.class.php | 11 +++++++++-- .../files/lib/system/package/PackageArchive.class.php | 4 ++-- .../system/package/PackageUpdateDispatcher.class.php | 3 +-- wcfsetup/setup/db/install.sql | 1 - 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/package.tpl b/wcfsetup/install/files/acp/templates/package.tpl index 78db50eb4c..8a9d2b24e8 100644 --- a/wcfsetup/install/files/acp/templates/package.tpl +++ b/wcfsetup/install/files/acp/templates/package.tpl @@ -135,7 +135,7 @@ {/if} {if $requiredPackage->canUninstall()} - + {else} {/if} @@ -150,7 +150,7 @@ {/if} -

{$requiredPackage->packageName|language}{if $requiredPackage->instanceNo > 1 && $requiredPackage->instanceName == ''} (#{#$requiredPackage->instanceNo}){/if}

+

{$requiredPackage}

{if $requiredPackage->authorURL}

{$requiredPackage->author}{else}{$requiredPackage->author}

{/if}

{$requiredPackage->packageVersion}

{@$requiredPackage->packageDate|date}

@@ -195,7 +195,7 @@ {/if} {if $dependentPackage->canUninstall()} - + {else} {/if} @@ -210,7 +210,7 @@ {/if} -

{$dependentPackage->packageName|language}{if $dependentPackage->instanceNo > 1 && $dependentPackage->instanceName == ''} (#{#$dependentPackage->instanceNo}){/if}

+

{$dependentPackage}

{if $dependentPackage->authorURL}

{$dependentPackage->author}{else}{$dependentPackage->author}

{/if}

{$dependentPackage->packageVersion}

{@$dependentPackage->packageDate|date}

diff --git a/wcfsetup/install/files/acp/templates/packageListDetailed.tpl b/wcfsetup/install/files/acp/templates/packageListDetailed.tpl index bbdee27f26..e88f75e461 100644 --- a/wcfsetup/install/files/acp/templates/packageListDetailed.tpl +++ b/wcfsetup/install/files/acp/templates/packageListDetailed.tpl @@ -63,7 +63,7 @@ {/if} {if $package->canUninstall()} - + {else} {/if} @@ -81,7 +81,7 @@ {/if} - {$package->getName()}{if $package->instanceNo > 1 && $package->instanceName == ''} (#{#$package->instanceNo}){/if} + {$package}

{if $package->authorURL}{$package->author}{else}{$package->author}{/if}

{$package->packageVersion}

diff --git a/wcfsetup/install/files/lib/acp/page/PackageUpdateSearchResultPage.class.php b/wcfsetup/install/files/lib/acp/page/PackageUpdateSearchResultPage.class.php index b5d3b9bab0..43da38d876 100755 --- a/wcfsetup/install/files/lib/acp/page/PackageUpdateSearchResultPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackageUpdateSearchResultPage.class.php @@ -150,15 +150,16 @@ class PackageUpdateSearchResultPage extends SortablePage { $row['packageVersion'] = end($row['packageVersions']); } + // TODO: Multiple instances are no longer supported, remove this // get installed instances - $sql = "SELECT package.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName + $sql = "SELECT package.* FROM wcf".WCF_N."_package package WHERE package.package = ?"; $statement2 = WCF::getDB()->prepareStatement($sql); $statement2->execute(array($row['package'])); while ($row2 = $statement2->fetchArray()) { $row['instances']++; - + // is already installed unique? if ($row2['isUnique'] == 1) $row['isUnique'] = 1; diff --git a/wcfsetup/install/files/lib/data/package/Package.class.php b/wcfsetup/install/files/lib/data/package/Package.class.php index baa60762ae..181ffb842c 100644 --- a/wcfsetup/install/files/lib/data/package/Package.class.php +++ b/wcfsetup/install/files/lib/data/package/Package.class.php @@ -85,7 +85,14 @@ class Package extends DatabaseObject { * @return string */ public function getName() { - return WCF::getLanguage()->get($this->instanceName ?: $this->packageName); + return WCF::getLanguage()->get($this->packageName); + } + + /** + * @see wcf\data\package\Package::getName() + */ + public function __toString() { + return $this->getName(); } /** @@ -123,7 +130,7 @@ class Package extends DatabaseObject { if ($this->requiredPackages === null) { $this->requiredPackages = array(); - $sql = "SELECT package.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName + $sql = "SELECT package.* FROM wcf".WCF_N."_package_requirement package_requirement LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = package_requirement.requirement) WHERE package_requirement.packageID = ? diff --git a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php index bd445a676a..ffc83bad40 100644 --- a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php @@ -531,7 +531,7 @@ class PackageArchive { $existingRequirements = array(); $existingPackages = array(); if ($this->package !== null) { - $sql = "SELECT package.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName + $sql = "SELECT package.* FROM wcf".WCF_N."_package_requirement requirement LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = requirement.requirement) @@ -561,7 +561,7 @@ class PackageArchive { $conditions = new PreparedStatementConditionBuilder(); $conditions->add("package.package IN (?)", array($packageNames)); - $sql = "SELECT package.*, CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName + $sql = "SELECT package.* FROM wcf".WCF_N."_package package ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); diff --git a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php index 26a88cccbc..5e1d7b0bf1 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php @@ -470,8 +470,7 @@ abstract class PackageUpdateDispatcher { // get existing packages and their versions $existingPackages = array(); $sql = "SELECT packageID, package, instanceNo, packageDescription, - packageVersion, packageDate, author, authorURL, isApplication, - CASE WHEN instanceName <> '' THEN instanceName ELSE packageName END AS packageName + packageVersion, packageDate, author, authorURL, isApplication FROM wcf".WCF_N."_package"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index 47eeab57cb..0180f99198 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -307,7 +307,6 @@ CREATE TABLE wcf1_package ( package VARCHAR(255) NOT NULL DEFAULT '', packageDir VARCHAR(255) NOT NULL DEFAULT '', packageName VARCHAR(255) NOT NULL DEFAULT '', - instanceName VARCHAR(255) NOT NULL DEFAULT '', instanceNo INT(10) NOT NULL DEFAULT 1, packageDescription VARCHAR(255) NOT NULL DEFAULT '', packageVersion VARCHAR(255) NOT NULL DEFAULT '', -- 2.20.1