Update upgrade.php (#4402)

posix_* are not supported on Windows platform
This commit is contained in:
uknzaeinozpas 2017-11-09 05:13:35 +01:00 committed by snipe
parent 8dceacc2b4
commit a994e54726

View file

@ -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");
}
}