望见那地上的一棵草,那是大的无限.

帮助:系统:更新Mediawiki版本/补丁更新

来自森亮号航海见识 {SLboat Insight;}
跳转至: 导航搜索

补丁位于

  • 从首页进入-一般是放在News那里
JustCapIt6093.jpg
  • 找到详细的更新日志-里面有补丁的存在
JustCapIt6094.jpg

补丁库

有个专门的存放地
http://dumps.wikimedia.org/mediawiki/

想法

  • 系统文本有个专门的patch,那么用git来单独的管理那个目录是不是更可爱呢

todo

  • 变成变量的版本?
path_to=1.21.2

经验

更新主要补丁

  • 看起来补丁也可以用来更新,进入Mediawiki的w目录
cd ./{IP}/w/
  • 获得更新的补丁
使用wget来提取获得
像是这个1.23.1
[root@li84-236 w]# wget http://releases.wikimedia.org/mediawiki/1.23/mediawiki-1.23.1.patch.gz
--2014-06-28 21:24:05--  http://releases.wikimedia.org/mediawiki/1.23/mediawiki-1.23.1.patch.gz
Resolving releases.wikimedia.org... 208.80.154.241, 2620:0:861:ed1a::11
Connecting to releases.wikimedia.org|208.80.154.241|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3521 (3.4K) [application/x-gzip]
Saving to: `mediawiki-1.23.1.patch.gz'

100%[========================================================================>] 3,521       --.-K/s   in 0s      

2014-06-28 21:24:05 (158 MB/s) - `mediawiki-1.23.1.patch.gz' saved [3521/3521]
  • 解压它-只有gunzip可以使用
gunzip -v mediawiki-1.23.1.patch.gz
加上-v显示详细信息
[root@li84-236 w]# gunzip -v mediawiki-1.23.1.patch.gz 
mediawiki-1.23.1.patch.gz:       66.5% -- replaced with mediawiki-1.23.1.patch
  • 烤干它,看看会烤熟谁
patch -p1 --dry-run < mediawiki-1.22.2.patch
有趣的是一定要后面的[<],否则就是一直傻等着(它吸收输入)
有时候就会像是这样-这里可能是一个旧版本的信息
[root@li84-236 w]# patch -p1 --dry-run < mediawiki-1.23.1.patch

patching file includes/DefaultSettings.php
patching file includes/filebackend/FileBackendStore.php
patching file includes/filebackend/FileOpBatch.php
patching file includes/installer/LocalSettingsGenerator.php
patching file includes/MimeMagic.php
patching file includes/specials/SpecialWatchlist.php
patching file includes/upload/UploadBase.php
patching file RELEASE-NOTES-1.23
如果个别出现意外,手动复位它..就是下载完整安装包,提取个别文件,进行覆盖
  • 去除烤干,直接开始干活
[root@li84-236 w]# patch -p1 < mediawiki-1.23.1.patch
patching file includes/DefaultSettings.php
patching file includes/filebackend/FileBackendStore.php
patching file includes/filebackend/FileOpBatch.php
patching file includes/installer/LocalSettingsGenerator.php
patching file includes/MimeMagic.php
patching file includes/specials/SpecialWatchlist.php
patching file includes/upload/UploadBase.php
patching file RELEASE-NOTES-1.23
看上去应该跟烘干一样,这里简写
  • 它已经完成了,waho!
这个是早期版本的一个完成图
JustCapIt6097.jpg

更新消息文本

  • 有时候没有消息文本,就可以忽视它了
  • 这几乎是一样的过程,只是补丁更胖了
  • 这里是一个完整过程:从V1.20.4 -> V1.20.5
[root@li567-57 w]# wget http://download.wikimedia.org/mediawiki/1.20/mediawiki-i18n-1.20.5.patch.gz
--2013-05-07 12:06:12--  http://download.wikimedia.org/mediawiki/1.20/mediawiki-i18n-1.20.5.patch.gz
Resolving download.wikimedia.org... 208.80.152.185
Connecting to download.wikimedia.org|208.80.152.185|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://dumps.wikimedia.org/mediawiki/1.20/mediawiki-i18n-1.20.5.patch.gz [following]
--2013-05-07 12:06:13--  http://dumps.wikimedia.org/mediawiki/1.20/mediawiki-i18n-1.20.5.patch.gz
Resolving dumps.wikimedia.org... 208.80.152.185
Reusing existing connection to download.wikimedia.org:80.
HTTP request sent, awaiting response... 200 OK
Length: 1135814 (1.1M) [application/x-gzip]
Saving to: `mediawiki-i18n-1.20.5.patch.gz'

100%[======================================================================>] 1,135,814    599K/s   in 1.9s    

2013-05-07 12:06:15 (599 KB/s) - `mediawiki-i18n-1.20.5.patch.gz' saved [1135814/1135814]

