Skip to content

Commit

Permalink
Merge pull request #28999 from owncloud/stable10-no-theme-directory-fix
Browse files Browse the repository at this point in the history
[stable10] don't assume the theme directory exists
  • Loading branch information
Vincent Petry authored Sep 14, 2017
2 parents 09551b8 + 2bc45cd commit ed710cd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
16 changes: 9 additions & 7 deletions core/Command/Maintenance/Mimetype/UpdateJS.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 11 additions & 9 deletions lib/private/Theme/ThemeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ed710cd

Please sign in to comment.