Skip to content

Commit 354e6b4

Browse files
author
Joan He
committed
Merge remote-tracking branch 'origin/MAGETWO-38065-remove-version' into develop
2 parents de3a973 + 8525439 commit 354e6b4

File tree

5 files changed

+45
-6
lines changed

5 files changed

+45
-6
lines changed

app/code/Magento/Theme/view/frontend/templates/html/bugreport.phtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@
1010
target="_blank">
1111
<?php echo __('Report All Bugs') ?>
1212
</a>
13-
<strong><?php echo __('(ver. %1)', \Magento\Framework\AppInterface::VERSION) ?></strong>
1413
</small>

app/code/Magento/Theme/view/frontend/templates/html/footer.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<?php echo $block->getChildHtml() ?>
1313
<p class="bugs"><?php echo __('Help Us Keep Magento Healthy') ?> - <a
1414
href="http://www.magentocommerce.com/bug-tracking"
15-
target="_blank"><strong><?php echo __('Report All Bugs') ?></strong></a> <?php echo __('(ver. %1)', \Magento\Framework\AppInterface::VERSION) ?>
15+
target="_blank"><strong><?php echo __('Report All Bugs') ?></strong></a>
1616
</p>
1717
<address><?php echo $block->getCopyright() ?></address>
1818
</div>

app/code/Magento/Version/Controller/Index/Index.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Framework\App\Action\Action;
1010
use Magento\Framework\App\Action\Context;
1111
use Magento\Framework\App\ProductMetadataInterface;
12+
use Magento\Framework\Exception\StateException;
1213

1314
/**
1415
* Magento Version controller
@@ -31,15 +32,21 @@ public function __construct(Context $context, ProductMetadataInterface $productM
3132
}
3233

3334
/**
34-
* Sets the response body with ProductName/Version (Edition). E.g.: Magento/0.42.0-beta3 (Community)
35+
* Sets the response body to ProductName/Major.MinorVersion (Edition). E.g.: Magento/0.42 (Community). Omits patch
36+
* version from response
3537
*
3638
* @return void
3739
*/
3840
public function execute()
3941
{
42+
$versionParts = explode('.', $this->productMetadata->getVersion());
43+
if (!isset($versionParts[0]) || !isset($versionParts[1])) {
44+
return ; // Major and minor version are not set - return empty response
45+
}
46+
$majorMinorVersion = $versionParts[0] . '.' . $versionParts[1];
4047
$this->getResponse()->setBody(
4148
$this->productMetadata->getName() . '/' .
42-
$this->productMetadata->getVersion() . ' (' .
49+
$majorMinorVersion . ' (' .
4350
$this->productMetadata->getEdition() . ')'
4451
);
4552
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/***
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Version\Controller\Index;
7+
8+
class IndexTest extends \Magento\TestFramework\TestCase\AbstractController
9+
{
10+
public function testIndexAction()
11+
{
12+
// Execute controller to get version response
13+
$this->dispatch('magento_version/index/index');
14+
$body = $this->getResponse()->getBody();
15+
16+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
17+
/** @var \Magento\Framework\App\ProductMetadataInterface $productMetadata */
18+
$productMetadata = $objectManager->get('Magento\Framework\App\ProductMetadataInterface');
19+
$name = $productMetadata->getName();
20+
$edition = $productMetadata->getEdition();
21+
22+
$fullVersion = $productMetadata->getVersion();
23+
$versionParts = explode('.', $fullVersion);
24+
$majorMinor = $versionParts[0] . '.' . $versionParts[1];
25+
26+
// Response must contain Major.Minor version, product name, and edition
27+
$this->assertContains($majorMinor, $body);
28+
$this->assertContains($name, $body);
29+
$this->assertContains($edition, $body);
30+
31+
// Response must not contain full version including patch version
32+
$this->assertNotContains($fullVersion, $body);
33+
}
34+
}

lib/internal/Magento/Framework/Filesystem/Driver/Http.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ public function fileOpen($path, $mode)
167167
'Host: ' .
168168
$hostname .
169169
"\r\n" .
170-
'User-Agent: Magento ver/' .
171-
\Magento\Framework\AppInterface::VERSION .
170+
'User-Agent: Magento' .
172171
"\r\n" .
173172
'Connection: close' .
174173
"\r\n" .

0 commit comments

Comments
 (0)