UPGRADE 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. This file provides an overview of the MediaWiki upgrade process. For help with
  2. specific problems, you should check:
  3. * the docs at https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents ;
  4. * the mediawiki-l mailing list archive at
  5. https://lists.wikimedia.org/pipermail/mediawiki-l/ ; and
  6. * the bug tracker at https://phabricator.wikimedia.org/
  7. … for information and workarounds to common issues.
  8. == Overview ==
  9. We provide comprehensive documentation on upgrading to the latest version of the
  10. software at https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Upgrading.
  11. === Consult the release notes ===
  12. Before doing anything, stop and consult the release notes supplied with the new
  13. version of the software. These detail bug fixes, new features and functionality,
  14. and any particular points that may need to be noted during the upgrade process.
  15. === Backup first ===
  16. It is imperative that, prior to attempting an upgrade of the database schema,
  17. you take a complete backup of your wiki database and files and verify it. While
  18. the upgrade scripts are somewhat robust, there is no guarantee that things will
  19. not fail, leaving the database in an inconsistent state.
  20. https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Backing_up_a_wiki is an
  21. overview of the backup process. You should also refer to the documentation for
  22. your database management system for information on backing up a database, and to
  23. your operating system documentation for information on making copies of files.
  24. === Perform the file upgrade ===
  25. Download the files for the new version of the software. These are available as a
  26. compressed "tar" archive from the Wikimedia Download Service
  27. (https://releases.wikimedia.org/mediawiki/).
  28. You can also obtain the new files directly from our Git source code repository.
  29. Replace the existing MediaWiki files with the new. You should preserve the
  30. LocalSettings.php file and the "extensions" and "images" directories.
  31. Depending upon your configuration, you may also need to preserve additional
  32. directories, including a custom upload directory ($wgUploadDirectory),
  33. deleted file archives, and any custom skins.
  34. === Perform the database upgrade ===
  35. As of 1.21, it is possible to separate schema changes (i.e. adding, dropping, or
  36. changing tables, fields, or indices) from all other database changes (e.g.
  37. populating fields). If you need this capability, see "From the command line"
  38. below.
  39. ==== From the Web ====
  40. If you browse to the Web-based installation script (usually at
  41. ./mw-config/index.php) from your wiki installation you can follow the script and
  42. upgrade your database in place.
  43. ==== From the command line ====
  44. From the command line, browse to the "maintenance" directory and run the
  45. update.php script to check and update the schema. This will insert missing
  46. tables, update existing tables, and move data around as needed. In most cases,
  47. this is successful and nothing further needs to be done.
  48. If you need to separate out the schema changes so they can be run by someone
  49. with more privileges, then you can use the --schema option to produce a text
  50. file with the necessary commands. You can use --schema, --noschema,
  51. $wgAllowSchemaUpdates as well as proper database permissions to enforce this
  52. separation.
  53. === Check configuration settings ===
  54. The names of configuration variables, and their default values and purposes, can
  55. change between release branches, e.g. $wgDisableUploads in 1.4 is replaced with
  56. $wgEnableUploads in later versions. When upgrading, consult the release notes to
  57. check for configuration changes which would alter the expected behavior of
  58. MediaWiki.
  59. === Check installed extensions ===
  60. Extensions usually need to be upgraded at the same time as the MediaWiki core.
  61. In MediaWiki 1.14 some extensions were migrated into the core. Please see the
  62. HISTORY section "Migrated extensions" and disable these extensions in your
  63. LocalSettings.php
  64. === Test ===
  65. It makes sense to test your wiki immediately following any kind of maintenance
  66. procedure, and especially after upgrading; check that page views and edits work
  67. normally, that special pages continue to function, etc., and correct any errors
  68. and quirks which reveal themselves.
  69. You should also test any extensions, and upgrade these if necessary.
  70. == Upgrading from 1.16 or earlier ==
  71. If you have a Chinese or Japanese wiki ($wgLanguageCode is set to one of "zh",
  72. "ja", or "yue") and you are using MySQL fulltext search, you will probably want
  73. to update the search index.
  74. In the "maintenance" directory, run the updateDoubleWidthSearch.php script. This
  75. will update the searchindex table for those pages that contain double-byte Latin
  76. characters.
  77. == Upgrading from 1.10 or earlier ==
  78. If upgrading from before 1.11, and you are using a wiki as a commons repository,
  79. make sure that it is updated as well. Otherwise, errors may arise due to
  80. database schema changes.
  81. == Upgrading from 1.8 or earlier ==
  82. MediaWiki 1.9 and later no longer keep default localized message text in the
  83. database; 'MediaWiki:'-namespace pages that do not exist in the database are
  84. simply transparently filled-in on demand.
  85. The upgrade process will delete any 'MediaWiki:' pages which are left in the
  86. default state (last edited by 'MediaWiki default'). This may take a few moments,
  87. similar to the old initial setup.
  88. Note that the large number of deletions may cause older edits to expire from the
  89. list on Special:Recentchanges, although the deletions themselves will be hidden
  90. by default. (Click "show bot edits" to list them.)
  91. See RELEASE-NOTES for more details about new and changed options.
  92. == Upgrading from 1.7 or earlier ==
  93. $wgDefaultUserOptions now contains all the defaults, not only overrides. If you
  94. are setting this as a complete array(), you may need to change it to set only
  95. specific items as recommended in DefaultSettings.php.
  96. == Upgrading from 1.6 or earlier ==
  97. $wgLocalTZoffset was in hours, it is now using minutes.
  98. If upgrading from before 1.7, you may want to run refreshLinks.php to ensure
  99. new database fields are filled with data.
  100. == Upgrading from 1.5 or earlier ==
  101. Major changes have been made to the schema from 1.4.x. The updater has not been
  102. fully tested for all conditions, and might well break.
  103. On a large site, the schema update might take a long time. It might explode, or
  104. leave your database half-done or otherwise badly hurting.
  105. Among other changes, note that Latin-1 encoding (ISO-8859-1) is no longer
  106. supported. Latin-1 wikis will need to be upgraded to UTF-8; an experimental
  107. command-line upgrade helper script, 'upgrade1_5.php', can do this -- run it
  108. prior to 'update.php' or the Web upgrader.
  109. NOTE that upgrade1_5.php does not work properly with recent versions of
  110. MediaWiki. If upgrading a 1.4.x wiki, you should upgrade to 1.5 first.
  111. upgrade1_5.php has been removed from MediaWiki 1.21.
  112. If you absolutely cannot make the UTF-8 upgrade work, you can try doing it by
  113. hand: dump your old database, convert the dump file using iconv as described
  114. here: http://portal.suse.com/sdb/en/2004/05/jbartsh_utf-8.html
  115. and then re-import it. You can also convert filenames using convmv, but note
  116. that the old directory hashes will no longer be valid, so you will also have to
  117. move them to new destinations.
  118. Message changes:
  119. * A number of additional UI messages have been changed from HTML to wikitext,
  120. and will need to be manually fixed if customized.
  121. === Configuration changes from 1.4.x: ===
  122. $wgDisableUploads has been replaced with $wgEnableUploads.
  123. $wgWhitelistAccount has been replaced by the 'createaccount' permission key in
  124. $wgGroupPermissions. To emulate the old effect of setting:
  125. $wgWhitelistAccount['user'] = 0;
  126. set:
  127. $wgGroupPermissions['*']['createaccount'] = false;
  128. $wgWhitelistEdit has been replaced by the 'edit' permission key. To emulate the
  129. old effect of setting:
  130. $wgWhitelistEdit = true;
  131. set:
  132. $wgGroupPermissions['*']['edit'] = false;
  133. If $wgWhitelistRead is set, you must also disable the 'read' permission for it
  134. to take affect on anonymous users:
  135. $wgWhitelistRead = array( "Main Page", "Special:Userlogin" );
  136. $wgGroupPermissions['*']['read'] = false;
  137. Note that you can disable/enable several other permissions by modifying this
  138. configuration array in your LocalSettings.php; see DefaultSettings.php for the
  139. complete default permission set.
  140. If using Memcached, you must enabled it differently now:
  141. $wgUseMemCached = true;
  142. should be replaced with:
  143. $wgMainCacheType = CACHE_MEMCACHED;
  144. == Upgrading from 1.4.2 or earlier ==
  145. 1.4.3 has added new fields to the sitestats table. These fields are optional and
  146. help to speed Special:Statistics on large sites. If you choose not to run the
  147. database upgrades, everything will continue to work in 1.4.3.
  148. You can apply the update by running maintenance/update.php, or manually run the
  149. SQL commands from this file:
  150. maintenance/archives/patch-ss_total_articles.sql
  151. == Upgrading from 1.4rc1 or earlier betas ==
  152. The logging table has been altered from 1.4beta4 to 1.4beta5 and again in 1.4.0
  153. final. Copy in the new files and use the Web installer to upgrade, or the
  154. command-line maintenance/update.php.
  155. If you cannot use the automated installers/updaters, you may update the table by
  156. manually running the SQL commands in these files:
  157. maintenance/archives/patch-log_params.sql
  158. maintenance/archives/patch-logging-title.sql
  159. == Upgrading from 1.3 or earlier ==
  160. This should generally go smoothly.
  161. If you keep your LocalSettings.php, you may need to change the style paths to
  162. match the newly rearranged skin modules. Change these lines:
  163. $wgStylePath = "$wgScriptPath/stylesheets";
  164. $wgStyleDirectory = "$IP/stylesheets";
  165. $wgLogo = "$wgStylePath/images/wiki.png";
  166. to this:
  167. $wgStylePath = "$wgScriptPath/skins";
  168. $wgStyleDirectory = "$IP/skins";
  169. $wgLogo = "$wgStylePath/common/images/wiki.png";
  170. As well as new messages, the processing of some messages has changed. If you
  171. have customized them, please compare the new format using Special:Allmessages or
  172. the relevant LanguageXX.php files:
  173. * copyrightwarning
  174. * dberrortext
  175. * editingcomment (was named commentedit)
  176. * editingsection (was named sectionedit)
  177. * numauthors
  178. * numedits
  179. * numtalkauthors
  180. * numtalkedits
  181. * numwatchers
  182. * protectedarticle
  183. * searchresulttext
  184. * showhideminor
  185. * unprotectedarticle
  186. Note that the 1.3 beta releases included a potential vulnerability if PHP is
  187. configured with register_globals on and the includes directory is served to the
  188. Web. For general safety, turn register_globals *off* if you don't _really_ need
  189. it for another package.
  190. If your hosting provider turns it on and you can't turn it off yourself, send
  191. them a kind note explaining that it can expose their servers and their customers
  192. to attacks.
  193. == Upgrading from 1.2 or earlier ==
  194. If you've been using the MediaWiki: namespace for custom page templates, note
  195. that things are a little different. The Template: namespace has been added which
  196. is more powerful -- templates can include parameters for instance.
  197. If you were using custom MediaWiki: entries for text inclusions, they will *not*
  198. automatically be moved to Template: entries at upgrade time. Be sure to go
  199. through and check that everything is working properly; you can move them
  200. manually or you can try using moveCustomMessages.php in maintenance/archives to
  201. do it automatically, but this might break things.
  202. Also, be sure to pick the correct character encoding -- some languages were only
  203. available in Latin-1 on 1.2.x and are now available for Unicode as well. If you
  204. want to upgrade an existing wiki from Latin-1 to Unicode you'll have to dump the
  205. database to SQL, run it through iconv or another conversion tool, and restore
  206. it. Sorry.
  207. == Upgrading from 1.1 or earlier ==
  208. This is less thoroughly tested, but should work.
  209. You need to specify the *admin* database username and password to the installer
  210. in order for it to successfully upgrade the database structure. You may wish to
  211. manually change the GRANTs later.
  212. If you have a very old database (earlier than organized MediaWiki releases in
  213. late August 2003) you may need to manually run some of the update SQL scripts in
  214. maintenance/archives before the installer is able to pick up with remaining
  215. updates.