Revision [12128]
This is an old revision of RyeBreadDraftsEventNotification made by RyeBread on 2005-12-06 20:15:53.
Basically, I wanted something that would email people in my office whenever somebody posted a comment on a page of interest. I thought I would make it a little more robust however. This should be a framework that will allow wikka to automatically react to a variety of page events (i.e. commenting a page, editing a page etc) and trigger some response (i.e. emailing a user, sending an http request to a server etc.)
This isn't finished, yet it is currently running in my office, so I know it works.
Steps:
- Create new event watching table.
- Create a handler to register an event for a page to watch.
- Create a response function (i.e. email notification).
- Add code to look for and process a page event. Then call a response function.
- Make handler easily accessible for users.
1.) Create Table
CREATE TABLE `wikka_watches` (
`page_tag` VARCHAR(75) NOT NULL,
`watcher` VARCHAR(75) NOT NULL,
`comment` ENUM('Y','N') DEFAULT 'N' NOT NULL,
`edit` ENUM('Y','N') DEFAULT 'N' NOT NULL
)
TYPE = myisam;
ALTER TABLE `wikka_watches` ADD UNIQUE (`page_tag`,`watcher`)
ALTER TABLE `wikka_watches` ADD INDEX (`page_tag`)
ALTER TABLE `wikka_watches` ADD INDEX (`watcher`)
`page_tag` VARCHAR(75) NOT NULL,
`watcher` VARCHAR(75) NOT NULL,
`comment` ENUM('Y','N') DEFAULT 'N' NOT NULL,
`edit` ENUM('Y','N') DEFAULT 'N' NOT NULL
)
TYPE = myisam;
ALTER TABLE `wikka_watches` ADD UNIQUE (`page_tag`,`watcher`)
ALTER TABLE `wikka_watches` ADD INDEX (`page_tag`)
ALTER TABLE `wikka_watches` ADD INDEX (`watcher`)
This will create a table that will store a page_tag and watcher pair. The watcher isn't restricted to being a username. It could be the name of a wikipingserver or something like that. Each column after that corresponds to a particular page event with a simple indication of whether or not that event is being watched for.