Skip to content

Commit d4c8781

Browse files
authored
Merge pull request #60481 from nextcloud/jtr/legacy-getTheme
refactor(legacy): simplify getTheme and clarify legacy theme docs
2 parents 232fb61 + 965b6a9 commit d4c8781

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

lib/private/legacy/OC_Util.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -614,21 +614,26 @@ public static function obEnd() {
614614
}
615615

616616
/**
617-
* Handles the case that there may not be a theme, then check if a "default"
618-
* theme exists and take that one
617+
* Returns the name of the active legacy theme.
619618
*
620-
* @return string the theme
619+
* This method does not verify that the configured theme directory exists. It
620+
* only applies to the legacy filesystem-based theme mechanism, not the modern
621+
* theming app.
622+
*
623+
* @return string The configured legacy theme name, `default` as a fallback if present, or an empty string if there is no active legacy theme.
621624
*/
622625
public static function getTheme() {
623-
$theme = Server::get(SystemConfig::class)->getValue('theme', '');
626+
$themeName = Server::get(SystemConfig::class)->getValue('theme', '');
624627

625-
if ($theme === '') {
626-
if (is_dir(OC::$SERVERROOT . '/themes/default')) {
627-
$theme = 'default';
628-
}
628+
if ($themeName !== '') {
629+
return $themeName;
630+
}
631+
632+
if (is_dir(OC::$SERVERROOT . '/themes/default')) {
633+
return 'default';
629634
}
630635

631-
return $theme;
636+
return '';
632637
}
633638

634639
/**

0 commit comments

Comments
 (0)