X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fdaemon.php;h=eaeecc10589531325cd2506fbd421300ad11a2f4;hb=5a235ffbf905fe16105b5ecf9db3a040f04034b2;hp=c09531c9d572e2c714a21d862e0635311e2afdb6;hpb=3ad3535cd8d12787d1af95969b9576620abce4a9;p=quix0rs-gnu-social.git diff --git a/lib/daemon.php b/lib/daemon.php index c09531c9d5..eaeecc1058 100644 --- a/lib/daemon.php +++ b/lib/daemon.php @@ -48,12 +48,11 @@ class Daemon function background() { - /* Starting PHP 5.4 (dotdeb), maybe earlier for some version/distrib + /* + * This prefers to Starting PHP 5.4 (dotdeb), maybe earlier for some version/distrib * seems MySQL connection using mysqli driver get lost when fork. * Need to unset it so that child process recreate it. * - * Not needed if using mysql driver (but it's deprecated starting PHP 5.5) - * * @todo FIXME cleaner way to do it ? */ global $_DB_DATAOBJECT; @@ -125,19 +124,6 @@ class Daemon function changeUser() { - $username = common_config('daemon', 'user'); - - if ($username) { - $user_info = posix_getpwnam($username); - if (!$user_info) { - common_log(LOG_WARNING, - 'Ignoring unknown user for daemon: ' . $username); - } else { - common_log(LOG_INFO, "Setting user to " . $username); - posix_setuid($user_info['uid']); - } - } - $groupname = common_config('daemon', 'group'); if ($groupname) { @@ -150,6 +136,19 @@ class Daemon posix_setgid($group_info['gid']); } } + + $username = common_config('daemon', 'user'); + + if ($username) { + $user_info = posix_getpwnam($username); + if (!$user_info) { + common_log(LOG_WARNING, + 'Ignoring unknown user for daemon: ' . $username); + } else { + common_log(LOG_INFO, "Setting user to " . $username); + posix_setuid($user_info['uid']); + } + } } function runOnce()