From 078bd7c80e2d6c62e1c2c38460f80473f03ac7ab Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 5 Feb 2024 15:58:48 +0200 Subject: [PATCH] ref --- application/Espo/Core/Utils/File/Permission.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/application/Espo/Core/Utils/File/Permission.php b/application/Espo/Core/Utils/File/Permission.php index 2a334668b8..0d9d14b158 100644 --- a/application/Espo/Core/Utils/File/Permission.php +++ b/application/Espo/Core/Utils/File/Permission.php @@ -161,7 +161,7 @@ class Permission return array_merge($permission, $this->writablePermissions); } - if ($writableOptions['recursive'] && substr($path, 0, strlen($writablePath)) == $writablePath) { + if ($writableOptions['recursive'] && str_starts_with($path, $writablePath)) { /** @phpstan-ignore-next-line */ return array_merge($permission, $this->writablePermissions); } @@ -358,6 +358,7 @@ class Permission * Change group permission. * * @param int|string $group + * @noinspection SpellCheckingInspection */ public function chgrp(string $path, $group = null, bool $recurse = false): bool { @@ -385,6 +386,7 @@ class Permission * Change group permission recursive. * * @param int|string $group + * @noinspection SpellCheckingInspection */ protected function chgrpRecurse(string $path, $group): bool { @@ -447,9 +449,10 @@ class Permission } /** + * @param int|string $group + * @noinspection SpellCheckingInspection * @todo Revise the need of exception handling. * - * @param int|string $group */ protected function chgrpReal(string $path, $group): bool { @@ -518,7 +521,7 @@ class Permission try { $this->chmod($path, $this->writablePermissions, $options['recursive']); } - catch (Throwable $e) {} + catch (Throwable) {} /** check is writable */ $res = is_writable($path); @@ -531,7 +534,7 @@ class Permission $res &= $this->fileManager->removeFile($name, $path); } - catch (Throwable $e) { + catch (Throwable) { $res = false; } } @@ -544,7 +547,7 @@ class Permission } } - return (bool) $result; + return $result; } /**