Issue Details (XML | Word | Printable)

Key: MDL-12142
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Martín Langhoff
Reporter: Martín Langhoff
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Mailout debugger utility

Created: 13/Nov/07 08:19 AM   Updated: 13/Nov/07 08:38 AM
Component/s: Lib
Affects Version/s: 1.9, 2.0
Fix Version/s: None

Participants: Martín Langhoff
Security Level: None
Affected Branches: MOODLE_19_STABLE, MOODLE_20_STABLE


 Description  « Hide
Creating a mailout debugger that acts like sendmail.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Martín Langhoff added a comment - 13/Nov/07 08:38 AM
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.