Skip to content

A free open source IT asset/license management system

Update upgrade.php (#4402)

uknzaeinozpasa994e547266b
diff --git a/upgrade.php b/upgrade.php
index 0375c18f2f..653214b0db 100644
--- a/upgrade.php
+++ b/upgrade.php
@@ -1,11 +1,15 @@
<?php
(PHP_SAPI !== 'cli' || isset($_SERVER['HTTP_USER_AGENT'])) && die('Access denied.');
-$pwu_data = posix_getpwuid(posix_geteuid());
-$username = $pwu_data['name'];
+if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+ echo "Skipping user check as it is not supported on Windows\n";
+} else {
+ $pwu_data = posix_getpwuid(posix_geteuid());
+ $username = $pwu_data['name'];
-if (($username=='root') || ($username=='admin')) {
- die("\nERROR: This script should not be run as root/admin. Exiting.\n\n");
+ if (($username=='root') || ($username=='admin')) {
+ die("\nERROR: This script should not be run as root/admin. Exiting.\n\n");
+ }
}