“Project:扩展维护”的版本间差异

来自Kanade
 
(未显示同一用户的10个中间版本)
第1行: 第1行:
 
== Parsoid ==
 
== Parsoid ==
 
* 要使得'''Parsoid'''在LNMP 1.7环境安装包下顺利使用可视化编辑功能需要进行如下修改:
 
* 要使得'''Parsoid'''在LNMP 1.7环境安装包下顺利使用可视化编辑功能需要进行如下修改:
# 注释掉<code>/usr/local/nginx/conf/enable-php.conf</code>中的<code>#try_files $uri =404;</code>;
+
# <s>注释掉<code>/usr/local/nginx/conf/enable-php.conf</code>中的<code>#try_files $uri =404;</code>;</s>
 
# 注释掉<code>/usr/local/php/etc/php.ini</code>中的<code>; cgi.fix_pathinfo=0</code>;
 
# 注释掉<code>/usr/local/php/etc/php.ini</code>中的<code>; cgi.fix_pathinfo=0</code>;
 
# 与数据库无关,重启nginx和php-fpm即可。
 
# 与数据库无关,重启nginx和php-fpm即可。
 +
== Extension:CentralAuth ==
 +
; 注意:以下方法仅在MW 1.19、1.23、1.27 测试成功,现在仅供参考。
 +
=== 使用共享数据库 ===
 +
* 简单使用共享数据库建立多Wiki,见下方。
 +
* 关于多Wiki测试的总结:
 +
*# 最初目的是[[mediawikiwiki:Manual:Wiki_family#Giant switch statement]],但随后转变为[[mediawikiwiki:Manual:Wiki_family#Multiple wikis sharing common resources]](创建一个文件共享库)。<br />但遵循该章节文件库操作会出现“生成缩略图出错:无法找到文件”的错误提示,转而替代使用通用操作:[[mediawikiwiki:Manual:$wgForeignFileRepos#Using_files_from_Wikimedia_Commons_:_ForeignAPIRepo]]。<br />同时对于[[mediawikiwiki:Extension:GlobalUsage]]的安装止步于第三项数据库更新操作。
 +
*# 初始目的是[[mediawikiwiki:Extension:CentralAuth]],然而随后放弃研究这种高深莫测的安装文档,随之使用[[mediawikiwiki:Manual:Shared_database]]。<br />不过单纯这样进行操作时,所有的日志只会在所进行操作的wiki上留下记录。相关配置如下:
 +
{|
 +
|-
 +
| <syntaxhighlight lang="php">
 +
$wgDBtype = "mysql";
 +
$wgDBserver = "localhost";
 +
$wgDBname = "wiki_wiki"; # 所在的数据库
 +
$wgDBuser = "wiki"; # 用户被授予对以wiki_开头的数据库进行操作权限
 +
$wgDBpassword = "(hidden)";
 +
$wgSharedDB = 'wiki_www'; # 所共享的数据库
 +
$wgSharedPrefix = 'www_'; # 共享数据表前缀
 +
# ↓必须勾选记住我的登录状态,否则打开另一个wiki后之前的账号自动退出
 +
$wgCookieDomain = ".example.org";
 +
# 默认开启表'user', 'user_properties'的共享(同一账号登录所有wiki)
 +
$wgSharedTables[] = 'ipblocks'; # 共享封禁表(伪全域封禁)
 +
$wgSharedTables[] = 'interwiki'; # 共享跨维基表
 +
</syntaxhighlight>
 +
|}
 +
 +
=== 使用CentralAuth ===
 +
* 使用[[mw:Extension:CentralAuth|CentralAuth]]建立多Wiki并启用SSO单点登录(基于[[mw:Extension:CentralAuth/Walkthrough|Walkthrough]]归纳):
 +
** 下载CentralAuth,拷贝至每个Wiki的扩展目录。
 +
** 在LocalSettings.php中添加以下内容,并做相应修改。
 +
<div class="mw-collapsible mw-collapsed">
 +
<syntaxhighlight lang="php">
 +
# Database Settings
 +
$wgMainCacheType = CACHE_DB;
 +
$wgSharedDB    = 'mw_foowiki';
 +
$wgSharedTables = array( 'objectcache' );
 +
require_once ("$IP/extensions/CentralAuth/CentralAuth.php"); //require the extension, pretty self-explanatory
 +
 +
# General CentralAuth configuration
 +
$wgCentralAuthAutoNew = true;
 +
$wgCentralAuthDatabase = 'mw_foowiki'; // default is 'centralauth'
 +
$wgCentralAuthAutoMigrate = true;
 +
#$wgCentralAuthCookieDomain = '';
 +
 +
# Create the local account on pageview, set false to require a local login to create it.
 +
$wgCentralAuthCreateOnView = true;
 +
 +
# Skips the "login success" page
 +
$wgCentralAuthSilentLogin = true;
 +
 +
# Deprecated, will be removed soon.
 +
$wgCentralAuthUseOldAutoLogin = false;
 +
 +
$wgCentralAuthDryRun = false;
 +
    # unset( $wgGroupPermissions['*']['centralauth-merge'] );
 +
    # $wgGroupPermissions['sysop']['centralauth-merge'] = true;
 +
 +
// You can't just set wgConf values to the globals defined in Setup.php for your
 +
// local wiki, because it hasn't run yet.  You could hard-code $wgConf settings
 +
// here, but instead we set the wgConf values in a hook that runs later.
 +
 +
$wgConf = new SiteConfiguration;
 +
 +
# Read wiki lists
 +
 +
$wgLocalDatabases = array( 'mw_foowiki', 'mw_barwiki', 'mw_quxwiki', 'mw_logwiki' ); //all wiki databases, as an array. Important to change.
 +
 +
$wgConf->wikis = $wgLocalDatabases;
 +
$wgConf->suffixes = array(
 +
        'wiki'
 +
); //We have the same suffix of wiki
 +
//all databases have suffix wiki
 +
$wgConf->suffixes = $wgLocalDatabases;
 +
 +
$wgConf->localVHosts = array( 'localhost' ); //your database server. could be example.com or IP address. no http://
 +
 +
$wgConf->siteParamsCallback = 'efGetSiteParams';
 +
$wgConf->extractAllGlobals( $wgDBname );
 +
 +
 +
$wgConf->settings = array(
 +
 +
'wgServer' => array(
 +
    'mw_foowiki' => '//www.example.org', //default means applied to all wikis. We want our location to be http://localhost/(wiki). If your wikis are hosted on different domains, then you would override this, but let's keep it simple
 +
    'mw_barwiki' => '//pool.example.org',
 +
    'mw_quxwiki' => '//test.example.org',
 +
    'mw_logwiki' => '//login.example.org',
 +
),
 +
 +
'wgCanonicalServer' => array(
 +
    'mw_foowiki' => 'http://www.example.org', //default means applied to all wikis. We want our location to be http://localhost/(wiki). If your wikis are hosted on different domains, then you would override this, but let's keep it simple
 +
    'mw_barwiki' => 'http://pool.example.org',
 +
    'mw_quxwiki' => 'http://test.example.org',
 +
    'mw_logwiki' => 'http://login.example.org',
 +
),
 +
 +
'wgScriptPath' => array(
 +
    'default' => '/', //script path, where index.php is located for meta
 +
),
 +
 +
'wgArticlePath' => array(
 +
    'default' => '/index.php?title=$1', //for short urls
 +
),
 +
 +
//IF IT'S NOT WORKING
 +
//keep articlepath the same as scriptpath, with /$1 at the end. So for test_wiki it would be /testwiki and /testwiki/$1
 +
 +
'wgLanguageCode' => array( //dont change, if all wikis are english *BE careful not to alter this line if you use RegEx to replace COD with your wiki name!
 +
    'default' => '$lang',
 +
),
 +
 +
'wgLocalInterwiki' => array(
 +
    'default' => '$lang',
 +
),
 +
);
 +
 +
