diff --git a/core/Command/Maintenance/Mimetype/UpdateJS.php b/core/Command/Maintenance/Mimetype/UpdateJS.php index 278e4a2af2cb..61f74d007bd0 100644 --- a/core/Command/Maintenance/Mimetype/UpdateJS.php +++ b/core/Command/Maintenance/Mimetype/UpdateJS.php @@ -122,15 +122,17 @@ private function getAppThemes() { private function getLegacyThemes() { $themes = []; - $legacyThemeDirectories = new \DirectoryIterator(\OC::$SERVERROOT . '/themes/'); + if (is_dir(\OC::$SERVERROOT . '/themes/')) { + $legacyThemeDirectories = new \DirectoryIterator(\OC::$SERVERROOT . '/themes/'); - foreach($legacyThemeDirectories as $legacyThemeDirectory) { - if ($legacyThemeDirectory->isFile() || $legacyThemeDirectory->isDot()) { - continue; + foreach($legacyThemeDirectories as $legacyThemeDirectory) { + if ($legacyThemeDirectory->isFile() || $legacyThemeDirectory->isDot()) { + continue; + } + $themes[$legacyThemeDirectory->getFilename()] = $this->getFileTypeIcons( + $legacyThemeDirectory->getPathname() + ); } - $themes[$legacyThemeDirectory->getFilename()] = $this->getFileTypeIcons( - $legacyThemeDirectory->getPathname() - ); } return $themes; diff --git a/lib/private/Theme/ThemeService.php b/lib/private/Theme/ThemeService.php index 09fb5dd31947..3e69db511601 100644 --- a/lib/private/Theme/ThemeService.php +++ b/lib/private/Theme/ThemeService.php @@ -166,17 +166,19 @@ private function getAllAppThemes() { */ private function getAllLegacyThemes() { $themes = []; - if ($handle = opendir(\OC::$SERVERROOT . '/themes')) { - while (false !== ($entry = readdir($handle))) { - if ($entry === '.' || $entry === '..') { - continue; - } - if (is_dir(\OC::$SERVERROOT . '/themes/' . $entry)) { - $themes[$entry] = $this->makeTheme($entry, false); + if (is_dir(\OC::$SERVERROOT . '/themes')) { + if ($handle = opendir(\OC::$SERVERROOT . '/themes')) { + while (false !== ($entry = readdir($handle))) { + if ($entry === '.' || $entry === '..') { + continue; + } + if (is_dir(\OC::$SERVERROOT . '/themes/' . $entry)) { + $themes[$entry] = $this->makeTheme($entry, false); + } } + closedir($handle); + return $themes; } - closedir($handle); - return $themes; } return $themes; }