diff --git a/system/src/Grav/Console/Gpm/SelfupgradeCommand.php b/system/src/Grav/Console/Gpm/SelfupgradeCommand.php index 07bd77e0b..2ca307d49 100644 --- a/system/src/Grav/Console/Gpm/SelfupgradeCommand.php +++ b/system/src/Grav/Console/Gpm/SelfupgradeCommand.php @@ -455,6 +455,8 @@ class SelfupgradeCommand extends GpmCommand // extra white spaces to clear out the buffer properly $io->writeln(' |- Installing upgrade... ok '); + $this->ensureExecutablePermissions(); + return true; } @@ -510,4 +512,28 @@ class SelfupgradeCommand extends GpmCommand Installer::setError($e->getMessage()); } } + + private function ensureExecutablePermissions(): void + { + $executables = [ + 'bin/grav', + 'bin/plugin', + 'bin/gpm', + 'bin/restore', + 'bin/composer.phar' + ]; + + foreach ($executables as $relative) { + $path = GRAV_ROOT . '/' . $relative; + if (!is_file($path) || is_link($path)) { + continue; + } + + $mode = @fileperms($path); + $desired = ($mode & 0777) | 0111; + if (($mode & 0111) !== 0111) { + @chmod($path, $desired); + } + } + } }