diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2018-08-30 20:52:43 +0200 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2018-08-30 20:52:43 +0200 |
commit | a6bb19fa11fb132f91eeb692057a0bd5b7e94948 (patch) | |
tree | e56c6989bdc6855407700096b2eff9bd520ce692 /settings/Controller | |
parent | ce87537b819290ca90385b36a01edfac1c1da630 (diff) | |
download | nextcloud-server-a6bb19fa11fb132f91eeb692057a0bd5b7e94948.tar.gz nextcloud-server-a6bb19fa11fb132f91eeb692057a0bd5b7e94948.zip |
Fix path when app has wrong permission
Replace slow array function used in loop: https://github.com/kalessil/phpinspectionsea/blob/master/docs/performance.md#slow-array-function-used-in-loop
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'settings/Controller')
-rw-r--r-- | settings/Controller/CheckSetupController.php | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php index 747e60c7cb2..9169808456f 100644 --- a/settings/Controller/CheckSetupController.php +++ b/settings/Controller/CheckSetupController.php @@ -544,18 +544,17 @@ Raw output */ 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; } @@ -576,7 +575,7 @@ Raw output $absAppPath = $appsPath . DIRECTORY_SEPARATOR . $fileInfo->getFilename(); $appDirUser = posix_getpwuid(fileowner($absAppPath)); if ($appDirUser !== $currentUser) { - $appDirsWithDifferentOwner[] = $absAppPath . DIRECTORY_SEPARATOR . $fileInfo->getFilename(); + $appDirsWithDifferentOwner[] = $absAppPath; } } } |