function efGetSiteParams( $conf, $wiki ) {
 +
    $site = null;
 +
    $lang = null;
 +
    foreach( $conf->suffixes as $suffix ) {
 +
        if ( substr( $wiki, -strlen( $suffix ) ) == $suffix ) {
 +
            $site = $suffix;
 +
            $lang = substr( $wiki, 0, -strlen( $suffix ) );
 +
            break;
 +
        }
 +
    }
 +
    return array(
 +
        'suffix' => $site,
 +
        'lang' => $lang,
 +
        'params' => array(
 +
            'lang' => $lang,
 +
            'site' => $site,
 +
            'wiki' => $wiki,
 +
        ),
 +
        'tags' => array(),
 +
    );
 +
}
 +
$wgCentralAuthCookies = true;
 +
$wgCentralAuthCookieDomain = '.example.org';
 +
$wgCentralAuthAutoLoginWikis = array(
 +
'www.example.org' => 'mw_foowiki',
 +
'pool.example.org' => 'mw_barwiki',
 +
'test.example.org' => 'mw_quxwiki',
 +
// 'login.example.org' => 'mw_logwiki',
 +
);
 +
# Activates the redirect to the "central login wiki"
 +
$wgCentralAuthLoginWiki = 'mw_logwiki';
 +
</syntaxhighlight>
 +
</div>
 +
** 将扩展目录下的centralauth.sql导入中央Wiki所在的数据库,并执行以下语句:<br />
 +
<syntaxhighlight lang="sql">
 +
INSERT INTO global_group_permissions (ggp_group,ggp_permission) VALUES ('steward','globalgrouppermissions'),('steward','globalgroupmembership');
 +
</syntaxhighlight>
 +
** 执行扩展目录中的<code>php migratePass0.php</code>、<code>php migratePass1.php</code>、<code>php migrateStewards.php</code>。<br />其中前两个命令也可以通过访问[[Special:MergeAccount]]完成。第三个命令需要先授予自己steward身份,然后在终端中运行,成功执行后该账户将变成全域steward。
 +
** 若需要禁用行政员授予他人steward权限,以下为示例。
 +
<div class="mw-collapsible mw-collapsed">
 +
<syntaxhighlight lang="php">
 +
$wgGroupPermissions['bureaucrat']['userrights'] = false;
 +
$wgAddGroups['bureaucrat'] = array( 'sysop', 'bot', 'bureaucrat', 'developer', 'observer', 'oversight', 'autopatroller' );
 +
$wgRemoveGroups['bureaucrat'] = array( 'sysop', 'bot', 'bureaucrat', 'developer', 'observer', 'oversight', 'autopatroller' );
 +
</syntaxhighlight>
 +
</div>
 +
** 至此安装已经完成。
 +
 
== Extension:CheckUser ==
 
== Extension:CheckUser ==
 +
===缺少useragent报错===
 
注释掉<code>/home/wwwroot/default/mw/extensions/CheckUser/src/TimelineRowFormatter.php</code>中的第99行<code>//'userAgent' => $this->getUserAgent( $row->cuc_agent ),</code>(该行报错)后[[Special:Investigate]]中可以使用Timeline功能,但缺少'''useragent'''信息项。
 
注释掉<code>/home/wwwroot/default/mw/extensions/CheckUser/src/TimelineRowFormatter.php</code>中的第99行<code>//'userAgent' => $this->getUserAgent( $row->cuc_agent ),</code>(该行报错)后[[Special:Investigate]]中可以使用Timeline功能,但缺少'''useragent'''信息项。
 
*# 猜想1:因为不是一开始就安装了Checkuser,所有有一部分信息出现了缺失(空值),而代码未对空置进行过滤而导致问题。
 
*# 猜想1:因为不是一开始就安装了Checkuser,所有有一部分信息出现了缺失(空值),而代码未对空置进行过滤而导致问题。
第17行: 第181行:
 
文件:Timeline tab.png|正常该显示的效果
 
文件:Timeline tab.png|正常该显示的效果
 
文件:新用户的CheckUser核查界面.PNG|新用户可以在不注释代码时进行操作
 
文件:新用户的CheckUser核查界面.PNG|新用户可以在不注释代码时进行操作
 +
</gallery>
 +
===特殊页面Investigate ===
 +
新的特殊页面带来了新的特性,当用户拥有<code>investigate</code>权限后特殊页面会以[[Special:InvestigateBlock]]替代[[Special:Block]]页面。但原先页面依旧可用,只是隐藏了入口。现在的处理方式是分离该权限,仅在需要时使用。
 +
 +
