r5092 init.php: determine CLI username by ENV variable instead of 'admin'
authorAlexey Andriyanov <alan@al-an.info>
Fri, 1 Jun 2012 13:02:11 +0000 (13:02 +0000)
committerAlexey Andriyanov <alan@al-an.info>
Fri, 1 Jun 2012 13:02:11 +0000 (13:02 +0000)
wwwroot/inc/init.php

index 78ea1cd..95a6ee6 100644 (file)
@@ -119,7 +119,11 @@ elseif (! isset ($remote_username))
        // Some functions require remote_username to be set to something to act correctly,
        // even though they don't use the value itself.
        $admin_account = spotEntity ('user', 1);
-       $remote_username = $admin_account['user_name'];
+       if (FALSE !== $env_user = getenv('USER'))
+               $remote_username = $env_user;
+       else
+               $remote_username = $admin_account['user_name'];
+       unset ($env_user);
        unset ($admin_account);
 }