Skip to content

Commit d775901

Browse files
committed
Improved checking on Magento version when executing this module on a development clone of the Magento 2 repo.
1 parent f7072a5 commit d775901

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Cron/ScheduleJob.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ private function getCronTimestamp(): int
5656
{
5757
$version = $this->productMetadata->getVersion();
5858

59+
// When running on a version of Magento in development by cloning the repo,
60+
// the version will be for example 'dev-2.4-develop',
61+
// stripping of 'dev-' from the start will still execute the correct version check here
62+
// '?:' exists to satisfy static tests because preg_replace could potentially return 'null'
63+
$version = preg_replace('/^dev\-/', '', $version) ?: $version;
64+
5965
if (version_compare($version, '2.2.0') >= 0) {
6066
return $this->dateTime->gmtTimestamp();
6167
}

0 commit comments

Comments
 (0)