[root@li567-57 w]# gunzip mediawiki-
mediawiki-1.20.5.patch          mediawiki-i18n-1.20.5.patch.gz  
[root@li567-57 w]# gunzip mediawiki-i18n-1.20.5.patch.gz 
[root@li567-57 w]# patch -p1 --dry-run < mediawiki-i18n-1.20.5.patch 
patching file languages/messages/MessagesAce.php
patching file languages/messages/MessagesAeb.php
patching file languages/messages/MessagesAf.php
patching file languages/messages/MessagesAln.php
patching file languages/messages/MessagesAm.php
patching file languages/messages/MessagesAng.php
patching file languages/messages/MessagesAn.php
patching file languages/messages/MessagesAnp.php
patching file languages/messages/MessagesArc.php
patching file languages/messages/MessagesArn.php
patching file languages/messages/MessagesAr.php
patching file languages/messages/MessagesAry.php
patching file languages/messages/MessagesArz.php
patching file languages/messages/MessagesAs.php
.....
[root@li567-57 w]# patch -p1 < mediawiki-i18n-1.20.5.patch           
patching file languages/messages/MessagesAce.php
patching file languages/messages/MessagesAeb.php
patching file languages/messages/MessagesAf.php
patching file languages/messages/MessagesAln.php
patching file languages/messages/MessagesAm.php
patching file languages/messages/MessagesAng.php
patching file languages/messages/MessagesAn.php
patching file languages/messages/MessagesAnp.php
patching file languages/messages/MessagesArc.php
patching file languages/messages/MessagesArn.php
patching file languages/messages/MessagesAr.php
patching file languages/messages/MessagesAry.php
patching file languages/messages/MessagesArz.php
patching file languages/messages/MessagesAs.php
.....

后续

  • 删除patch文件啥的
gunzip会自动删除gz,保留解压文件,这很有趣
  • 执行更新脚本
cd maintenance/
php update.php

意外们

  • 有些测试组件就可以忽略了了事
Hmm...  The next patch looks like a unified diff to me...
can't find file to patch at input line 387
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Nruw -x messages -x '*.png' -x '*.jpg' -x '*.xcf' -x '*.gif' -x '*.svg' -x '*.tiff' -x '*.zip' -x '*.xmp' -x '.git*' mediawiki-1.23.3/tests/phpunit/includes/upload/UploadBaseTest.php mediawiki-1.23.4/tests/phpunit/includes/upload/UploadBaseTest.php
|--- mediawiki-1.23.3/tests/phpunit/includes/upload/UploadBaseTest.php  2014-09-24 19:58:10.961599096 +0000
|+++ mediawiki-1.23.4/tests/phpunit/includes/upload/UploadBaseTest.php  2014-09-24 19:55:15.538575503 +0000
--------------------------
File to patch: 
Skip this patch? [y] y
Skipping patch.
Hunk #1 ignored at 129.
Hunk #2 ignored at 367.
2 out of 2 hunks ignored
done
  • 重打补丁?会进行一些奇怪的建议
[root@li576-236 w]# patch -p1 < mediawiki-1.21.2.patch 
patching file includes/api/ApiBlock.php
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] 
Skipping patch.
4 out of 4 hunks ignored -- saving rejects to file includes/api/ApiBlock.php.rej
patching file includes/api/ApiCreateAccount.php
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file includes/api/ApiCreateAccount.php.rej
patching file includes/api/ApiLogin.php
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file includes/api/ApiLogin.php.rej
patching file includes/api/ApiMain.php
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file includes/api/ApiMain.php.rej
patching file includes/api/ApiQueryDeletedrevs.php
Reversed (or previously applied) patch detected!  Assume -R? [n] q
Apply anyway? [n] :Q
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file includes/api/ApiQueryDeletedrevs.php.rej
patching file includes/api/ApiTokens.php
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] ^C
  • 个别文件不符合-会提示
