diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index b9c91a83aab36..da8b9ded24c7a 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -614,21 +614,26 @@ public static function obEnd() { } /** - * 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; + } + + if (is_dir(OC::$SERVERROOT . '/themes/default')) { + return 'default'; } - return $theme; + return ''; } /**