diff --git a/pages/setup/index.php b/pages/setup/index.php index 65203e5744..3ee3ba81ed 100644 --- a/pages/setup/index.php +++ b/pages/setup/index.php @@ -291,7 +291,6 @@ if (0 == count($errors)) { LanguageHandler::generateCache(); - Core::setConfig('version', Core::getVersion()); } else { $step = 4; $context->setParam('step', $step); diff --git a/src/Addon/Addon.php b/src/Addon/Addon.php index eb6398554c..eb9e2cda31 100644 --- a/src/Addon/Addon.php +++ b/src/Addon/Addon.php @@ -257,14 +257,7 @@ final public function getAuthor(?string $default = null): ?string /** @param string|null $format See {@link Formatter::version()} */ final public function getVersion(?string $format = null): string { - $version = $this->getProperty('version'); - - if (null === $version) { - $version = InstalledVersions::getPrettyVersion($this->package) ?? ''; - $this->setProperty('version', $version); - } - - Type::string($version); + $version = InstalledVersions::getPrettyVersion($this->package) ?? ''; if ($format) { return Formatter::version($version, $format); diff --git a/src/Console/Command/SetupRunCommand.php b/src/Console/Command/SetupRunCommand.php index bd021b172a..51549db136 100644 --- a/src/Console/Command/SetupRunCommand.php +++ b/src/Console/Command/SetupRunCommand.php @@ -454,7 +454,6 @@ static function ($value) use ($createdbOptions) { } LanguageHandler::generateCache(); - Core::setConfig('version', Core::getVersion()); // ---------------------------------- Step 5 . Create User $io->title('Step 5 of 5 / User'); diff --git a/src/Core.php b/src/Core.php index b766145a21..e802ce9814 100644 --- a/src/Core.php +++ b/src/Core.php @@ -143,11 +143,6 @@ public static function setProperty(string $key, mixed $value): bool throw new InvalidArgumentException(sprintf('"%s" property: expecting $value to be an instance of %s, "%s" found.', $key, Application::class, get_debug_type($value))); } break; - case 'version': - if (!is_string($value) || !preg_match('/^\d+(?:\.\d+)*(?:\.x)*(?:-\w+)?$/', $value)) { - throw new InvalidArgumentException(sprintf('"%s" property: expecting $value to be a valid version string, got %s.', $key, is_string($value) ? '"' . $value . '"' : get_debug_type($value))); - } - break; } $exists = isset(self::$properties[$key]); self::$properties[$key] = $value; @@ -174,7 +169,6 @@ public static function setProperty(string $key, mixed $value): bool * ($key is 'timezone' ? string : * ($key is 'table_prefix' ? non-empty-string : * ($key is 'temp_prefix' ? non-empty-string : - * ($key is 'version' ? string : * ($key is 'server' ? string : * ($key is 'servername' ? string : * ($key is 'error_email' ? string : @@ -189,7 +183,7 @@ public static function setProperty(string $key, mixed $value): bool * ($key is 'setup' ? bool|array : * ($key is 'setup_addons' ? non-empty-string[] : * mixed|null - * ))))))))))))))))))))))))))) + * )))))))))))))))))))))))))) * ) The value for $key or $default if $key cannot be found */ public static function getProperty(string $key, mixed $default = null): mixed @@ -433,19 +427,12 @@ public static function getErrorEmail(): string */ public static function getVersion(?string $format = null): string { - /** @psalm-taint-escape file */ - $version = self::getProperty('version'); - - if (!$version) { - $version = Type::string(InstalledVersions::getPrettyVersion('redaxo/core')); - - // On feature branches Composer returns "dev-", which is not - // a meaningful version. Fall back to a generic dev version. - if (str_starts_with($version, 'dev-')) { - $version = '6.x-dev'; - } + $version = Type::string(InstalledVersions::getPrettyVersion('redaxo/core')); - self::setProperty('version', $version); + // On feature branches Composer returns "dev-", which is not + // a meaningful version. Fall back to a generic dev version. + if (str_starts_with($version, 'dev-')) { + $version = '6.x-dev'; } if ($format) {