Skip to content

Commit

Permalink
Split distribution name; PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rhoerr committed Jan 14, 2025
1 parent 7cc14d0 commit 37713e6
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/Block/Page/Footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getMagentoVersion()
*/
public function getName()
{
return $this->productMetadata->getName();
return $this->productMetadata->getDistributionName();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Version/Controller/Index/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function execute()
$versionParts = explode('.', $version);
if (!$this->isGitBasedInstallation($version) && $this->isCorrectVersion($versionParts)) {
$rawResponse->setContents(
$this->productMetadata->getName() . '/' .
$this->productMetadata->getDistributionName() . '/' .
$this->getMajorMinorVersion($versionParts) .
' (' . $this->productMetadata->getEdition() . ')'
);
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ protected function getGeneralInfo()

return [
'version' => $majorMinorVersion,
'title' => $this->productMetadata->getName() . ' ' . $this->productMetadata->getEdition(),
'title' => $this->productMetadata->getDistributionName() . ' ' . $this->productMetadata->getEdition(),
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testIndexAction()
$name = $productMetadata->getName();
$edition = $productMetadata->getEdition();

$fullVersion = $productMetadata->getDistributionVersion();
$fullVersion = $productMetadata->getVersion();
if ($this->isComposerBasedInstallation($fullVersion)) {
$versionParts = explode('.', $fullVersion);
$majorMinor = $versionParts[0] . '.' . $versionParts[1];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* (c) Mage-OS
*
* For the full copyright and license information, please view the LICENSE
* files distributed with this source code.
*/
namespace Magento\Framework\App;

/**
* Magento application product metadata
* Mage-OS Distribution metadata
*
* @api
* @since 100.0.2
* @since 1.0.6
*/
interface DistributionMetadataInterface
{
Expand All @@ -21,9 +23,9 @@ interface DistributionMetadataInterface
public function getDistributionVersion();

/**
* Get Product name
* Get Distribution name
*
* @return string
*/
public function getProductName();
public function getDistributionName();
}
16 changes: 8 additions & 8 deletions lib/internal/Magento/Framework/App/ProductMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ class ProductMetadata implements ProductMetadataInterface, DistributionMetadataI
/**
* Magento product name
*/
const PRODUCT_NAME = 'Magento';
public const PRODUCT_NAME = 'Magento';

/**
* Distribution product name
*/
const DISTRIBUTION_NAME = 'Mage-OS';
public const DISTRIBUTION_NAME = 'Mage-OS';

/**
* Magento version cache key
Expand All @@ -40,7 +40,7 @@ class ProductMetadata implements ProductMetadataInterface, DistributionMetadataI
/**
* Distribution version cache key
*/
const DISTRO_VERSION_CACHE_KEY = 'distro-version';
protected const DISTRO_VERSION_CACHE_KEY = 'distro-version';

/**
* Product version
Expand Down Expand Up @@ -138,23 +138,23 @@ public function getEdition()
}

/**
* Get Distribution name
* Get Product name
*
* @return string
*/
public function getName()
{
return self::DISTRIBUTION_NAME;
return self::PRODUCT_NAME;
}

/**
* Get Product name
* Get Distribution name
*
* @return string
*/
public function getProductName()
public function getDistributionName()
{
return self::PRODUCT_NAME;
return self::DISTRIBUTION_NAME;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/Console/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
$directoryList = new DirectoryList(BP);
$composerJsonFinder = new ComposerJsonFinder($directoryList);
$this->productMetadata = new ProductMetadata($composerJsonFinder);
$name = $this->productMetadata->getName() . ' CLI';
$name = $this->productMetadata->getDistributionName() . ' CLI';
$version = $this->productMetadata->getDistributionVersion();
}

Expand Down

0 comments on commit 37713e6

Please sign in to comment.