MediaWiki Extensions的那些坑

自动邮件服务

参考链接1
参考链接2

  • 安装MailNet_SMTPNet_Socket模块
  • 配置邮件服务器等信息(MediaWiki/include/DefaultSettings.php)
  • 配置管理员邮箱(MediaWiki/LocalSettings.php)
  • SELinux启用httpd_can_sendmail

编辑器插件(WYSIWYG)

MediaWiki 1.21下的设置
参考链接

我的设置:

//不使用WikiEditor
#require_once("$IP/extensions/WikiEditor/WikiEditor.php");
require_once("$IP/extensions/WYSIWYG/WYSIWYG.php");
$wgGroupPermissions['*']['wysiwyg'] = true;//Everyone can use (if can edit)...
$wgDefaultUserOptions['cke_show'] = 'richeditor';//Enable CKEditor
$wgDefaultUserOptions['riched_use_toggle'] = true;//Editor can toggle between CKEditor/WikiTextBox
//上面的链接里要求设置为false,但“取消”、“著作权”等链接会获取错误的url,
//故设置为true,即默认禁用,通过“富文本编辑器”来切换
$wgDefaultUserOptions['riched_start_disabled'] = true;//Important!!! else bug...
//不记录“富文本编辑器”的切换状态,即每次进入均显示默认编辑器
$wgDefaultUserOptions['riched_toggle_remember_state'] = false;//working/bug?)
$wgDefaultUserOptions['riched_use_popup'] = false;//Deprecated
$wgFCKEditorExcludedNamespaces[] = NS_MEDIAWIKI;
$wgFCKEditorExcludedNamespaces[] = NS_TEMPLATE;

文件上传

参考链接1
参考链接2

配置允许的文件格式

(MediaWiki/include/DefaultSettings.php)

$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'rar', 'zip', 'pdf');

添加PNG格式支持

(/etc/httpd/conf/magic)
在GIF和JPG文件的附近添加:

# PNG
0   string      PNG     image/png

启用文件上传

(MediaWiki/LocalSettings.php)

$wgEnableUploads = true;
//禁用上传脚本检查
$wgDisableUploadScriptChecks = true;

上传文件大小设置

(/usr/local/php/php.ini)

post_max_size=500M;
upload_max_filesize=500M;

(MediaWiki/include/LocalSettings.php)

$wgUploadSizeWarning = 524288000;//500M
$wgMaxUploadSize = 524288000;//500M

重新启动Apache

service httpd restart

语法高亮插件(SyntaxHighlight_GeSHi)

参考链接

syntaxhighlight标签无效,仍使用source标签(MediaWiki/extensions/WYSIWYG/CKeditorParser.body.php)

case 'source':

改为:

case 'syntaxhighlight':
case 'source':

插入代码段时,切换至默认编辑器,使用<source lang="csharp[代码语言]"></source>包围代码段

用户申请确认(ConfirmAccount)

参考链接

发送确认邮件时,出现错误SQL Error 1170: BLOB/TEXT column 'acr_email' used in key specification without a key length (localhost)
原因:在tinytext字段上建立索引时出错
解决方法:
1)删除account_requestsaccount_credentials两个表
2)修改ConfirmAccount.sql

account_requests acr_email tinytext NOT NULL,
account_credentials acd_email tinytext NOT NULL,

修改为

account_requests acr_email varchar(255) NOT NULL,
account_credentials acd_email varchar(255) NOT NULL,

3)重新导入ConfirmAccount.sql
在MediaWiki目录下运行php maintenance/update.php

URL短路径

参考链接

配置短路径

(MediaWiki/LocalSettings.php)

$wgScriptPath = "";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;

修改根目录下的.htaccess文件

<IfModule mod_rewrite.c>
## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache 
# Enable the rewrite engine
RewriteEngine On 
RewriteRule ^wiki/(.*)$ /index.php?title=$1 [PT,L,QSA]
# Short url for wiki pages
RewriteRule ^wiki/*$ /index.php [L,QSA]
# Redirect / to Main Page
RewriteRule ^/*$ /index.php [L,QSA]
</IfModule>




One thought on “MediaWiki Extensions的那些坑

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>