Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove posix_getpwuid and compare only userid
Signed-off-by: Daniel Kesselberg <[email protected]>
  • Loading branch information
kesselb committed Sep 6, 2018
commit 2e5d8ecca467b965ed620331135a639a9c5f57a5
8 changes: 4 additions & 4 deletions settings/Controller/CheckSetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ protected function hasOpcacheLoaded(): bool {
* @return array
*/
protected function getAppDirsWithDifferentOwner(): array {
$currentUser = posix_getpwuid(posix_getuid());
$currentUser = posix_getuid();
$appDirsWithDifferentOwner = [[]];

foreach (OC::$APPSROOTS as $appRoot) {
Expand All @@ -561,19 +561,19 @@ protected function getAppDirsWithDifferentOwner(): array {
/**
* Tests if the directories for one apps directory are writable by the current user.
*
* @param array $currentUser The current user
* @param int $currentUser The current user
* @param array $appRoot The app root config
* @return string[] The none writable directory paths inside the app root
*/
private function getAppDirsWithDifferentOwnerForAppRoot(array $currentUser, array $appRoot): array {
private function getAppDirsWithDifferentOwnerForAppRoot($currentUser, array $appRoot): array {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type hint int missing

$appDirsWithDifferentOwner = [];
$appsPath = $appRoot['path'];
$appsDir = new DirectoryIterator($appRoot['path']);

foreach ($appsDir as $fileInfo) {
if ($fileInfo->isDir() && !$fileInfo->isDot()) {
$absAppPath = $appsPath . DIRECTORY_SEPARATOR . $fileInfo->getFilename();
$appDirUser = posix_getpwuid(fileowner($absAppPath));
$appDirUser = fileowner($absAppPath);
if ($appDirUser !== $currentUser) {
$appDirsWithDifferentOwner[] = $absAppPath;
}
Expand Down