[root@li576-236 w]# gunzip -v mediawiki-1.21.2.patch.gz 
mediawiki-1.21.2.patch.gz:       75.5% -- replaced with mediawiki-1.21.2.patch
[root@li576-236 w]# patch -p1 --dry-run < mediawiki-1.21.2.patch 
patching file includes/api/ApiBlock.php
patching file includes/api/ApiCreateAccount.php
patching file includes/api/ApiLogin.php
patching file includes/api/ApiMain.php
patching file includes/api/ApiQueryDeletedrevs.php
patching file includes/api/ApiTokens.php
patching file includes/api/ApiUnblock.php
patching file includes/DefaultSettings.php
patching file includes/filerepo/file/LocalFile.php
patching file includes/installer/Installer.php
patching file includes/installer/MysqlUpdater.php
patching file includes/installer/WebInstallerPage.php
patching file includes/libs/IEUrlExtension.php
patching file includes/resourceloader/ResourceLoader.php
patching file includes/revisiondelete/RevisionDelete.php
patching file RELEASE-NOTES-1.21
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file RELEASE-NOTES-1.21.rej
patching file tests/phpunit/includes/libs/IEUrlExtensionTest.php
patching file tests/phpunit/suite.xml
patching file tests/TestsAutoLoader.php
Hunk #1 FAILED at 47.
1 out of 1 hunk FAILED -- saving rejects to file tests/TestsAutoLoader.php.rej
它们还会实际性的产生一些文件呢
ClipCapIt-130905-182629.PNG
  • 有时候通配符也可以给patch干活哩!
Shell patch/通配符匹配补丁文件

历史补丁们

  • 看看它们有趣的变化

V1.20.5

[root@li567-57 w]# patch -p1 --dry-run < mediawiki-1.20.5.patch 
patching file docs/hooks.txt
patching file includes/DefaultSettings.php
patching file includes/GlobalFunctions.php
patching file includes/specials/SpecialChangePassword.php
patching file includes/upload/UploadBase.php
patching file maintenance/Doxyfile
patching file maintenance/language/messages.inc
patching file maintenance/mwdocgen.php
patching file RELEASE-NOTES-1.20
patching file resources/mediawiki/mediawiki.js
patching file tests/phpunit/languages/LanguageTest.php

有趣

  • 可以查看更详细方式的patch信息,是的!
