Update upgrade.php (#4402)
posix_* are not supported on Windows platform
This commit is contained in:
parent
8dceacc2b4
commit
a994e54726
1 changed files with 8 additions and 4 deletions
12
upgrade.php
12
upgrade.php
|
@ -1,11 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
(PHP_SAPI !== 'cli' || isset($_SERVER['HTTP_USER_AGENT'])) && die('Access denied.');
|
(PHP_SAPI !== 'cli' || isset($_SERVER['HTTP_USER_AGENT'])) && die('Access denied.');
|
||||||
|
|
||||||
$pwu_data = posix_getpwuid(posix_geteuid());
|
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||||
$username = $pwu_data['name'];
|
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')) {
|
if (($username=='root') || ($username=='admin')) {
|
||||||
die("\nERROR: This script should not be run as root/admin. Exiting.\n\n");
|
die("\nERROR: This script should not be run as root/admin. Exiting.\n\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue