Brief howto at http://moodle.org/mod/forum/post.php?reply=349457
Quick rundown of the technique I've been using today to work in the guts of
forum cron with confidence...
- Grab a production database, full of users with real emails, and real forum
posts. Go, mangle those emails a bit just in case.
- Make sure your dev machine doesn't have an MTA. It's safer that way...
- Make sure $CFG->smtphost = '';
- In your SQL utility, say: UPDATE mdl_forum_posts SET mailed=0 WHERE created
> >= 1183611278 AND mailed!=0; UPDATE mdl_modules SET lastcron=0 WHERE
name='forum';
- On the commandline, run your cron script setting the sendmail_path: php -d
sendmail_path=/path/to/modle/admin/mailout-debugger.php
So with this trick, I
- Create a "baseline" run, and mv the log to baseline.log
- Change the code wildly

- Reset the 'mailed' flag and re-run the script
- mv it to wip.log
- Compare the new log with the baseline, skipping lines that have timestamps
and other variant bits
- Did what you wanted to change change? Other things, did they say the same?
To run the comparison with the proper exceptions, use
diff I '(-oi|boundary|-b|====)' baseline-B2.log wip-B2.log
You can use sdiff with the same commandline to get a nice side-by-side.
Brief howto at http://moodle.org/mod/forum/post.php?reply=349457
Quick rundown of the technique I've been using today to work in the guts of
forum cron with confidence...
posts. Go, mangle those emails a bit just in case.
> >= 1183611278 AND mailed!=0; UPDATE mdl_modules SET lastcron=0 WHERE
name='forum';
sendmail_path=/path/to/modle/admin/mailout-debugger.php
So with this trick, I
and other variant bits
To run the comparison with the proper exceptions, use
diff
I '(-oi|boundary|-b|====)' baseline-B2.log wip-B2.logYou can use sdiff with the same commandline to get a nice side-by-side.
- Grab a production database, full of users with real emails, and real forum
posts. Go, mangle those emails a bit just in case.
- Make sure your dev machine doesn't have an MTA. It's safer that way...
- Make sure $CFG->smtphost = '';
- In your SQL utility, say: UPDATE mdl_forum_posts SET mailed=0 WHERE created
> >= 1183611278 AND mailed!=0; UPDATE mdl_modules SET lastcron=0 WHERE
name='forum';
- On the commandline, run your cron script setting the sendmail_path: php -d
sendmail_path=/path/to/modle/admin/mailout-debugger.php
So with this trick, I- Create a "baseline" run, and mv the log to baseline.log
- Change the code wildly

- Reset the 'mailed' flag and re-run the script
- mv it to wip.log
- Compare the new log with the baseline, skipping lines that have timestamps
and other variant bits
- Did what you wanted to change change? Other things, did they say the same?
To run the comparison with the proper exceptions, use diffI '(-oi|boundary|-b|====)' baseline-B2.log wip-B2.log You can use sdiff with the same commandline to get a nice side-by-side.