CIA Bot Notifier
Related Links
MediaWiki port∞ derived from this initial implementation
About the CIA Bot Notifier
This code is experimental code that takes advantage of the very popular IRC-based source code change notifier bot,
CIA∞. Basically, changes to your wiki pages, or new comments, generate an XML-formatted message that is sent to the CIA bot server. The message is then re-broadcast over IRC channels via subscribed CIA bots. Details about CIA are beyond the scope of this document; those interested in additional information about the XML schema used in this code should start with the
CIA development docs∞.
Screenshot
This is what the notifier looks like in action using the
irssi∞ IRC client:
System Requirements
- Tested on Wikka trunk
- PHP mail() must be operational
- A CIA account∞
Implementation
- Add the following parameter to wikka.config.php:
'cia_bot_project_name' => 'your-project-name'
- In handlers/edit/edit.php, search for the call to SavePage(). Immediately after this code, insert the following code segment, providing your wiki URL where specified:
// Notify CIA bot if config param is set
if(isset($this->
config['cia_bot_project_name']) &&
!
preg_match('/[!]\*/',
$this->
ACLs['read_acl']))
{
$project_name =
$this->
config['cia_bot_project_name'];
$to =
'cia@cia.vc';
$subject =
'DeliverXML';
$user =
$this->
GetUserName();
$href =
$this->
Href('',
$this->
tag);
$xml = <<<EOT
<message>
<generator>
<name>WikkaWiki custom mod</name>
<version>
0.
01<version>
</generator>
<source>
<project>
$project_name</project>
</source>
<body>
<commit>
<log>Page modified:
$href</log>
<url>http:
//your-wiki-site-URL/$this->tag</url>
<author>
$user</author>
</commit>
</body>
</message>
EOT;
mail($to,
$subject,
$xml);
}
- In handlers/processcomment/processcomment.php, search for the call to SaveComment(). Immediately after this code, insert the following code segment, providing your wiki URL where specified:
// Notify CIA bot if config param is set
if(isset($this->
config['cia_bot_project_name']))
{
$project_name =
$this->
config['cia_bot_project_name'];
$to =
'cia@cia.vc';
$subject =
'DeliverXML';
$user =
$this->
GetUserName();
$href =
$this->
Href('',
$this->
tag);
$xml = <<<EOT
<message>
<generator>
<name>WikkaWiki custom mod</name>
<version>
0.
01<version>
</generator>
<source>
<project>
$project_name</project>
</source>
<body>
<commit>
<log>Comment modified:
$href</log>
<url>http:
//your-wiki-site-URL/$this->tag</url>
<author>
$user</author>
</commit>
</body>
</message>
EOT;
mail($to,
$subject,
$xml);
}