mirror of
https://github.com/getgrav/grav.git
synced 2025-10-26 00:46:07 +02:00
fix for binary permissions in CLI
This commit is contained in:
@@ -457,6 +457,8 @@ class SelfupgradeCommand extends GpmCommand
|
||||
// extra white spaces to clear out the buffer properly
|
||||
$io->writeln(' |- Installing upgrade... <green>ok</green> ');
|
||||
|
||||
$this->ensureExecutablePermissions();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -512,4 +514,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user