Add posix_getuid detection to the right place.
Some checks are pending
Prerequisites Testing / test-php-version-requirements (7.4) (push) Waiting to run
Prerequisites Testing / test-php-version-requirements (8.1) (push) Waiting to run
Prerequisites Testing / test-php-version-requirements (8.2) (push) Waiting to run
Prerequisites Testing / test-php-version-requirements (8.3) (push) Waiting to run
Prerequisites Testing / test-extension-progression (alpine:latest, 8.2) (push) Waiting to run
Prerequisites Testing / test-extension-progression (alpine:latest, 8.3) (push) Waiting to run
Prerequisites Testing / test-extension-progression (debian:bookworm, 8.2) (push) Waiting to run
Prerequisites Testing / test-extension-progression (debian:bookworm, 8.3) (push) Waiting to run
Prerequisites Testing / test-extension-progression (fedora:39, 8.2) (push) Waiting to run
Prerequisites Testing / test-extension-progression (fedora:39, 8.3) (push) Waiting to run
Prerequisites Testing / test-permission-scenarios (push) Waiting to run
Run unit tests / run-unit-tests (push) Waiting to run

This commit is contained in:
Greg Sarjeant 2025-07-27 15:33:15 -04:00
parent 3c0f2a2ca5
commit dc44d51479

View File

@ -171,13 +171,22 @@ class Prerequisites {
private function checkStoragePermissions() {
// Issue a warning if running as root in CLI context
if ($this->isCli && posix_getuid() === 0) {
// Write out guidance for storage directory permissions
// if running the CLI script as root (since it will always appear to be writable)
if ($this->isCli && function_exists('posix_getuid') && posix_getuid() === 0) {
$this->addCheck(
'Root User Warning',
false,
'Running as root - permission checks may be inaccurate. After setup, ensure storage/ is owned by your web server user',
'warning'
);
} elseif ($this->isCli && !function_exists('posix_getuid')) {
$this->addCheck(
'POSIX Extension',
false,
'POSIX extension not available - cannot detect if running as root',
'warning'
);
}
$storageDirs = array(
@ -526,24 +535,6 @@ class Prerequisites {
}
}
// Write out guidance for storage directory permissions
// if running the CLI script as root (since it will always appear to be writable)
if ($this->isCli && function_exists('posix_getuid') && posix_getuid() === 0) {
$this->addCheck(
'Root User Warning',
false,
'Running as root - permission checks may be inaccurate. After setup, ensure storage/ is owned by your web server user',
'warning'
);
} elseif ($this->isCli && !function_exists('posix_getuid')) {
$this->addCheck(
'POSIX Extension',
false,
'POSIX extension not available - cannot detect if running as root',
'warning'
);
}
if ($this->isCli && function_exists('posix_getuid') && posix_getuid() === 0) {
$this->log("\n📋 ROOT USER SETUP RECOMMENDATIONS:");
$this->log("After uploading to your web server,");