[root@li84-236 w]# patch --verbose -p1 --dry-run < mediawiki-1.23.4.patch  
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nruw -x messages -x '*.png' -x '*.jpg' -x '*.xcf' -x '*.gif' -x '*.svg' -x '*.tiff' -x '*.zip' -x '*.xmp' -x '.git*' mediawiki-1.23.3/includes/config/GlobalVarConfig.php mediawiki-1.23.4/includes/config/GlobalVarConfig.php
|--- mediawiki-1.23.3/includes/config/GlobalVarConfig.php       2014-09-24 19:58:09.941581474 +0000
|+++ mediawiki-1.23.4/includes/config/GlobalVarConfig.php       2014-09-24 19:55:15.782579699 +0000
--------------------------
Patching file includes/config/GlobalVarConfig.php using Plan A...
Hunk #1 succeeded at 69.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nruw -x messages -x '*.png' -x '*.jpg' -x '*.xcf' -x '*.gif' -x '*.svg' -x '*.tiff' -x '*.zip' -x '*.xmp' -x '.git*' mediawiki-1.23.3/includes/db/DatabaseMysqli.php mediawiki-1.23.4/includes/db/DatabaseMysqli.php
|--- mediawiki-1.23.3/includes/db/DatabaseMysqli.php    2014-09-24 19:58:09.945581545 +0000
|+++ mediawiki-1.23.4/includes/db/DatabaseMysqli.php    2014-09-24 19:55:15.786579767 +0000
--------------------------
Patching file includes/db/DatabaseMysqli.php using Plan A...
Hunk #1 succeeded at 58.
Hunk #2 succeeded at 102.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nruw -x messages -x '*.png' -x '*.jpg' -x '*.xcf' -x '*.gif' -x '*.svg' -x '*.tiff' -x '*.zip' -x '*.xmp' -x '.git*' mediawiki-1.23.3/includes/DefaultSettings.php mediawiki-1.23.4/includes/DefaultSettings.php
|--- mediawiki-1.23.3/includes/DefaultSettings.php      2014-09-24 19:58:09.869580229 +0000
|+++ mediawiki-1.23.4/includes/DefaultSettings.php      2014-09-24 19:55:15.722578670 +0000
--------------------------
Patching file includes/DefaultSettings.php using Plan A...
Hunk #1 succeeded at 73.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nruw -x messages -x '*.png' -x '*.jpg' -x '*.xcf' -x '*.gif' -x '*.svg' -x '*.tiff' -x '*.zip' -x '*.xmp' -x '.git*' mediawiki-1.23.3/includes/libs/XmlTypeCheck.php mediawiki-1.23.4/includes/libs/XmlTypeCheck.php
|--- mediawiki-1.23.3/includes/libs/XmlTypeCheck.php    2014-09-24 19:58:10.033583064 +0000
|+++ mediawiki-1.23.4/includes/libs/XmlTypeCheck.php    2014-09-24 19:55:14.674560645 +0000
--------------------------
Patching file includes/libs/XmlTypeCheck.php using Plan A...
Hunk #1 succeeded at 40.
Hunk #2 succeeded at 68.
Hunk #3 succeeded at 196.
Hunk #4 succeeded at 215.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nruw -x messages -x '*.png' -x '*.jpg' -x '*.xcf' -x '*.gif' -x '*.svg' -x '*.tiff' -x '*.zip' -x '*.xmp' -x '.git*' mediawiki-1.23.3/includes/Sanitizer.php mediawiki-1.23.4/includes/Sanitizer.php
|--- mediawiki-1.23.3/includes/Sanitizer.php    2014-09-24 19:58:09.889580579 +0000
|+++ mediawiki-1.23.4/includes/Sanitizer.php    2014-09-24 19:55:15.738578942 +0000
--------------------------
Patching file includes/Sanitizer.php using Plan A...
Hunk #1 succeeded at 818.
Hunk #2 succeeded at 913.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nruw -x messages -x '*.png' -x '*.jpg' -x '*.xcf' -x '*.gif' -x '*.svg' -x '*.tiff' -x '*.zip' -x '*.xmp' -x '.git*' mediawiki-1.23.3/includes/upload/UploadBase.php mediawiki-1.23.4/includes/upload/UploadBase.php
|--- mediawiki-1.23.3/includes/upload/UploadBase.php    2014-09-24 19:58:10.089584032 +0000
|+++ mediawiki-1.23.4/includes/upload/UploadBase.php    2014-09-24 19:55:15.922582109 +0000
--------------------------
Patching file includes/upload/UploadBase.php using Plan A...
Hunk #1 succeeded at 1209.
Hunk #2 succeeded at 1283.
Hunk #3 succeeded at 1327.
Hunk #4 succeeded at 1364.
Hunk #5 succeeded at 1395.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nruw -x messages -x '*.png' -x '*.jpg' -x '*.xcf' -x '*.gif' -x '*.svg' -x '*.tiff' -x '*.zip' -x '*.xmp' -x '.git*' mediawiki-1.23.3/RELEASE-NOTES-1.23 mediawiki-1.23.4/RELEASE-NOTES-1.23
|--- mediawiki-1.23.3/RELEASE-NOTES-1.23        2014-09-24 19:58:09.857580026 +0000
|+++ mediawiki-1.23.4/RELEASE-NOTES-1.23        2014-09-24 19:55:15.714578531 +0000
--------------------------
Patching file RELEASE-NOTES-1.23 using Plan A...
Hunk #1 succeeded at 1.
Hmm...  The next patch looks like a unified diff to me...
can't find file to patch at input line 387
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Nruw -x messages -x '*.png' -x '*.jpg' -x '*.xcf' -x '*.gif' -x '*.svg' -x '*.tiff' -x '*.zip' -x '*.xmp' -x '.git*' mediawiki-1.23.3/tests/phpunit/includes/upload/UploadBaseTest.php mediawiki-1.23.4/tests/phpunit/includes/upload/UploadBaseTest.php
|--- mediawiki-1.23.3/tests/phpunit/includes/upload/UploadBaseTest.php  2014-09-24 19:58:10.961599096 +0000
|+++ mediawiki-1.23.4/tests/phpunit/includes/upload/UploadBaseTest.php  2014-09-24 19:55:15.538575503 +0000
--------------------------
File to patch: n
n: No such file or directory
Skip this patch? [y] y
Skipping patch.
Hunk #1 ignored at 129.
Hunk #2 ignored at 367.
2 out of 2 hunks ignored
done
  • 有些补丁是phptestunit有关,如果安装的时候没有带有,就无法补丁
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Nruw -x messages -x '*.png' -x '*.jpg' -x '*.xcf' -x '*.gif' -x '*.svg' -x '*.tiff' -x '*.zip' -x '*.xmp' -x '.git*' mediawiki-1.23.1/tests/phpunit/includes/api/format/ApiFormatJsonTest.php mediawiki-1.23.2/tests/phpunit/includes/api/format/ApiFormatJsonTest.php
|--- mediawiki-1.23.1/tests/phpunit/includes/api/format/ApiFormatJsonTest.php   2014-07-30 19:29:15.619144417 +0000
|+++ mediawiki-1.23.2/tests/phpunit/includes/api/format/ApiFormatJsonTest.php   2014-07-30 19:24:41.560514483 +0000
--------------------------
  • 有些补丁是没有多语言文本的,可能只是安全补丁
