Piwik\Filechecks::getUser PHP Method

getUser() public static method

public static getUser ( )
    public static function getUser()
    {
        if (function_exists('shell_exec')) {
            return trim(shell_exec('whoami'));
        }
        $currentUser = get_current_user();
        if (!empty($currentUser)) {
            return $currentUser;
        }
        return 'www-data';
    }

Usage Example

Example #1
0
 /**
  * @param $path
  * @return string
  */
 private function getMessageWhenFileExistsButNotReadable($path)
 {
     $format = " \n<b>» %s </b>";
     if (Common::isPhpCliMode()) {
         $format = "\n » %s \n";
     }
     return sprintf($format, $this->translator->translate('General_ExceptionConfigurationFilePleaseCheckReadableByUser', array($path, Filechecks::getUser())));
 }