“安装MW:初始化配置”的版本间差异
(→更新) |
(→更新) |
||
第24行: | 第24行: | ||
(更新之前,维护一下“[[站点日志]]”,记录一下新版本的系统需求、特性,养成习惯) | (更新之前,维护一下“[[站点日志]]”,记录一下新版本的系统需求、特性,养成习惯) | ||
系统需求可以通过'''宝塔面板''' | * 系统需求可以通过'''宝塔面板'''完成。 | ||
*: 如:PHP 更新、PHP 插件安装(fileinfo、opcache、memcached、Intl)、禁用函数(proc_open、symlink),等。 | |||
=== 文件备份 === | === 文件备份 === |
2021年12月22日 (三) 01:37的版本
下载
关于新的MediaWiki文件下载:
- 可以在服务器安装git后直接拉取GitHub的相关项目分支GitHub的MediaWiki项目地址。但是对于服务器链接Github不方便的还是算了。
- 通过下载到各种方式(git、下载release包)到本地,再通过Xftp等工具上传到Server。如果不是服务器不能联网或要替换文件重新打包,则显得多余。
- 通过包的Linux的包管理工具拉取(
wget -P /www/wwwroot/ https://releases.wikimedia.org/mediawiki/1.35/mediawiki-1.35.0-rc.3.tar.gz
)。
关于获取MediaWiki的站点:
- GitHub:MediaWiki
- MediaWiki Releases
- MediaWiki消息站点:发布时间会早一点。
注意:
- 通过
git clone
或download code zip的时候,子模块可能不能下载下拉,需要git submodule update
或单独去download那些(对应分支)子模块的代码,子模块的信息在.gitmodules
文件中。 - 下载或拉取发布包,若为核心包(如:mediawiki-core-1.35.0-rc.3.tar.gz)则包内不包含扩展。
更新
注意: 更新:小版本的更新(如1.34.0 → 1.34.2),一般直接更新就可以了,不需要对服务器的基础支持相关进行安装或升级。 升级:大版本的升级(1.34.2 → 1.35.0),要注意新版本的系统需求(如:PHP版本、PHP插件等),以及“两个 LTS 之间的版本才能之间升级”(否则,需要升级到一个LTS,再升级到第二个LTS)。 (更新之前,维护一下“站点日志”,记录一下新版本的系统需求、特性,养成习惯)
- 系统需求可以通过宝塔面板完成。
- 如:PHP 更新、PHP 插件安装(fileinfo、opcache、memcached、Intl)、禁用函数(proc_open、symlink),等。
文件备份
包括:
- 配置文件:LocalSettings.php;
- 上传文件夹:/images文件夹;
- 扩展文件夹:/extensions;
- 部分扩展可能也需要更新(最好都重新下载更新一遍)。
- 修改过的内容;(如:includes/defaultSettings.php)
- 添加过的内容。(如:logo、skins[皮肤]、vendor[依赖] 等)
文件替换
步骤:
- 解压安装包:
tar -zxvf mediawiki-1.35.0-rc.2.tar.gz # 或 unzip mediawiki-REL1_35.zip -d /www/wwwroot/
- (把不需要的内容删除)
- 移除旧版本;
rm -rf wiki.eijux.com/
- (可以保留需要备份的内容)
- 安装文件替换:
# 移动 mv -f mediawiki-1.35.0-rc.2/* wiki.eijux.com/ # 复制 yes|cp -rf mediawiki-REL1_35/* wiki.eijux.com/
- 替换备份文件。
- 更新网站文件归属及读写权限:
# 文件归属者、组 chown -Rf www:www wiki.eijux.com/* # 文件权限 chmod -Rf 775 wiki.eijux.com/*
执行安装
访问安装页面:http://wiki.eijux.com/mw-config/index.php。
- 输入安装密钥(位于“LocalSettings.php”),完成安装过程;
文件替换之后,也能直接访问 MediaWiki,但是使用时(涉及查找的操作和页面)可能出现错误:![]()
升级
大版本的升级,如1.34.2 → 1.35.0,需要PHP7.3的支持(现用PHP7.2):
MediaWiki 1.35 internal error MediaWiki 1.35 requires at least PHP version 7.3.00; you are using PHP 7.2.33. Supported PHP versions Please consider upgrading your copy of PHP. PHP versions less than v7.3.0 are no longer supported by the PHP Group and will not receive security or bugfix updates. If for some reason you are unable to upgrade your PHP version, you will need to download an older version of MediaWiki from our website. See our compatibility page for details of which versions are compatible with prior versions of PHP.
站点利用宝塔面板,可以很方便的安装PHP7.3,完成后需在网站设置中切换PHP版本;
并需安装PHP扩展fileinfo
、opcache
、memcached
,禁用函数proc_open
、symlink
等。
问题
站点路径的问题:
站点目录结构的不同,则配置文件的$wgScriptPath
配置不同,网站的访问路径不同:
- 如果站点目录为
"/www/wwwroot/wiki.eijux.com/wiki"
:- LocalSettings.PHP的配置为:
$wgScriptPath = ""
; - 网站的访问路径为:
http://wiki.eijux.com/index.php?title=%E9%A6%96%E9%A1%B5
- LocalSettings.PHP的配置为:
- 如果站点目录为
"/www/wwwroot/wiki.eijux.com/wiki"
:- LocalSettings.PHP的配置为:
$wgScriptPath = "/wiki"
; - 网站的访问路径为:
http://wiki.eijux.com/wiki/index.php?title=%E9%A6%96%E9%A1%B5
- LocalSettings.PHP的配置为:
从“mediawiki-1.34.2”升级到“mediawiki-1.35.0-rc.3”时,VisualEditor扩展的问题:
1.35.0版本之前,VisualEditor需要Parsoid/Js的支持,不仅需要单独安装独立运行的Parsoid服务,还需要Nodejs、NPM等基础包。而1.35.0版本之后,Parsoid/Js被以PHP语言重写并集成到MediaWiki内(Parsoid/PHP),所以,不需要任何额外的安装,仅需要修改LocalSettings.php
以加载和设置VirsualEditor扩展。
“mediawiki-1.35.0-rc.3.tar.gz”安装包的问题
本次使用mediawiki-1.35.0-rc.3.tar.gz
安装到服务器之后,通过比较服务器安装目录/www/wwwroot/wiki.eijux.com/vendor/wikimedia/parsoid
和git项目Paroid目录,发现在服务器"/www/wwwroot/wiki.eijux.com/vendor/wikimedia/parsoid"下缺少"lib
"文件夹。故而单独拉取Paroid项目的"lib
"文件夹上传到服务器,并修改其所有者和读写权限(单独拉取Paroid项目"git clone https://github.com/wikimedia/parsoid.git D:\Documents\GitHub\parsoid",才能得到"lib"文件夹,其他git拉取Mediawiki的Paroid子模块、下载rc预览包(通过composer.json
自动下载)等方式均无"lib")。
使用VisualEditor时,只需要加载和设置VisualEditor即可,不需要Parsoid
、RESTBase
的加载和设置,不需要额外安装Node.js
。
- 备注
- 【2020/09/06 17:52:09】点击“编辑”之后无报错即可。如果没反应等待稍后再试(可能是Parsoid等某服务加载延迟?)目前能正常显示VisualEditor页面,并加载内容。
- 【2020/09/06 17:58:45】但在VisualEditor中保存内容时,出现“服务器没有在预期时间内响应。”,还不知道具体情况,
只知道和修改页面内容多少无关。 - 【2020/09/06 18:01:22】“计算您的更改花费了太长时间,因此下方的描述可能并不理想。”真他娘和页面内容多少有关,太多的东西还是用WikiEditor改吧。坑!
- 【2020/09/06 18:03:38】又他妈能使了……
- 【2020/09/07 13:56:20】真香……编辑表格的可视化真香,但是编辑文本会添加很多格式标签,不如WikiEditor香。
- 【2020/09/06 17:52:09】点击“编辑”之后无报错即可。如果没反应等待稍后再试(可能是Parsoid等某服务加载延迟?)目前能正常显示VisualEditor页面,并加载内容。
Error contacting the Parsoid/RESTBase server (HTTP 500)
- 1.34:配置错误。
- 1.35:依赖的Parsoid文件内容缺失?,对比服务器路径
/www/wwwroot/wiki.eijux.com/vendor/wikimedia/parsoid
和GitHub的内容。
Error contacting the Parsoid/RESTBase server (HTTP 404)
- 1.34:配置错误。
- 1.35:配置多余。
1.35.0-rc.3 的配置代码 =
wfLoadExtension( 'VisualEditor' ); # VisualEditor Settings # Enable by default for everybody $wgDefaultUserOptions['visualeditor-enable'] = 1; # Don't allow users to disable it $wgHiddenPrefs[] = 'visualeditor-enable'; # OPTIONAL: Enable VisualEditor's experimental code features #$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1; # OPTIONAL: Enable VisualEditor in other namespaces # (By default, VE is only enabled in NS_MAIN) #$wgVisualEditorNamespaces[] = NS_USER;
尝试过的配置代码1,参考官网Parsoid/PHP页面
## Parsoid required configuration AutoLoader::$psr4Namespaces += [ 'Wikimedia\\Parsoid\\' => 'vendor/wikimedia/parsoid/src', ]; # Make sure exists of this line, if you want to use VE: wfLoadExtension('Parsoid','vendor/wikimedia/parsoid/extension.json'); # Enable Parsoid $wgEnableRestAPI = true; $wgParsoidSettings = [ 'useSelser' => true, 'rtTestMode' => false, 'linting' => false, ]; ## Enable VisualEditor wfLoadExtension('VisualEditor'); # Enable by default for everybody $wgDefaultUserOptions['visualeditor-enable'] = 1; #Optional: Set VisualEditor as the default for anonymous users # otherwise they will have to switch to VE $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor"; # Don't allow users to disable it #$wgHiddenPrefs[] = 'visualeditor-enable'; # OPTIONAL: Enable VisualEditor's experimental code features $wgVisualEditorEnableExperimentalCode = true; # OPTIONAL: Enable VisualEditor in other namespaces # (By default, VE is only enabled in NS_MAIN) $wgVisualEditorNamespaces[] = NS_USER; $wgVirtualRestConfig['modules']['parsoid'] = array( 'url' => $wgServer . $wgScriptPath . '/rest.php', 'domain' => $wgServer, 'prefix' => $wgServer ); $wgVirtualRestConfig['modules']['restbase'] = array( 'url' => $wgServer . $wgScriptPath . '/rest.php', 'domain' => $wgServer, 'forwardCookies' => false, 'parsoidCompat' => false ); $wgVisualEditorFullRestbaseURL = '$wgServer/$wgServer/';
尝试过的配置代码2,参考官网Parsoid页面#Linking a developer checkout of Parsoid
# Make sure exists of this line, if you want to use VE: wfLoadExtension('Parsoid', 'vendor/wikimedia/parsoid/extension.json'); # Enable Parsoid $wgVisualEditorParsoidAutoConfig = false; $wgParsoidSettings = [ 'useSelser' => true, 'rtTestMode' => false, 'linting' => false ]; # Enable VisualEditor wfLoadExtension('VisualEditor'); # $wgDefaultUserOptions['visualeditor-enable'] = 1; $wgVirtualRestConfig['modules']['parsoid'] = [ 'url' => $wgServer . $wgScriptPath . '/rest.php', 'domain' => $wgServer ]; # OPTIONAL: Enable VisualEditor's experimental code features $wgVisualEditorEnableExperimentalCode = true; # OPTIONAL: Enable VisualEditor in other namespaces # (By default, VE is only enabled in NS_MAIN) $wgVisualEditorNamespaces[] = NS_USER;