ClipCapIt-140202-214421.PNG
  • 如果跨版本,1.22.2->1.22.4,那么会被直接的拒绝的-效验不过去
[root@li84-236 w]# patch -p1 --dry-run < mediawiki-1.22.4.patch 
patching file includes/DefaultSettings.php
Hunk #1 FAILED at 63.
1 out of 1 hunk FAILED -- saving rejects to file includes/DefaultSettings.php.rej
patching file RELEASE-NOTES-1.22
Hunk #1 FAILED at 3.
1 out of 1 hunk FAILED -- saving rejects to file RELEASE-NOTES-1.22.rej
[root@li84-236 w]#
  • 有时候出现hunk,就下载一个新版本替换进去好了
Shell patch/出现hunk
  • 有时候下到i8ln补丁了,结果是空白的玩意
[root@li855-198 w]# wget http://download.wikimedia.org/mediawiki/1.24/mediawiki-i18n-1.24.3.patch.gz
--2015-08-18 20:49:34--  http://download.wikimedia.org/mediawiki/1.24/mediawiki-i18n-1.24.3.patch.gz
Resolving download.wikimedia.org... 208.80.154.11, 2620:0:861:1:208:80:154:11
Connecting to download.wikimedia.org|208.80.154.11|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://dumps.wikimedia.org/mediawiki/1.24/mediawiki-i18n-1.24.3.patch.gz [following]
--2015-08-18 20:49:34--  http://dumps.wikimedia.org/mediawiki/1.24/mediawiki-i18n-1.24.3.patch.gz
Resolving dumps.wikimedia.org... 208.80.154.11, 2620:0:861:1:208:80:154:11
Reusing existing connection to download.wikimedia.org:80.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://releases.wikimedia.org/mediawiki/1.24/mediawiki-i18n-1.24.3.patch.gz [following]
--2015-08-18 20:49:34--  http://releases.wikimedia.org/mediawiki/1.24/mediawiki-i18n-1.24.3.patch.gz
Resolving releases.wikimedia.org... 208.80.154.241, 2620:0:861:ed1a::11
Connecting to releases.wikimedia.org|208.80.154.241|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20 [application/x-gzip]
Saving to: `mediawiki-i18n-1.24.3.patch.gz'

100%[=====================================================================>] 20          --.-K/s   in 0s      

2015-08-18 20:49:35 (2.30 MB/s) - `mediawiki-i18n-1.24.3.patch.gz' saved [20/20]

[root@li855-198 w]# gunzip -v mediawiki-i18n-1.24.3.patch.gz 
mediawiki-i18n-1.24.3.patch.gz:   0.0% -- replaced with mediawiki-i18n-1.24.3.patch
[root@li855-198 w]# ls -alh mediawiki-i18n-1.24.3.patch 
-rw-r--r-- 1 root root 0 Aug 11 05:12 mediawiki-i18n-1.24.3.patch

见识

Manual:Upgrading - MediaWiki 沿途见识[1]

Using patch
A small patch file is usually made available for a minor version upgrade. Manually download and extract the patch file from the dumps site or follow the directions with wget below.

cd to your main MediaWiki directory (the one with LocalSettings.php).
Download the patch file (e.g., wget http://dumps.wikimedia.org/mediawiki/1.20/mediawiki-1.20.5.patch.gz ) and gunzip it.
Use patch -p1 --dry-run to check what will be changed (e.g., patch -p1 --dry-run < mediawiki-1.20.5.patch )
If all is well, run patch again without --dry-run.
Check your Special:Version and you should see the new version number in place.


引用信息

以下是[帮助:系统:更新Mediawiki版本/补丁更新]所有用到的引用信息,向这些伟大的家伙致敬:
  1. ^ Manual:Upgrading - MediaWiki, 见识于2013-5-7 11:39