Add posix_getuid detection to the right place.
This commit is contained in:
		
							parent
							
								
									3c0f2a2ca5
								
							
						
					
					
						commit
						dc44d51479
					
				| @ -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,"); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user