Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pages/setup/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@

if (0 == count($errors)) {
LanguageHandler::generateCache();
Core::setConfig('version', Core::getVersion());
} else {
$step = 4;
$context->setParam('step', $step);
Expand Down
9 changes: 1 addition & 8 deletions src/Addon/Addon.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/Console/Command/SetupRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
25 changes: 6 additions & 19 deletions src/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 :
Expand All @@ -189,7 +183,7 @@ public static function setProperty(string $key, mixed $value): bool
* ($key is 'setup' ? bool|array<string, int> :
* ($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
Expand Down Expand Up @@ -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-<branch>", 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-<branch>", 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) {
Expand Down
Loading