This page is a translated version of the page Manual:Update.php and the translation is 75% complete.
Outdated translations are marked like this.

详情

update.php 會檢查是否需要更新 MediaWiki 的資料庫架構才能使用當前版本的MediaWiki。 您應該在每次升級 MediaWiki 之後或在或安裝需要更新架構的擴展之後運行update.php 大多數需要架構更新的擴展都會在其文檔中說明。

您可以通過$wgAllowSchemaUpdates 禁用此維護腳本。 在访问量较多的大型wiki中升级可能需要非常小心。如果您不确定是否需要升级,那么或许不需要。

Usage

  警告: update.php 可能會因錯誤而執行一半就退出,導致資料庫產生不一致。 所以在執行腳本之前,務請備份資料庫!

從瀏覽器

如果您無權進入伺服器的命令列介面,請使用web updater執行更新腳本。

Web updater

從命令列介面執行更新

如果您能執行命令列操作,或者透過 SSH 之類的協定執行命令列操作:

$ php maintenance/run.php update

使用 Vagrant 實體(從你的 vagrant ssh)來實現以下操作:

$ mwscript update.php

參數

此腳本提供了一些參數(一般而言,依賴於相依的特定腳本),這些參數在某些 wiki 環境中可能是必需的。

通用維護參數
--help
所有可用的腳本參數提示(一般而言,依賴於相依的特定腳本)通常會附一段對其用法的簡短說明。 這些是較少使用的參數。
--wiki wikiId
如果資料庫名稱是根據虛擬主機名,更新維基群組;其中wikiId是資料庫名(例如enwiki、dewiki等)
--conf
指定設定檔(LocalSettings.php)。 用於wiki families

腳本特定參數
--quick
跳過倒計時
--initial
(在版本1.43引入) Do initial updates required after manual installation using tables-generated.sql
--doshared
同時更新shared tables
--noschema
所有与数据表结构变化或增添数据表的操作都会被跳过,仅运行数据变化。
--schema
对数据库不进行任何架构更改,但是架构更改被保存到可以运行的单独的SQL文件中。
$wgAllowSchemaUpdates 设置为false时,允许运行“update.php”。 这对于非WMF环境非常有用,在非WMF环境中,严格的数据库权限允许数据库更新(由“update.php”执行),但不允许架构更改(“update.php”也会执行添加或删除表或索引)。
--force
即使設定選項中禁用此腳本,也請運行此腳本。
--skip-external-dependencies
when using composer.local.json to let Composer install extensions and their dependencies, you may see an error message saying that there is a mismatch between the installed and required version (e.g. "mediawiki/semantic-breadcrumb-links: 1.3.0 installed, ~1.3 required"). You can use this parameter to ignore the message and run update.php regardless.
  警告: 僅建議開發人員使用。
--skip-config-validation
(在版本1.39引入) Skips checking whether the existing configuration is valid. Otherwise, this script will not run if an invalid configuration is detected.
--skip-compat-checks
(在版本1.41移除) 跳過兼容性檢查 (Gerrit change 851684)
--nopurge
(在版本1.36移除) 不要清除 objectcache 資料表。 通常update.php會清除objectcache (通常包含解析器緩存和訊息緩存),msg_resource msg_resource_links (這些用於 资源加载器 訊息緩存並在 1.21 及更高版本中清除)資料庫中的表,如果您不想清除此表,請使用 --nopurge 選項。
擴展可以使用 LoadExtensionSchemaUpdates 鉤子安裝/更新他們的規格。

参阅