Prettify ternary operator a bit
[mediawiki.git] / UPGRADE
blob77168ac01207457625dc13e009eff8e5db78b059
1 This file provides an overview of the MediaWiki upgrade process. For help with
2 specific problems, check
4 * the documentation at http://www.mediawiki.org
5 * the mediawiki-l mailing list archive at
6   http://lists.wikimedia.org/pipermail/mediawiki-l/
7 * the bug tracker at https://bugzilla.wikimedia.org
9 for information and workarounds to common issues.
11 == Overview ==
13 Comprehensive documentation on upgrading to the latest version of the software
14 is available at http://www.mediawiki.org/wiki/Manual:Upgrading.
16 === Consult the release notes ===
18 Before doing anything, stop and consult the release notes supplied with the new
19 version of the software. These detail bug fixes, new features and functionality,
20 and any particular points that may need to be noted during the upgrade
21 procedure.
23 === Backup first ===
25 It is imperative that, prior to attempting an upgrade of the database schema,
26 you take a complete backup of your wiki database and files and verify it. While
27 the upgrade scripts are somewhat robust, there is no guarantee that things will
28 not fail, leaving the database in an inconsistent state.
30 http://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki provides an overview of
31 the upgrade process. You should also refer to the documentation for your
32 database management system for information on backing up a database, and to
33 your operating system documentation for information on making copies of files.
35 === Perform the file upgrade ===
37 Download the files for the new version of the software. These are available
38 as a compressed "tar" archive from the Wikimedia Download Service
39 (http://download.wikimedia.org/mediawiki).
41 You can also obtain the new files directly from our Subversion source code
42 repository, via a checkout or export operation.
44 Replace the existing MediaWiki files with the new. You should preserve the
45 LocalSettings.php file, AdminSettings.php file (if present), and the
46 "extensions" and "images" directories.
48 Depending upon your configuration, you may also need to preserve additional
49 directories, including a custom upload directory ($wgUploadDirectory),
50 deleted file archives, and any custom skins.  If you're using very old exten-
51 sions that add files to the "includes" directory or other directories, be sure
52 to back those up as well.
54 === Perform the database upgrade ===
56 You will need an AdminSettings.php file set up in the correct format; see
57 AdminSettings.sample in the wiki root for more information and examples.
59 From the command line, browse to the "maintenance" directory and run the 
60 update.php script to check and update the schema. This will insert missing
61 tables, update existing tables, and move data around as needed. In most cases,
62 this is successful and nothing further needs to be done.
64 === Check configuration settings ===
66 The names of configuration variables, and their default values and purposes,
67 can change between release branches, e.g. $wgDisableUploads in 1.4 is replaced
68 with $wgEnableUploads in later versions. When upgrading, consult the release
69 notes to check for configuration changes which would alter the expected
70 behaviour of MediaWiki.
72 === Test ===
74 It makes sense to test your wiki immediately following any kind of maintenance
75 procedure, and especially after upgrading; check that page views and edits work
76 normally and that special pages continue to function, etc. and correct errors
77 and quirks which reveal themselves.
79 You should also test any extensions, and upgrade these if necessary.
81 == Upgrading from 1.8 wikis ==
83 MediaWiki 1.9 and later no longer keep default localized message text
84 in the database; 'MediaWiki:'-namespace pages that do not exist in the
85 database are simply transparently filled-in on demand.
87 The upgrade process will delete any 'MediaWiki:' pages which are left
88 in the default state (last edited by 'MediaWiki default'). This may
89 take a few moments, similar to the old initial setup.
91 Note that the large number of deletions may cause older edits to expire
92 from the list on Special:Recentchanges, although the deletions themselves
93 will be hidden by default. (Click "show bot edits" to list them.)
96 See RELEASE-NOTES for more details about new and changed options.
99 == Upgrading from 1.7 wikis ==
101 $wgDefaultUserOptions now contains all the defaults, not only overrides.
102 If you're setting this as a complete array(), you may need to change it
103 to set only specific items as recommended in DefaultSettings.php.
105 == Upgrading from 1.6 wikis ==
107 $wgLocalTZoffset was in hours, it is now using minutes.
108 Link autonumbering got fixed (#5918) for protocols other than http.
109  - 'irc://irc.server.tld/' render as a link with a chat icon
110  - '[irc://irc.server.tld]' render as an autonumbered link: [1]
112 == Upgrading from pre-1.5 wikis ==
114 Major changes have been made to the schema from 1.4.x. The updater
115 has not been fully tested for all conditions, and might well break.
117 On a large site, the schema update might take a long time. It might
118 explode, or leave your database half-done or otherwise badly hurting.
120 Among other changes, note that Latin-1 encoding (ISO-8859-1) is
121 no longer supported. Latin-1 wikis will need to be upgraded to
122 UTF-8; an experimental command-line upgrade helper script,
123 'upgrade1_5.php', can do this -- run it prior to 'update.php' or
124 the web upgrader.
126 If you absolutely cannot make the UTF-8 upgrade work, you can try
127 doing it by hand: dump your old database, convert the dump file
128 using iconv as described here: 
129 http://portal.suse.com/sdb/en/2004/05/jbartsh_utf-8.html
130 and then reimport it. You can also convert filenames using convmv,
131 but note that the old directory hashes will no longer be valid,
132 so you will also have to move them to new destinations.
134 Message changes:
135 * A number of additional UI messages have been changed from HTML to
136   wikitext, and will need to be manually fixed if customized.
138 === Configuration changes from 1.4.x: ===
140 $wgDisableUploads has been replaced with $wgEnableUploads.
142 $wgWhitelistAccount has been replaced by the 'createaccount' permission
143 key in $wgGroupPermissions. To emulate the old effect of setting:
144   $wgWhitelistAccount['user'] = 0;
145 set:
146   $wgGroupPermissions['*']['createaccount'] = false;
148 $wgWhitelistEdit has been replaced by the 'edit' permission key.
149 To emulate the old effect of setting:
150   $wgWhitelistEdit = true;
151 set:
152   $wgGroupPermissions['*']['edit'] = false;
154 If $wgWhitelistRead is set, you must also disable the 'read' permission
155 for it to take affect on anonymous users:
156   $wgWhitelistRead = array( "Main Page", "Special:Userlogin" );
157   $wgGroupPermissions['*']['read'] = false;
159 Note that you can disable/enable several other permissions by modifying
160 this configuration array in your LocalSettings.php; see DefaultSettings.php
161 for the complete default permission set.
163 If using Memcached, you must enabled it differently now:
164   $wgUseMemCached = true;
165 should be replaced with:
166   $wgMainCacheType = CACHE_MEMCACHED;
169 === Web installer ===
171 You can use the web-based installer wizard if you first remove the
172 LocalSettings.php (and AdminSettings.php, if any) files; be sure to
173 give the installer the same information as you did on the original
174 install (language/encoding, database name, password, etc). This will
175 also generate a fresh LocalSettings.php, which you may need to customize.
177 You may change some settings during the install, but be very careful!
178 Changing the encoding in particular will generally leave you with a
179 lot of corrupt pages, particularly if your wiki is not in English.
181 === Command-line upgrade ===
183 Additionally, as of 1.4.0 you can run an in-place upgrade script from
184 the command line, keeping your existing LocalSettings.php. This requires
185 that you create an AdminSettings.php giving an appropriate database user
186 and password with privileges to modify the database structure.
188 Once the new files are in place, go into the maintenance subdirectory and
189 run the script:
191   php update.php
193 See caveats below on upgrading from 1.3.x or earlier.
196 == Backups! ==
198 To upgrade an existing MediaWiki installation, first BACK UP YOUR WIKI!
199 If something goes wrong, you want to be able to start again.
201 Your image files, configuration, etc can simply be copied or archived as
202 you would any other files. (Make sure that the contents of your
203 LocalSettings.php are not accidentally made public, as this contains
204 a database password.)
206 To back up the database, use the tools provided by your service provider
207 (if applicable) or the standard mysqldump or pg_dump programs.
209 For general help on mysqldump:
210 http://dev.mysql.com/doc/mysql/en/mysqldump.html
212 WARNING: If using MySQL 4.1.x, mysqldump's charset conversion may in
213 some cases damage data in your wiki. If necessary, set the charset
214 option to 'latin1' to avoid the conversion.
216 For general help on pg_dump:
217 http://www.postgresql.org/docs/current/static/app-pgdump.html
220 == Caveats ==
222 === Postgres ===
224 Postgres support is new, and much of the upgrade instructions may 
225 not apply. The schema was changed significantly from 1.7 to 1.8, 
226 so you will need to at least use the update.php or web installer, 
227 as described above.
230 === Upgrading from 1.4.2 or earlier ===
232 1.4.3 has added new fields to the sitestats table. These fields are
233 optional and help to speed Special:Statistics on large sites. If you
234 choose not to run the database upgrades, everything will continue to
235 work in 1.4.3.
237 You can apply the update by running maintenance/update.php, or
238 manually run the SQL commands from this file:
239   maintenance/archives/patch-ss_total_articles.sql
242 === Upgrading from 1.4rc1 or earlier betas ===
244 The logging table has been altered from 1.4beta4 to 1.4beta5
245 and again in 1.4.0 final. Copy in the new files and use the web
246 installer to upgrade, or the command-line maintenance/update.php.
248 If you cannot use the automated installers/updaters, you may
249 update the table by manually running the SQL commands in these
250 files:
251    maintenance/archives/patch-log_params.sql
252    maintenance/archives/patch-logging-title.sql
255 === Upgrading from 1.3.x ===
257 This should generally go smoothly.
259 If you keep your LocalSettings.php, you may need to change the style paths
260 to match the newly rearranged skin modules. Change these lines:
261   $wgStylePath        = "$wgScriptPath/stylesheets";
262   $wgStyleDirectory   = "$IP/stylesheets";
263   $wgLogo             = "$wgStylePath/images/wiki.png";
265 to this:
266   $wgStylePath        = "$wgScriptPath/skins";
267   $wgStyleDirectory   = "$IP/skins";
268   $wgLogo             = "$wgStylePath/common/images/wiki.png";
270 As well as new messages, the processing of some messages has changed.
271 If you have customized them, please compare the new format using
272 Special:Allmessages or the relevant LanguageXX.php files:
273   copyrightwarning
274   dberrortext
275   editingcomment  (was named commentedit)
276   editingsection  (was named sectionedit)
277   numauthors
278   numedits
279   numtalkauthors
280   numtalkedits
281   numwatchers
282   protectedarticle
283   searchresulttext
284   showhideminor
285   unprotectedarticle
287 Note that the 1.3 beta releases included a potential vulnerability if PHP
288 is configured with register_globals on and the includes directory is
289 served to the web. For general safety, turn register_globals *off* if you
290 don't _really_ need it for another package.
292 If your hosting provider turns it on and you can't turn it off yourself,
293 send them a kind note explaining that it can expose their servers and their
294 customers to attacks.
297 === Upgrading from 1.2.x ===
299 If you've been using the MediaWiki: namespace for custom page templates,
300 note that things are a little different. The Template: namespace has been
301 added which is more powerful -- templates can include parameters for
302 instance.
304 If you were using custom MediaWiki: entries for text inclusions, they
305 will *not* automatically be moved to Template: entries at upgrade time.
306 Be sure to go through and check that everything is working properly;
307 you can move them manually or you can try using moveCustomMessages.php
308 in maintenance/archives to do it automatically, but this might break things.
310 Also, be sure to pick the correct character encoding -- some languages were
311 only available in Latin-1 on 1.2.x and are now available for Unicode as well.
312 If you want to upgrade an existing wiki from Latin-1 to Unicode you'll have
313 to dump the database to SQL, run it through iconv or another conversion tool,
314 and restore it. Sorry.
317 === Upgrading from 1.1.x or earlier ===
319 This is less thoroughly tested, but should work.
321 You need to specify the *admin* database username and password to the
322 installer in order for it to successfully upgrade the database structure.
323 You may wish to manually change the GRANTs later.
325 If you have a very old database (earlier than organized MediaWiki releases
326 in late August 2003) you may need to manually run some of the update SQL
327 scripts in maintenance/archives before the installer is able to pick up
328 with remaining updates.
331 === Upgrading from UseModWiki or old "phase 2" Wikipedia code ===
333 There is a semi-maintained UseModWiki to MediaWiki conversion script at
334 maintenance/importUseModWiki.php; it may require tweaking and customization
335 to work for you.
337 Install a new MediaWiki first, then use the conversion script which will
338 output SQL statements; direct these to a file and then run that into your
339 database.
341 You will have to rebuild the links tables etc after importing.