Skip to content

Commit

Permalink
Resolved deprecations in ibexa/system-info package (#55)
Browse files Browse the repository at this point in the history
* IBX-8531: Removed deprecated IbexaSystemInfoCollector::CONTENT_PACKAGES const
* IBX-8531: Removed deprecated IbexaSystemInfoCollector::ENTERPRISE_PACKAGES const
* IBX-8531: Removed deprecated \Ibexa\Bundle\SystemInfo\SystemInfo\Value\IbexaSystemInfo::PRODUCT_NAME_COMMERCE const
* IBX-8531: Removed deprecated \Ibexa\Bundle\SystemInfo\SystemInfo\Value\IbexaSystemInfo properties
  • Loading branch information
adamwojs authored Jul 11, 2024
1 parent d586260 commit c84b64f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 61 deletions.
1 change: 0 additions & 1 deletion src/bundle/Resources/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ services:
arguments:
$composerCollector: '@Ibexa\Bundle\SystemInfo\SystemInfo\Collector\JsonComposerLockSystemInfoCollector'
$kernelProjectDir: '%kernel.project_dir%'
$debug: '%kernel.debug%'
tags:
- { name: ibexa.system_info.collector, identifier: ibexa }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
{
label: 'ibexa.stability'|trans|desc('Stability'),
content: info.stability,
content: info.lowestStability,
},
] %}

Expand Down
36 changes: 2 additions & 34 deletions src/bundle/SystemInfo/Collector/IbexaSystemInfoCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,6 @@ class IbexaSystemInfoCollector implements SystemInfoCollector
*/
public const PACKAGE_WATCH_REGEX = '/^(doctrine|ezsystems|silversolutions|symfony)\//';

/**
* Packages that identify installation as "Content".
*
* @deprecated Since 4.6. Use self::HEADLESS_PACKAGES const instead.
*/
public const CONTENT_PACKAGES = [
'ibexa/content',
];

/**
* Packages that identify installation as "Headless".
*/
Expand All @@ -114,18 +105,6 @@ class IbexaSystemInfoCollector implements SystemInfoCollector
'ibexa/experience',
];

/**
* Packages that identify installation as "Enterprise".
*
* @deprecated since Ibexa DXP 3.3. Rely either on <code>IbexaSystemInfoCollector::EXPERIENCE_PACKAGES</code>
* or <code>IbexaSystemInfoCollector::CONTENT_PACKAGES</code>.
*/
public const ENTERPRISE_PACKAGES = [
'ibexa/page-builder',
'ezsystems/flex-workflow',
'ezsystems/landing-page-fieldtype-bundle',
];

/**
* Packages that identify installation as "Commerce".
*/
Expand All @@ -138,29 +117,22 @@ class IbexaSystemInfoCollector implements SystemInfoCollector
*/
private $composerInfo;

/**
* @var bool
*/
private $debug;

/** @var string */
private $kernelProjectDir;

/**
* @param \Ibexa\Bundle\SystemInfo\SystemInfo\Collector\JsonComposerLockSystemInfoCollector|\Ibexa\Bundle\SystemInfo\SystemInfo\Collector\SystemInfoCollector $composerCollector
* @param bool $debug
*/
public function __construct(
SystemInfoCollector $composerCollector,
string $kernelProjectDir,
bool $debug = false
) {
try {
$this->composerInfo = $composerCollector->collect();
} catch (ComposerLockFileNotFoundException | ComposerFileValidationException $e) {
// do nothing
}
$this->debug = $debug;

$this->kernelProjectDir = $kernelProjectDir;
}

Expand All @@ -176,7 +148,6 @@ public function collect(): IbexaSystemInfo
$vendorDir = sprintf('%s/vendor/', $this->kernelProjectDir);

$ibexa = new IbexaSystemInfo([
'debug' => $this->debug,
'name' => IbexaSystemInfoExtension::getNameByPackages($vendorDir),
]);

Expand Down Expand Up @@ -214,16 +185,13 @@ private function extractComposerInfo(IbexaSystemInfo $ibexa): void
return;
}

// BC (deprecated property)
$ibexa->composerInfo = ['minimumStability' => $this->composerInfo->minimumStability];

$dxpPackages = array_merge(
self::HEADLESS_PACKAGES,
self::EXPERIENCE_PACKAGES,
self::COMMERCE_PACKAGES
);
$ibexa->isEnterprise = self::hasAnyPackage($this->composerInfo, $dxpPackages);
$ibexa->stability = $ibexa->lowestStability = self::getStability($this->composerInfo);
$ibexa->lowestStability = self::getStability($this->composerInfo);
}

/**
Expand Down
26 changes: 1 addition & 25 deletions src/bundle/SystemInfo/Value/IbexaSystemInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ class IbexaSystemInfo extends ValueObject implements SystemInfo
'oss' => self::PRODUCT_NAME_OSS,
'headless' => 'Ibexa Headless',
'experience' => 'Ibexa Experience',
'commerce' => self::PRODUCT_NAME_COMMERCE,
'commerce' => 'Ibexa Commerce',
];

// @deprecated: use PRODUCT_NAME_VARIANTS
public const PRODUCT_NAME_COMMERCE = 'Ibexa Commerce';

/**
* @var string
*/
Expand Down Expand Up @@ -87,25 +84,4 @@ class IbexaSystemInfo extends ValueObject implements SystemInfo
* @var string One of {@see \Ibexa\SystemInfo\Value\Stability::STABILITIES}.
*/
public $lowestStability;

/**
* @deprecated Instead use $lowestStability.
*
* @var string One of {@see \Ibexa\SystemInfo\Value\Stability::STABILITIES}.
*/
public $stability;

/**
* @deprecated Duplicates collected info on symfony
*
* @var bool
*/
public $debug;

/**
* @deprecated This was duplication of collected info from Composer, now only contains key 'minimumStability'
*
* @var array|null
*/
public $composerInfo;
}

0 comments on commit c84b64f

Please sign in to comment.