Skip to content

Commit 4c6e720

Browse files
Merge branch 'MAGETWO-45952' of https://github.com/magento-falcons/magento2ce into MAGETWO-56252
2 parents ac0f862 + cac1c5d commit 4c6e720

File tree

4 files changed

+37
-23
lines changed

4 files changed

+37
-23
lines changed

setup/pub/magento/setup/select-version.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ angular.module('select-version', ['ngStorage'])
3737
$scope.versions = [];
3838
$scope.data = data;
3939
angular.forEach(data.packages, function (value, key) {
40-
if (value.stable) {
40+
if (value.stable && !value.current) {
4141
$scope.versions.push({
4242
'versionInfo': angular.toJson({
4343
'package': value.package,
4444
'version': value.id
4545
}),
4646
'version': value
4747
});
48+
} else if (value.stable && value.current) {
49+
$scope.currentVersion = value.name;
4850
}
4951
});
5052
$scope.selectedOption = $scope.versions[0].versionInfo;
@@ -158,7 +160,7 @@ angular.module('select-version', ['ngStorage'])
158160
$scope.selectedOption = [];
159161
$scope.versions = [];
160162
angular.forEach($scope.data.packages, function (value, key) {
161-
if (value.stable || $scope.showUnstable) {
163+
if ((value.stable || $scope.showUnstable) && !value.current) {
162164
$scope.versions.push({
163165
'versionInfo': angular.toJson({
164166
'package': value.package,

setup/src/Magento/Setup/Model/SystemPackage.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ public function getPackageVersions()
7474
$versions[0]['name'] .= ' (latest)';
7575
}
7676

77-
if (count($versions) >= 1) {
78-
$versions[count($versions) - 1]['name'] .= ' (current)';
79-
}
80-
8177
$result[] = [
8278
'package' => $systemPackageInfo['name'],
8379
'versions' => $versions
@@ -134,13 +130,14 @@ public function getSystemPackageVersions($systemPackageInfo, $versions)
134130
$editionType .= 'EE';
135131
}
136132
foreach ($systemPackageInfo[InfoCommand::NEW_VERSIONS] as $version) {
137-
$versions[] = ['id' => $version, 'name' => 'Version ' . $version . ' ' . $editionType];
133+
$versions[] = ['id' => $version, 'name' => 'Version ' . $version . ' ' . $editionType, 'current' => false];
138134
}
139135

140136
if ($systemPackageInfo[InfoCommand::CURRENT_VERSION]) {
141137
$versions[] = [
142138
'id' => $systemPackageInfo[InfoCommand::CURRENT_VERSION],
143-
'name' => 'Version ' . $systemPackageInfo[InfoCommand::CURRENT_VERSION] . ' ' . $editionType
139+
'name' => 'Version ' . $systemPackageInfo[InfoCommand::CURRENT_VERSION] . ' ' . $editionType,
140+
'current' => true
144141
];
145142
}
146143
return $versions;
@@ -210,7 +207,7 @@ private function formatPackages($packages)
210207
foreach ($package['versions'] as $version) {
211208
$version['package'] = $package['package'];
212209

213-
if (preg_match('/^[0-9].[0-9].[0-9]$/', $version['id']) || strpos($version['name'], 'current')) {
210+
if (preg_match('/^[0-9].[0-9].[0-9]$/', $version['id']) || $version['current']) {
214211
$version['stable'] = true;
215212
} else {
216213
$version['name'] = $version['name'] . ' (unstable version)';
@@ -257,7 +254,7 @@ public function filterEeVersions($currentCE, $enterpriseVersions, $maxVersion)
257254
if ($maxVersion == $version) {
258255
$name .= ' (latest)';
259256
}
260-
$eeVersions[] = ['id' => $version, 'name' => $name];
257+
$eeVersions[] = ['id' => $version, 'name' => $name, 'current' => false];
261258
}
262259
}
263260
}

setup/src/Magento/Setup/Test/Unit/Model/SystemPackageTest.php

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,49 +53,57 @@ class SystemPackageTest extends \PHPUnit_Framework_TestCase
5353
'id' => '1.2.0',
5454
'name' => 'Version 1.2.0 EE (latest)',
5555
'package' => 'magento/product-enterprise-edition',
56-
'stable' => true
56+
'stable' => true,
57+
'current' => false,
5758
],
5859
[
5960
'id' => '1.2.0',
6061
'name' => 'Version 1.2.0 CE (latest)',
6162
'package' => 'magento/product-community-edition',
62-
'stable' => true
63+
'stable' => true,
64+
'current' => false,
6365
],
6466
[
6567
'id' => '1.1.0',
6668
'name' => 'Version 1.1.0 EE',
6769
'package' => 'magento/product-enterprise-edition',
68-
'stable' => true
70+
'stable' => true,
71+
'current' => false,
6972
],
7073
[
7174
'id' => '1.1.0',
7275
'name' => 'Version 1.1.0 CE',
7376
'package' => 'magento/product-community-edition',
74-
'stable' => true
77+
'stable' => true,
78+
'current' => false,
7579
],
7680
[
7781
'id' => '1.1.0-RC1',
7882
'name' => 'Version 1.1.0-RC1 EE (unstable version)',
7983
'package' => 'magento/product-enterprise-edition',
80-
'stable' => false
84+
'stable' => false,
85+
'current' => false,
8186
],
8287
[
8388
'id' => '1.1.0-RC1',
8489
'name' => 'Version 1.1.0-RC1 CE (unstable version)',
8590
'package' => 'magento/product-community-edition',
86-
'stable' => false
91+
'stable' => false,
92+
'current' => false,
8793
],
8894
[
8995
'id' => '1.0.0',
90-
'name' => 'Version 1.0.0 EE (current)',
96+
'name' => 'Version 1.0.0 EE',
9197
'package' => 'magento/product-enterprise-edition',
92-
'stable' => true
98+
'stable' => true,
99+
'current' => true,
93100
],
94101
[
95102
'id' => '1.0.0',
96-
'name' => 'Version 1.0.0 CE (current)',
103+
'name' => 'Version 1.0.0 CE',
97104
'package' => 'magento/product-community-edition',
98-
'stable' => true
105+
'stable' => true,
106+
'current' => true,
99107
],
100108
];
101109

@@ -325,16 +333,19 @@ public function getAllowedEnterpriseVersionsDataProvider()
325333
'versions' => [
326334
[
327335
'id' => '1.0.2',
328-
'name' => 'Version 1.0.2 EE (latest)'
336+
'name' => 'Version 1.0.2 EE (latest)',
337+
'current' => false,
329338
],
330339
[
331340
'id' => '1.0.1',
332-
'name' => 'Version 1.0.1 EE'
341+
'name' => 'Version 1.0.1 EE',
342+
'current' => false,
333343
],
334344
[
335345

336346
'id' => '1.0.0',
337-
'name' => 'Version 1.0.0 EE'
347+
'name' => 'Version 1.0.0 EE',
348+
'current' => false,
338349
]
339350
]
340351
]

setup/view/magento/setup/select-version.phtml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
<div class="message message-error" ng-show="upgradeProcessError">
4242
<span class="message-text" ng-bind-html="upgradeProcessErrorMessage"></span>
4343
</div>
44+
<div class="message" ng-show="upgradeProcessed && !upgradeProcessError && currentVersion">
45+
Your Magento version is {{currentVersion}}.
46+
<span ng-show="versions">You are about to upgrade to a newer version.</span>
47+
</div>
4448
<div class="row" ng-show="upgradeProcessed && !upgradeProcessError">
4549
<div class="col-m-3">
4650
<label class="form-label">

0 commit comments

Comments
 (0)