diff --git a/app/code/Magento/Theme/view/frontend/templates/html/bugreport.phtml b/app/code/Magento/Theme/view/frontend/templates/html/bugreport.phtml index f81d5ae8386c690c113ed59a1ed5fef74a7ed333..1b984b454f0a535088d61127e9cf02cfc8f74add 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/bugreport.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/bugreport.phtml @@ -10,5 +10,4 @@ target="_blank"> <?php echo __('Report All Bugs') ?> </a> - <strong><?php echo __('(ver. %1)', \Magento\Framework\AppInterface::VERSION) ?></strong> </small> diff --git a/app/code/Magento/Theme/view/frontend/templates/html/footer.phtml b/app/code/Magento/Theme/view/frontend/templates/html/footer.phtml index d5e3ef7851329e5893cbf7ad15fe45fdf7cf8efb..f158afa5e9c95d49f2cd9c044a8af6f4bca4a7fa 100644 --- a/app/code/Magento/Theme/view/frontend/templates/html/footer.phtml +++ b/app/code/Magento/Theme/view/frontend/templates/html/footer.phtml @@ -12,7 +12,7 @@ <?php echo $block->getChildHtml() ?> <p class="bugs"><?php echo __('Help Us Keep Magento Healthy') ?> - <a href="http://www.magentocommerce.com/bug-tracking" - target="_blank"><strong><?php echo __('Report All Bugs') ?></strong></a> <?php echo __('(ver. %1)', \Magento\Framework\AppInterface::VERSION) ?> + target="_blank"><strong><?php echo __('Report All Bugs') ?></strong></a> </p> <address><?php echo $block->getCopyright() ?></address> </div> diff --git a/app/code/Magento/Version/Controller/Index/Index.php b/app/code/Magento/Version/Controller/Index/Index.php index 687e3d3d5163512fb83214e04961b43d359ba1ba..0fe6235bc6ca091e830b184ffa73b3be57875e58 100644 --- a/app/code/Magento/Version/Controller/Index/Index.php +++ b/app/code/Magento/Version/Controller/Index/Index.php @@ -9,6 +9,7 @@ namespace Magento\Version\Controller\Index; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\Framework\App\ProductMetadataInterface; +use Magento\Framework\Exception\StateException; /** * Magento Version controller @@ -31,15 +32,21 @@ class Index extends Action } /** - * Sets the response body with ProductName/Version (Edition). E.g.: Magento/0.42.0-beta3 (Community) + * Sets the response body to ProductName/Major.MinorVersion (Edition). E.g.: Magento/0.42 (Community). Omits patch + * version from response * * @return void */ public function execute() { + $versionParts = explode('.', $this->productMetadata->getVersion()); + if (!isset($versionParts[0]) || !isset($versionParts[1])) { + return ; // Major and minor version are not set - return empty response + } + $majorMinorVersion = $versionParts[0] . '.' . $versionParts[1]; $this->getResponse()->setBody( $this->productMetadata->getName() . '/' . - $this->productMetadata->getVersion() . ' (' . + $majorMinorVersion . ' (' . $this->productMetadata->getEdition() . ')' ); } diff --git a/dev/tests/integration/testsuite/Magento/Version/Controller/Index/IndexTest.php b/dev/tests/integration/testsuite/Magento/Version/Controller/Index/IndexTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3fcd52372495618c34abe710326e17066c4d704f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Version/Controller/Index/IndexTest.php @@ -0,0 +1,34 @@ +<?php +/*** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Version\Controller\Index; + +class IndexTest extends \Magento\TestFramework\TestCase\AbstractController +{ + public function testIndexAction() + { + // Execute controller to get version response + $this->dispatch('magento_version/index/index'); + $body = $this->getResponse()->getBody(); + + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\Framework\App\ProductMetadataInterface $productMetadata */ + $productMetadata = $objectManager->get('Magento\Framework\App\ProductMetadataInterface'); + $name = $productMetadata->getName(); + $edition = $productMetadata->getEdition(); + + $fullVersion = $productMetadata->getVersion(); + $versionParts = explode('.', $fullVersion); + $majorMinor = $versionParts[0] . '.' . $versionParts[1]; + + // Response must contain Major.Minor version, product name, and edition + $this->assertContains($majorMinor, $body); + $this->assertContains($name, $body); + $this->assertContains($edition, $body); + + // Response must not contain full version including patch version + $this->assertNotContains($fullVersion, $body); + } +} diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/Http.php b/lib/internal/Magento/Framework/Filesystem/Driver/Http.php index 2e60f74c6f15f0ae865fbcd809ae82c336f0cf2b..c1fcedc96e66fdaff57c8530b38263f14b83776d 100644 --- a/lib/internal/Magento/Framework/Filesystem/Driver/Http.php +++ b/lib/internal/Magento/Framework/Filesystem/Driver/Http.php @@ -167,8 +167,7 @@ class Http extends File 'Host: ' . $hostname . "\r\n" . - 'User-Agent: Magento ver/' . - \Magento\Framework\AppInterface::VERSION . + 'User-Agent: Magento' . "\r\n" . 'Connection: close' . "\r\n" .