第4行: |
第4行: |
| # 注释掉<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,可参阅:[[Special:diff/2629]]。 |
| + | * 使用[[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 == |
| 注释掉<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'''信息项。 |
第55行: |
第195行: |
| <references /> | | <references /> |
| == Extension:VisualEditor == | | == Extension:VisualEditor == |
− | ; 此章节仅针对'''旧版VisualEditor''',新版MediaWiki(1.35版本起)已内置相关组件无需额外安装。 | + | ; 此章节仅针对旧版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下可用。 | | * [[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的访问进行自动登录,相关配置如下: | | * 本Wiki目前已使用[[mw:Extension:NetworkAuth|Extension:NetworkAuth]],对于来自Parsoid的访问进行自动登录,相关配置如下: |