From 70bc641bd461b9be09e4c86ddf5da31b3be1590e Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 23 May 2004 20:03:29 +0000 Subject: [PATCH] added error-message if webserver user need to be in a certain group to execut the crontab command. The name of the webserver user and the groupname are read from the process and the file-permission and displayed too, in case the admin dont know them ;-) --- phpgwapi/inc/class.asyncservice.inc.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/phpgwapi/inc/class.asyncservice.inc.php b/phpgwapi/inc/class.asyncservice.inc.php index 1fa160228c..8c9db9a657 100644 --- a/phpgwapi/inc/class.asyncservice.inc.php +++ b/phpgwapi/inc/class.asyncservice.inc.php @@ -559,8 +559,19 @@ foreach ($binarys as $name => $path) { $this->$name = $path; // a reasonable default for *nix - if (!is_executable($this->$name)) + + if (!($Ok = is_executable($this->$name))) { + if (file_exists($this->$name)) + { + echo '

'.lang('%1 is not executable by the webserver !!!',$this->$name)."

\n"; + $perms = fileperms($this->$name); + if (!($perms & 0x0001) && ($perms & 0x0008)) // only executable by group + { + $group = posix_getgrgid(filegroup($this->$name)); + $webserver = posix_getpwuid(posix_getuid ()); + echo '

'.lang("You need to add the webserver user '%1' to the group '%2'.",$webserver['name'],$group['name'])."

\n"; } + } if ($fd = popen('/bin/sh -c "type -p '.$name.'"','r')) { $this->$name = fgets($fd,256); @@ -571,7 +582,7 @@ $this->$name = substr($this->$name,0,$pos); } } - if (!is_executable($this->$name)) + if (!$Ok && !is_executable($this->$name)) { $this->$name = $name; // hopefully its in the path } @@ -659,9 +670,12 @@ if (($crontab = popen('/bin/sh -c "'.$this->crontab.' -" 2>&1','w')) !== False) { - foreach ($this->other_cronlines as $cronline) + if (is_array($this->other_cronlines)) { - fwrite($crontab,$cronline); // preserv the other lines on install + foreach ($this->other_cronlines as $cronline) + { + fwrite($crontab,$cronline); // preserv the other lines on install + } } if ($times !== False) {