Skip to content

Commit

Permalink
Merge pull request #10939 from nextcloud/bugfix/10930/perm-checker-wr…
Browse files Browse the repository at this point in the history
…ong-path

Fix path when app has wrong permission
  • Loading branch information
MorrisJobke authored Aug 30, 2018
2 parents 8ea2f8d + a6bb19f commit 1ddde36
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions settings/Controller/CheckSetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,18 +544,17 @@ protected function hasOpcacheLoaded(): bool {
*/
protected function getAppDirsWithDifferentOwner(): array {
$currentUser = posix_getpwuid(posix_getuid());
$appDirsWithDifferentOwner = [];
$appDirsWithDifferentOwner = [[]];

foreach (OC::$APPSROOTS as $appRoot) {
if ($appRoot['writable'] === true) {
$appDirsWithDifferentOwner = array_merge(
$appDirsWithDifferentOwner,
$this->getAppDirsWithDifferentOwnerForAppRoot($currentUser, $appRoot)
);
$appDirsWithDifferentOwner[] = $this->getAppDirsWithDifferentOwnerForAppRoot($currentUser, $appRoot);
}
}

$appDirsWithDifferentOwner = array_merge(...$appDirsWithDifferentOwner);
sort($appDirsWithDifferentOwner);

return $appDirsWithDifferentOwner;
}

Expand All @@ -576,7 +575,7 @@ private function getAppDirsWithDifferentOwnerForAppRoot(array $currentUser, arra
$absAppPath = $appsPath . DIRECTORY_SEPARATOR . $fileInfo->getFilename();
$appDirUser = posix_getpwuid(fileowner($absAppPath));
if ($appDirUser !== $currentUser) {
$appDirsWithDifferentOwner[] = $absAppPath . DIRECTORY_SEPARATOR . $fileInfo->getFilename();
$appDirsWithDifferentOwner[] = $absAppPath;
}
}
}
Expand Down

0 comments on commit 1ddde36

Please sign in to comment.