详细说明可以参阅[[metawikimedia:Help:Special Investigate#Blocking:|Blocking]]章节。
 +
<gallery>
 +
Wikia Block user.PNG | 旧封禁页面
 +
Special InvestigateBlock page screenshot.png | 新封禁页面
 
</gallery>
 
</gallery>
  
第50行: 第222行:
 
$wgPdftoText = '/usr/bin/pdftotext';
 
$wgPdftoText = '/usr/bin/pdftotext';
 
</syntaxhighlight>
 
</syntaxhighlight>
== Semantic MediaWiki ==
+
* 在迁移时发现<code>pdfinfo pdftotext</code>不安装亦可正常使用。
在使用新版本Composer更新SMW时,Composer会提示报错<code> Package::setProvides must be called with a map of lowercased package name.</code>。目前找到的解决方法是使用旧版Composer(如版本2.1.14)进行更新。<ref>[https://sourceforge.net/p/semediawiki/mailman/message/37408313/ <nowiki>[Semediawiki-user]</nowiki>Problem installing SMW: composer complains about lowercased package names]</ref>
+
== Extension:Semantic MediaWiki ==
 +
在使用新版本Composer更新SMW时,Composer会提示报错<code> Package::setProvides must be called with a map of lowercased package name.</code>。目前找到的解决方法是使用旧版Composer(如版本2.1.14)进行更新。<ref>[https://sourceforge.net/p/semediawiki/mailman/message/37408313/ <nowiki>[Semediawiki-user]Problem installing SMW: composer complains about lowercased package names</nowiki>]</ref>如果遇到莫名其妙的包 冲突/丢失 的问题,可以尝试更换composer的源。
 +
<references />
 +
== Extension:VisualEditor ==
 +
; 此章节仅针对旧版VisualEditor,新版MediaWiki(1.35版本起)已内置相关组件无需额外安装。
 +
* [[mw:Extension:VisualEditor|Extension:VisualEditor]]根据章节[[mw:Extension:VisualEditor#Linking_with_Parsoid_in_private_wikis|Linking with Parsoid in private wikis]],添加了[[mw:Talk:Parsoid/Archive#Installing_on_a_private_wiki|Installing on a private wiki]]中的内容,使其在本Wiki下可用。
 +
* 本Wiki目前已使用[[mw:Extension:NetworkAuth|Extension:NetworkAuth]],对于来自Parsoid的访问进行自动登录,相关配置如下:
 +
<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang="php">
 +
//弃用的配置
 +
if ( $_SERVER['REMOTE_ADDR'] == 'SERVER-IP' ) {
 +
$wgGroupPermissions['*']['read'] = true;
 +
$wgGroupPermissions['*']['edit'] = true;
 +
}
 +
//启用的配置
 +
require_once "$IP/extensions/NetworkAuth/NetworkAuth.php";
 +
$wgNetworkAuthUsers[] = [
 +
'iprange' => [ 'SERVER-IP',
 +
                '127.0.0.1' ],
 +
'user'    => 'Aria-bot',
 +
];
 +
</syntaxhighlight></div>
 +
 
 +
* Parsoid服务的单服务器多站点的示例配置内容(位于<code>/etc/mediawiki/parsoid/config.yaml</code>)建议拷贝源代码:
 +
<div class="mw-collapsible mw-collapsed"><syntaxhighlight lang="yaml">
 +
worker_heartbeat_timeout: 300000
 +
 
 +
logging:
 +
    level: info
 +
 
 +
services:
 +
  - module: ../src/lib/index.js
 +
    entrypoint: apiServiceWorker
 +
    conf:
 +
        mwApis:
 +
        - # 1st
 +
          uri: 'http://www.kanade.win/api.php'
 +
          domain: 'www.kanade.win' 
 +
        - # 2nd
 +
          uri: 'http://pool.kanade.win/api.php'
 +
          domain: 'pool.kanade.win' 
 +
        - # 3rd
 +
          uri: 'http://test.kanade.win/api.php'
 +
          domain: 'test.kanade.win' 
 +
 
 +
</syntaxhighlight></div>
 +
== 其他 ==
 +
 
 +
==== 语言 ====
 +
设置界面语言时,用户语言 要与 维基使用语言 保持一致;即便是相似的简体中文,其计算机编码也可能是不一样额。
 +
目前这两个选项在配置文件中设置成一样的,也隐藏了前台的修改选项。

2023年2月26日 (日) 23:21的最新版本

Parsoid

  • 要使得Parsoid在LNMP 1.7环境安装包下顺利使用可视化编辑功能需要进行如下修改:
  1. 注释掉/usr/local/nginx/conf/enable-php.conf中的#try_files $uri =404;
  2. 注释掉/usr/local/php/etc/php.ini中的; cgi.fix_pathinfo=0
  3. 与数据库无关,重启nginx和php-fpm即可。

Extension:CentralAuth

注意:以下方法仅在MW 1.19、1.23、1.27 测试成功,现在仅供参考。

使用共享数据库

$wgDBtype = "mysql";
$wgDBserver = "localhost";
$wgDBname = "wiki_wiki"; # 所在的数据库
$wgDBuser = "wiki"; # 用户被授予对以wiki_开头的数据库进行操作权限
$wgDBpassword = "(hidden)";
$wgSharedDB = 'wiki_www'; # 所共享的数据库
$wgSharedPrefix = 'www_'; # 共享数据表前缀
# ↓必须勾选记住我的登录状态,否则打开另一个wiki后之前的账号自动退出
$wgCookieDomain = ".example.org"; 
# 默认开启表'user', 'user_properties'的共享(同一账号登录所有wiki)
$wgSharedTables[] = 'ipblocks'; # 共享封禁表(伪全域封禁)
$wgSharedTables[] = 'interwiki'; # 共享跨维基表

使用CentralAuth

  • 使用CentralAuth建立多Wiki并启用SSO单点登录(基于Walkthrough归纳):
    • 下载CentralAuth,拷贝至每个Wiki的扩展目录。
    • 在LocalSettings.php中添加以下内容,并做相应修改。
# Database Settings
$wgMainCacheType = CACHE_DB;
$wgSharedDB     = 'mw_foowiki'; 
$wgSharedTables = array( 'objectcache' );
require_once ("$IP/extensions/CentralAuth/CentralAuth.php"); //require the extension, pretty self-explanatory

# General CentralAuth configuration
$wgCentralAuthAutoNew = true;
$wgCentralAuthDatabase = 'mw_foowiki'; // default is 'centralauth'
$wgCentralAuthAutoMigrate = true;
#$wgCentralAuthCookieDomain = '';
 
# Create the local account on pageview, set false to require a local login to create it.
$wgCentralAuthCreateOnView = true;
 
# Skips the "login success" page
$wgCentralAuthSilentLogin = true;
 
# Deprecated, will be removed soon.
$wgCentralAuthUseOldAutoLogin = false;

$wgCentralAuthDryRun = false;
    # unset( $wgGroupPermissions['*']['centralauth-merge'] );
    # $wgGroupPermissions['sysop']['centralauth-merge'] = true;
 
// You can't just set wgConf values to the globals defined in Setup.php for your
// local wiki, because it hasn't run yet.  You could hard-code $wgConf settings
// here, but instead we set the wgConf values in a hook that runs later.

$wgConf = new SiteConfiguration;
 
# Read wiki lists
 
$wgLocalDatabases = array( 'mw_foowiki', 'mw_barwiki', 'mw_quxwiki', 'mw_logwiki' ); //all wiki databases, as an array. Important to change.

$wgConf->wikis = $wgLocalDatabases;
$wgConf->suffixes = array(
        'wiki'
); //We have the same suffix of wiki
//all databases have suffix wiki
$wgConf->suffixes = $wgLocalDatabases;
 
$wgConf->localVHosts = array( 'localhost' ); //your database server. could be example.com or IP address. no http://
 
$wgConf->siteParamsCallback = 'efGetSiteParams';
$wgConf->extractAllGlobals( $wgDBname );

 
$wgConf->settings = array(
 
'wgServer' => array(
    'mw_foowiki' => '//www.example.org', //default means applied to all wikis. We want our location to be http://localhost/(wiki). If your wikis are hosted on different domains, then you would override this, but let's keep it simple
    'mw_barwiki' => '//pool.example.org', 
    'mw_quxwiki' => '//test.example.org', 
    'mw_logwiki' => '//login.example.org', 
),
 
'wgCanonicalServer' => array(
    'mw_foowiki' => 'http://www.example.org', //default means applied to all wikis. We want our location to be http://localhost/(wiki). If your wikis are hosted on different domains, then you would override this, but let's keep it simple
    'mw_barwiki' => 'http://pool.example.org', 
    'mw_quxwiki' => 'http://test.example.org', 
    'mw_logwiki' => 'http://login.example.org', 
),

'wgScriptPath' => array(
    'default' => '/', //script path, where index.php is located for meta
),
 
'wgArticlePath' => array(
    'default' => '/index.php?title=$1', //for short urls
),

//IF IT'S NOT WORKING
//keep articlepath the same as scriptpath, with /$1 at the end. So for test_wiki it would be /testwiki and /testwiki/$1
 
'wgLanguageCode' => array( //dont change, if all wikis are english *BE careful not to alter this line if you use RegEx to replace COD with your wiki name!
    'default' => '$lang',
),
 
'wgLocalInterwiki' => array(
    'default' => '$lang',
),
);
 
function efGetSiteParams( $conf, $wiki ) {
    $site = null;
    $lang = null;
    foreach( $conf->suffixes as $suffix ) {
        if ( substr( $wiki, -strlen( $suffix ) ) == $suffix ) {
            $site = $suffix;
            $lang = substr( $wiki, 0, -strlen( $suffix ) );
            break;
        }
    }
    return array(
        'suffix' => $site,
        'lang' => $lang,
        'params' => array(
            'lang' => $lang,
            'site' => $site,
            'wiki' => $wiki,
        ),
        'tags' => array(),
    );
}
$wgCentralAuthCookies = true;
$wgCentralAuthCookieDomain = '.example.org';
$wgCentralAuthAutoLoginWikis = array(
	'www.example.org' => 'mw_foowiki',
	'pool.example.org' => 'mw_barwiki',
	'test.example.org' => 'mw_quxwiki',
//	'login.example.org' => 'mw_logwiki',
);
# Activates the redirect to the "central login wiki"
$wgCentralAuthLoginWiki = 'mw_logwiki';
    • 将扩展目录下的centralauth.sql导入中央Wiki所在的数据库,并执行以下语句:
INSERT INTO global_group_permissions (ggp_group,ggp_permission) VALUES ('steward','globalgrouppermissions'),('steward','globalgroupmembership');
    • 执行扩展目录中的php migratePass0.phpphp migratePass1.phpphp migrateStewards.php
      其中前两个命令也可以通过访问Special:MergeAccount完成。第三个命令需要先授予自己steward身份,然后在终端中运行,成功执行后该账户将变成全域steward。
    • 若需要禁用行政员授予他人steward权限,以下为示例。
$wgGroupPermissions['bureaucrat']['userrights'] = false;
$wgAddGroups['bureaucrat'] = array( 'sysop', 'bot', 'bureaucrat', 'developer', 'observer', 'oversight', 'autopatroller' );
$wgRemoveGroups['bureaucrat'] = array( 'sysop', 'bot', 'bureaucrat', 'developer', 'observer', 'oversight', 'autopatroller' );
    • 至此安装已经完成。

Extension:CheckUser

缺少useragent报错

注释掉/home/wwwroot/default/mw/extensions/CheckUser/src/TimelineRowFormatter.php中的第99行//'userAgent' => $this->getUserAgent( $row->cuc_agent ),(该行报错)后Special:Investigate中可以使用Timeline功能,但缺少useragent信息项。

    1. 猜想1:因为不是一开始就安装了Checkuser,所有有一部分信息出现了缺失(空值),而代码未对空置进行过滤而导致问题。
    2. 猜想2:若随MediaWiki一同安装可能不会出现此问题。
    3. 猜想3:应该只影响CheckUser安装前的用户。
    • 结论: 对数据库中受影响的空值进行填充,可以得知: 历史记录是50项/页的,所以只要满足操作次数则可避免报错。

特殊页面Investigate

新的特殊页面带来了新的特性,当用户拥有investigate权限后特殊页面会以Special:InvestigateBlock替代Special:Block页面。但原先页面依旧可用,只是隐藏了入口。现在的处理方式是分离该权限,仅在需要时使用。

详细说明可以参阅Blocking章节。

Extension:Display Title

DisplayTitle被用于显示与页面名称不一样的标题。根据扩展说明页面,在1.5.3版本之后,所有与重定向相关的页面都会受到影响,例如:特殊:重定向页列表特殊:链入页面、重定向的页面。

原有的页面名称将显示为重定向目标页面的名称,与用户的直觉不符。解决方案是安装低版本扩展。

Extension:PdfHandler

PDFHandler是一个MediaWiki安装时捆绑的一个扩展,理解的用途是在文章中展示PDF页面。但是现代浏览器chrome类和firefox列都能够打开网页上的PDF文件,似乎也不是怎么的重要了。一般来说,这个扩展未经配置是无法展现PDF页面的,取而代之的是一个Logo。

要让该扩展正常使用首先需要apt安装which gs convert pdfinfo pdftotext。 在LocalSettings.php中的配置如下:

 1$wgFileExtensions[] = 'pdf';
 2$wgUseImageMagick = true;
 3wfLoadExtension( 'PdfHandler' );
 4# Ubuntu
 5$wgPdfProcessor = 'gs';
 6// if defined via ImageMagick
 7$wgPdfPostProcessor = $wgImageMagickConvertCommand; 
 8// if not defined via ImageMagick
 9// $wgPdfPostProcessor = 'convert'; 
10$wgPdfInfo = 'pdfinfo';
11$wgPdftoText = 'pdftotext';
12# Debian
13$wgPdfProcessor = '/usr/bin/gs'; 
14// if defined via ImageMagick
15$wgPdfPostProcessor = $wgImageMagickConvertCommand; 
16// if not defined via ImageMagick
17// $wgPdfPostProcessor = '/usr/bin/convert';  
18$wgPdfInfo = '/usr/bin/pdfinfo'; 
19$wgPdftoText = '/usr/bin/pdftotext';
  • 在迁移时发现pdfinfo pdftotext不安装亦可正常使用。

Extension:Semantic MediaWiki

在使用新版本Composer更新SMW时,Composer会提示报错 Package::setProvides must be called with a map of lowercased package name.。目前找到的解决方法是使用旧版Composer(如版本2.1.14)进行更新。[1]如果遇到莫名其妙的包 冲突/丢失 的问题,可以尝试更换composer的源。

Extension:VisualEditor

此章节仅针对旧版VisualEditor,新版MediaWiki(1.35版本起)已内置相关组件无需额外安装。
//弃用的配置
if ( $_SERVER['REMOTE_ADDR'] == 'SERVER-IP' ) {
 $wgGroupPermissions['*']['read'] = true;
 $wgGroupPermissions['*']['edit'] = true;
}
//启用的配置
require_once "$IP/extensions/NetworkAuth/NetworkAuth.php";
$wgNetworkAuthUsers[] = [
	'iprange' => [ 'SERVER-IP',
                 '127.0.0.1' ],
	'user'    => 'Aria-bot',
];
  • Parsoid服务的单服务器多站点的示例配置内容(位于/etc/mediawiki/parsoid/config.yaml)建议拷贝源代码:
worker_heartbeat_timeout: 300000

logging:
    level: info

services:
  - module: ../src/lib/index.js
    entrypoint: apiServiceWorker
    conf:
        mwApis:
        - # 1st
          uri: 'http://www.kanade.win/api.php'
          domain: 'www.kanade.win'  
        - # 2nd
          uri: 'http://pool.kanade.win/api.php'
          domain: 'pool.kanade.win'  
        - # 3rd
          uri: 'http://test.kanade.win/api.php'
          domain: 'test.kanade.win'

其他

语言

设置界面语言时,用户语言 要与 维基使用语言 保持一致;即便是相似的简体中文,其计算机编码也可能是不一样额。 目前这两个选项在配置文件中设置成一样的,也隐藏了前台的修改选项。