Some wikis allow you to subscribe, such that you get e-mail notification. Some, like UseModWiki, will only allow notification for any page. Others (can't think of an example right now) allow you to subscribe on a page-by-page basis.
I'd like to implement the latter for 'Tavi, without making it too messy. Here's what I'm thinking of; please comment!
Create a display macro, for example, "SendEmailWhenChanged", which looks like this:
[[SendEmailWhenChanged smoonen@andstuff.org, joeuser@example.com, hi@there.com]]
Have it map to an empty function so that it doesn't even show up when a document is viewed. Create a separate save parser that looks for [[SendEmailWhenChanged ...]] and emails the given individuals a quick note when the page is saved.
This particular approach is ridiculously simple. No new mechanisms really need to be created as far as the script is concerned; just add your name to the list and you're done.
On the other hand, it's non-obvious. If a page doesn't already have a sign-up list, how would someone know they could sign up? Moreover, it clutters the page at edit-time with information that is not really meant to be in the page text itself.
Also, it would be possible to remove someone's name from the list. They'd never discover it, since they'd never receive a notification. Ideally, to fix that, we'd need to send e-mail to the union of the sets of email addresses on the saved version and the previous version. Which would get a little cumbersome.
And there's no way to request emails about any new pages that are created. That would be a handy way to alert people that there may be a new page they want to sign up for.
I don't know. I just thought of this idea, and it was simple enough that I thought it worthwhile writing out. But as I consider the downsides, it's not quite as flexible as most users would probably like it to be. However, implementing a full-fledged subscription service would be a little bit bigger of an undertaking.
Thoughts, anyone?
While writing the code for it would take a little time another way to handle EmailNotification is to allow users to have a link in the footer which would allow a user to subscribe to the page. We'd need an interface for registration and perhaps a page which showed all the pages to which one subscribed with an option to remove pages. Obviously we'd need MySQL tables for all of this too.
Since we don't want every change to a page to send a notificationwe want to queue them until a quiet period has elapsed indicating that work on the page is completewe could write code in our page save mechanism that would:
Known limitations:
I wanted something simlar. I wrote a little perl script which I run once a day via cron. The recipient could be a mailinglist.
#!/usr/bin/perl
use strict;
use diagnostics;
use DBI;
my $dsn="DBI:mysql:<database>;host=localhost"; # EDIT Database
my $dbuser="<user>"; # EDIT User
my $dbpass="<password>"; # EDIT Password
my $sender="sender\@domain.com"; # EDIT Senderadress
my $recipients="one\@domain.com two\@domain.com>"; # EDIT Recipients
my $url="http://www.domain.com/wiki/index.php?page="; # EDIT Wiki URL
my $subject="Wiki Report"; # EDIT Subject
my $title;
my $dbh;
my $db_result;
my $result;
my $wikireport="";
#-------------------#
# Datenbank connect #
#-------------------#
$dbh=DBI->connect($dsn, $dbuser, $dbpass);
if (!$dbh){
die "Error: " . $dbh->errstr . "\n";
}
$db_result=$dbh->prepare("SELECT DISTINCT(title) FROM pages WHERE time>DATE_SUB(now(), INTERVAL 1 DAY) ORDER BY title");
if (!$db_result){
die "Error: " . $dbh->errstr . "\n";
}
if (!$db_result->execute()){
die "Error: " . $dbh->errstr . "\n";
}
while ($result=$db_result->fetchrow_hashref()){
$title=$result->{'title'};
$title=~s/\s/+/g;
$result->{'title'}=~s/^\s+//;
$wikireport.=$result->{'title'} . "\n -> " . $url . $title . "\n";
}
if ($wikireport!~/^$/){
open SENDMAIL, "|/usr/sbin/sendmail -f " . $sender . " " . $recipients || die "$0: $!\n";
$recipients=~s/\s+/, /;
print SENDMAIL "FROM: " . $sender . "\n";
print SENDMAIL "TO: " . $recipients . "\n";
print SENDMAIL "SUBJECT: " . $subject . "\n\n";
print SENDMAIL $wikireport;
close SENDMAIL;
}