Skip to content

Commit

Permalink
address review
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <szaimen@e.mail.de>
  • Loading branch information
szaimen committed May 15, 2024
1 parent 6a63dd1 commit 4494e8f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@
* you can overwrite the user with this config flag for console.php and cron.php
* Defaults to ``''`` (empty string)
*/
'config.owner' => '',
'php.user' => '',

/**
* Logging
Expand Down
4 changes: 2 additions & 2 deletions console.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ function exceptionHandler($exception) {

$user = posix_getuid();
$configUser = fileowner(OC::$configDir . 'config.php');
$configuredUser = $config->getSystemValueString('config.owner', '');
$configuredUser = $config->getSystemValueString('php.user', '');
if ($user !== $configUser && $configuredUser === '') {
echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
echo "Current user id: " . $user . PHP_EOL;
echo "Owner id of config.php: " . $configUser . 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 . "' to the docker command (without the single quotes)" . PHP_EOL;
echo "Another option is to configure 'config.owner' in config.php which will overwrite this check."
echo "Another option is to configure 'php.user' in config.php which will overwrite this check.";
exit(1);
}

Expand Down
6 changes: 3 additions & 3 deletions cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@

$user = posix_getuid();
$configUser = fileowner(OC::$configDir . 'config.php');
$configuredUser = $config->getSystemValueString('config.owner', '');
if ($user !== $configUser) {
$configuredUser = $config->getSystemValueString('php.user', '');
if ($user !== $configUser && $configuredUser === '') {
echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
echo "Current user id: " . $user . PHP_EOL;
echo "Owner id of config.php: " . $configUser . PHP_EOL;
echo "Another option is to configure 'config.owner' in config.php which will overwrite this check."
echo "Another option is to configure 'php.user' in config.php which will overwrite this check.";
exit(1);
}

Expand Down

0 comments on commit 4494e8f

Please sign in to comment.