From 8142b48558873dba07fd8ac89b899039e4d5becd Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 16 Oct 2025 18:16:27 -0600 Subject: [PATCH] ensure binaries are executable --- classes/plugin/SafeUpgradeManager.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/classes/plugin/SafeUpgradeManager.php b/classes/plugin/SafeUpgradeManager.php index 4f459fcd..d13a01ed 100644 --- a/classes/plugin/SafeUpgradeManager.php +++ b/classes/plugin/SafeUpgradeManager.php @@ -550,6 +550,8 @@ class SafeUpgradeManager $this->recovery->closeUpgradeWindow(); } + $this->ensureExecutablePermissions(); + $manifest = $this->resolveLatestManifest(); $this->setProgress('complete', 'Upgrade complete.', 100, [ @@ -939,4 +941,29 @@ class SafeUpgradeManager 'message' => $message, ] + $extra; } + + protected 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; + } + + $perms = @fileperms($path); + $mode = $perms !== false ? ($perms & 0777) : null; + if ($mode !== 0755) { + @chmod($path, 0755); + $this->log(sprintf('Adjusted permissions on %s to 0755', $relative), 'debug'); + } + } + } }