Francis Gudin - 2006-01-29

Hello,

i just attempted yesterday to cron <ackerRoot>/modules/email/email.php to get mail notifications and hit a bug; this is from my cron job results:
"Warning: main(/usr/local/share//config/config.inc.php): failed to open stream: No such file or
+directory in /usr/local/share/ackerTodo-3.4/modules/email/email.php on line 28"

Examining email.php, we see that the install root is computed this way, which is clearly valid only for an install at 4th dir level below /:
    $full_path = dirname(__FILE__);
    $temp_path = split("/", $full_path);
    $final_path = "/".$temp_path[1]."/".$temp_path[2]."/".$temp_path[3]."/";

Hence, modified my email.php to add another level:
    $full_path = dirname(__FILE__);
    $temp_path = split("/", $full_path);
    $final_path = "/".$temp_path[1]."/".$temp_path[2]."/".$temp_path[3]."/".$temp_path[4];

This is a dirty weak hack. Being absolutely not a PHP coder, i can't come with anything better but i could give this idea: why not 'substract' a well-know file' path from the absolute path of modules/email/email.php ? I mean, for my site:
'/usr/local/share/ackerTodo-3.4/modules/email/email.php'  - 'modules/email/email.php' => '/usr/local/share/ackerTodo-3.4/'
Correct ?

Another little suggestion: email.php must access the DB, thus read config.inc.php. Install notes should mention that the email script should be cron'ed by the www server user itself. I can't recall seeing it mentionned, though i could be wrong...

BR,
Francis (happy ackerTodo user)