parent
78708414f4
commit
0c97c218e6
@ -95,6 +95,26 @@ ark "antispam" do
|
|||||||
action :dump
|
action :dump
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# MediawikiHubot extension
|
||||||
|
# requires curl extension
|
||||||
|
package "php5-curl"
|
||||||
|
|
||||||
|
ark "MediawikiHubot" do
|
||||||
|
url "https://github.com/67P/mediawiki-hubot/archive/master.zip"
|
||||||
|
path "#{node['mediawiki']['webdir']}/extensions/MediawikiHubot"
|
||||||
|
creates "MediawikiHubot/MediawikiHubot.php"
|
||||||
|
action :cherry_pick
|
||||||
|
end
|
||||||
|
|
||||||
|
hal8000_freenode_data_bag_item = Chef::EncryptedDataBagItem.load('credentials', 'hal8000_freenode')
|
||||||
|
webhook_token = hal8000_freenode_data_bag_item['webhook_token']
|
||||||
|
|
||||||
|
template "#{node['mediawiki']['webdir']}/extensions/MediawikiHubot/DefaultConfig.php" do
|
||||||
|
source "MediawikiHubot/DefaultConfig.php.erb"
|
||||||
|
variables webhook_url: "http://localhost:8080/incoming/#{webhook_token}",
|
||||||
|
room_name: "#kosmos"
|
||||||
|
end
|
||||||
|
|
||||||
ruby_block "configuration" do
|
ruby_block "configuration" do
|
||||||
block do
|
block do
|
||||||
file = Chef::Util::FileEdit.new("#{node['mediawiki']['webdir']}/LocalSettings.php")
|
file = Chef::Util::FileEdit.new("#{node['mediawiki']['webdir']}/LocalSettings.php")
|
||||||
@ -136,6 +156,8 @@ $wgArticlePath = "/$1";
|
|||||||
"require_once \"$IP/extensions/Antispam/Antispam.php\";")
|
"require_once \"$IP/extensions/Antispam/Antispam.php\";")
|
||||||
file.insert_line_if_no_match(/wgCTAccessKey/,
|
file.insert_line_if_no_match(/wgCTAccessKey/,
|
||||||
"$wgCTAccessKey = \"#{mediawiki_credentials['antispam_key']}\";")
|
"$wgCTAccessKey = \"#{mediawiki_credentials['antispam_key']}\";")
|
||||||
|
file.insert_line_if_no_match(/MediawikiHubot\.php/,
|
||||||
|
"require_once \"$IP/extensions/MediawikiHubot/MediawikiHubot.php\";")
|
||||||
file.write_file
|
file.write_file
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
/**#@+
|
||||||
|
* This extension sends Webhook notifications to a hubot with the
|
||||||
|
* hubot-incoming-webhook plugin installed. This file contains configuration
|
||||||
|
* options for the extension.
|
||||||
|
*
|
||||||
|
* @ingroup Extensions
|
||||||
|
* @link https://github.com/67P/mediawiki-hubot
|
||||||
|
* @author Sebastian Kippe <sebastian@kip.pe>
|
||||||
|
* @copyright Copyright © Sebastian Kippe
|
||||||
|
* @license http://en.wikipedia.org/wiki/MIT_License MIT
|
||||||
|
*/
|
||||||
|
if(!defined('MEDIAWIKI')) die();
|
||||||
|
if (!isset($hpc_attached)) die();
|
||||||
|
###############################
|
||||||
|
# Hubot/Webhook configuration #
|
||||||
|
###############################
|
||||||
|
// Your Hubot incoming webhook URL. Learn more: https://github.com/67P/hubot-incoming-webhook
|
||||||
|
$wgHubotWebhookUrl = "<%= @webhook_url %>";
|
||||||
|
// Room/channel to post notifications to
|
||||||
|
$wgHubotRoomName = "<%= @room_name %>";
|
||||||
|
// Method for sending hooks. Can be "curl" or "file_get_contents". Defaults to "curl"
|
||||||
|
// Note: "curl" needs the curl extension to be enabled. "file_get_contents" needs "allow_url_fopen" to be enabled in php.ini
|
||||||
|
$wgHubotSendMethod = "curl";
|
||||||
|
##################
|
||||||
|
# MEDIAWIKI URLS #
|
||||||
|
##################
|
||||||
|
// REQUIRED
|
||||||
|
// URL of your MediaWiki installation incl. the trailing /.
|
||||||
|
$wgWikiUrl = "";
|
||||||
|
// Wiki script name. Leave this to default one if you do not have URL rewriting enabled.
|
||||||
|
$wgWikiUrlEnding = "index.php?title=";
|
||||||
|
// OPTIONAL
|
||||||
|
$wgWikiUrlEndingUserRights = "Special%3AUserRights&user=";
|
||||||
|
$wgWikiUrlEndingBlockUser = "Special:Block/";
|
||||||
|
$wgWikiUrlEndingUserPage = "User:";
|
||||||
|
$wgWikiUrlEndingUserTalkPage = "User_talk:";
|
||||||
|
$wgWikiUrlEndingUserContributions = "Special:Contributions/";
|
||||||
|
$wgWikiUrlEndingBlockList = "Special:BlockList";
|
||||||
|
$wgWikiUrlEndingEditArticle = "action=edit";
|
||||||
|
$wgWikiUrlEndingDeleteArticle = "action=delete";
|
||||||
|
$wgWikiUrlEndingHistory = "action=history";
|
||||||
|
#####################
|
||||||
|
# MEDIAWIKI ACTIONS #
|
||||||
|
#####################
|
||||||
|
// Set desired options to false to disable notifications of those actions.
|
||||||
|
// New user added
|
||||||
|
$wgHubotNewUser = true;
|
||||||
|
// Article added
|
||||||
|
$wgHubotAddedArticle = true;
|
||||||
|
// Article removed
|
||||||
|
$wgHubotRemovedArticle = true;
|
||||||
|
// Article moved to another title
|
||||||
|
$wgHubotMovedArticle = true;
|
||||||
|
// Article edited
|
||||||
|
$wgHubotEditedArticle = true;
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user