refactor(legacy): simplify getTheme and clarify legacy theme docs

Signed-off-by: Josh <josh.t.richards@gmail.com>
This commit is contained in:
Josh 2026-05-16 10:04:37 -04:00 committed by GitHub
parent f188efd918
commit 965b6a96e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -614,21 +614,26 @@ class OC_Util {
}
/**
* Handles the case that there may not be a theme, then check if a "default"
* theme exists and take that one
* Returns the name of the active legacy theme.
*
* @return string the theme
* This method does not verify that the configured theme directory exists. It
* only applies to the legacy filesystem-based theme mechanism, not the modern
* theming app.
*
* @return string The configured legacy theme name, `default` as a fallback if present, or an empty string if there is no active legacy theme.
*/
public static function getTheme() {
$theme = Server::get(SystemConfig::class)->getValue('theme', '');
$themeName = Server::get(SystemConfig::class)->getValue('theme', '');
if ($theme === '') {
if (is_dir(OC::$SERVERROOT . '/themes/default')) {
$theme = 'default';
}
if ($themeName !== '') {
return $themeName;
}
return $theme;
if (is_dir(OC::$SERVERROOT . '/themes/default')) {
return 'default';
}
return '';
}
/**