Remove posix_getpwuid and compare only userid
Signed-off-by: hoellen <dev@hoellen.eu>
This commit is contained in:
parent
0c89954488
commit
563f1318cd
14
console.php
14
console.php
|
@ -64,14 +64,14 @@ try {
|
||||||
echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL;
|
echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
$user = posix_getpwuid(posix_getuid());
|
$user = posix_getuid();
|
||||||
$configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php'));
|
$configUser = fileowner(OC::$configDir . 'config.php');
|
||||||
if ($user['name'] !== $configUser['name']) {
|
if ($user !== $configUser) {
|
||||||
echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
|
echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
|
||||||
echo "Current user: " . $user['name'] . PHP_EOL;
|
echo "Current user id: " . $user . PHP_EOL;
|
||||||
echo "Owner of config.php: " . $configUser['name'] . PHP_EOL;
|
echo "Owner id of config.php: " . $configUser . PHP_EOL;
|
||||||
echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL;
|
echo "Try adding 'sudo -u " . $configUser . " ' to the beginning of the command (without the single quotes)" . PHP_EOL;
|
||||||
echo "If running with 'docker exec' try adding the option '-u " . $configUser['name'] . "' to the docker command (without the single quotes)" . PHP_EOL;
|
echo "If running with 'docker exec' try adding the option '-u " . $configUser . "' to the docker command (without the single quotes)" . PHP_EOL;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
cron.php
11
cron.php
|
@ -94,15 +94,16 @@ try {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = posix_getpwuid(posix_getuid());
|
$user = posix_getuid();
|
||||||
$configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php'));
|
$configUser = fileowner(OC::$configDir . 'config.php');
|
||||||
if ($user['name'] !== $configUser['name']) {
|
if ($user !== $configUser) {
|
||||||
echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
|
echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
|
||||||
echo "Current user: " . $user['name'] . PHP_EOL;
|
echo "Current user id: " . $user . PHP_EOL;
|
||||||
echo "Owner of config.php: " . $configUser['name'] . PHP_EOL;
|
echo "Owner id of config.php: " . $configUser . PHP_EOL;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// We call Nextcloud from the CLI (aka cron)
|
// We call Nextcloud from the CLI (aka cron)
|
||||||
if ($appMode !== 'cron') {
|
if ($appMode !== 'cron') {
|
||||||
$config->setAppValue('core', 'backgroundjobs_mode', 'cron');
|
$config->setAppValue('core', 'backgroundjobs_mode', 'cron');
|
||||||
|
|
Loading…
Reference in New Issue