From 0eaa9bbacdf382eabebed3e357fd4656109c77a4 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 14 Jul 2012 20:51:24 +0200 Subject: [PATCH] Updates handling of required packages --- .../acp/templates/packageInstallationConfirm.tpl | 8 +++++--- .../lib/system/package/PackageArchive.class.php | 14 +++++++++++--- .../PackageInstallationDispatcher.class.php | 16 +++++++++++++--- wcfsetup/install/lang/de.xml | 7 ++++++- wcfsetup/install/lang/en.xml | 7 ++++++- 5 files changed, 41 insertions(+), 11 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/packageInstallationConfirm.tpl b/wcfsetup/install/files/acp/templates/packageInstallationConfirm.tpl index 591f945cd9..dfaeea0302 100644 --- a/wcfsetup/install/files/acp/templates/packageInstallationConfirm.tpl +++ b/wcfsetup/install/files/acp/templates/packageInstallationConfirm.tpl @@ -112,15 +112,17 @@ {lang}wcf.acp.package.name{/lang} - {lang}wcf.acp.package.version{/lang} + {lang}wcf.acp.package.installation.packageStatus{/lang} + {lang}wcf.acp.package.installation.requiredVersion{/lang} {foreach from=$requiredPackages item=$package} -

{lang}wcf.acp.package.installation.packageName{/lang}

-

{if $package.minversion|isset}{$package.minversion}{/if}

+

{@$package.name}

+

{lang}wcf.acp.package.installation.packageStatus.{@$package.status}{/lang}

+

{if $package.minversion|isset}{if $package.status == 'missingVersion'}{/if}{$package.minversion}{if $package.status == 'missingVersion'}{/if}{/if}

{/foreach} diff --git a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php index ee93a50e7b..1d6243cbd5 100644 --- a/wcfsetup/install/files/lib/system/package/PackageArchive.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageArchive.class.php @@ -730,9 +730,17 @@ class PackageArchive { if (isset($existingPackages[$requirement['name']])) { // package does already exist // maybe an update is necessary - if (!isset($requirement['minversion']) || Package::compareVersion($existingPackages[$requirement['name']]['packageVersion'], $requirement['minversion']) >= 0) { - // package does already exist in needed version - // skip installation of requirement + if (isset($requirement['minversion'])) { + if (Package::compareVersion($existingPackages[$requirement['name']]['packageVersion'], $requirement['minversion']) >= 0) { + // package does already exist in needed version + // skip installation of requirement + continue; + } + else { + $requirement['existingVersion'] = $existingPackages[$requirement['name']]['packageVersion']; + } + } + else { continue; } diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index deba10762a..f81ab4359e 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -716,12 +716,22 @@ class PackageInstallationDispatcher { $missingPackages = 0; foreach ($requirements as $key => $requirement) { if (isset($openRequirements[$requirement['name']])) { - $requirements[$key]['open'] = 1; + $requirements[$key]['status'] = 'missing'; $requirements[$key]['action'] = $openRequirements[$requirement['name']]['action']; - if (!isset($requirements[$key]['file'])) $missingPackages++; + + if (!isset($requirements[$key]['file'])) { + if ($openRequirements[$requirement['name']]['action'] === 'update') { + $requirements[$key]['status'] = 'missingVersion'; + $requirements[$key]['existingVersion'] = $openRequirements[$requirement['name']]['existingVersion']; + } + $missingPackages++; + } + else { + $requirements[$key]['status'] = 'delivered'; + } } else { - $requirements[$key]['open'] = 0; + $requirements[$key]['status'] = 'installed'; } } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 7ee1e8255a..4c5266d97a 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -305,11 +305,16 @@ + + + + + - {$package.name}]]> + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index e1a7155267..ff184f20fe 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -305,11 +305,16 @@ + + + + + - {$package.name}]]> + -- 2.20.1