%META:TOPICINFO{author="TWikiContributor" date="1147664322" format="1.1" version="5"}%
%TOC%
%STARTINCLUDE%
---# TWiki Upgrade Guide

_Upgrade from the previous TWiki 01-Sep-2004 Prodcution Release to TWiki-4.0.0_

---++ Overview

TWiki-4.0.0 is a major new release. You can chose between an automated upgrade using a script or a manual update.

---++ Upgrade Requirements

   * Please review the AdminSkillsAssumptions before you upgrade TWiki
   * Review TWiki:TWiki.TWikiUpgradeTo04x00x00 for latest information and experience notes.
   * To upgrade from a release prior to TWiki Release 01-Sep-2004, start with TWiki:TWiki.UpgradingTWiki on TWiki.org
   * To upgrade from a standard TWiki Release 01-Sep-2004 to the latest TWiki-4.0.0 Production Release, follow the instructions below
   * Once the upgrade has been applied, an existing earlier installation will still be able to read all the topics, but should not be used to write. Make sure you take a backup!
   * Not all Plugins written for TWiki Release 01-Sep-2004 are fully supported with Dakar. Make sure the Plugins you use can be upgraded as well!

---++ Major Changes Compared to TWiki Release 01-Sep-2004

See TWikiReleaseNotes04x00.

---++ Automated Upgrade Procedure

If you would prefer to do things manually, *or if you made custom modifications to distributed files* (except topics), then skip to the [[#ManualUpgradeProcedure][manual upgrade procedure]] below.

The upgrade script is called ="UpgradeTwiki"=, and is found in the root of the distribution. It can be run by any user, though you will need to make sure you correct the permissions so that the webserver user can write all files in the new installation when you have finished. The upgrade script does *not* write to your existing installation.

The upgrade script will upgrade the *TWiki core only*. Plugins will need to be upgraded separately.

Note: To upgrade from a Beta, *do not* use !UpgradeTWiki. Instead follow the steps outlined in [[#Upgrading_a_Beta][Upgrading a Beta]], below.

It will:

   * Create a new TWiki installation, placing the files from the distribution there as appropriate
   * Where possible, merge the changes you've made in your existing topics and attachments into the new twiki
   * Where not possible, it will tell you, and you can inspect those differences manually
   * Create new configuration files for the new TWiki based on your existing configuation information
   * Set the permissions in the new TWiki so that it should work straight away
   * Attempt to setup authentication for your new TWiki, if you are using .htaccess in the old one
   * Tell you what else you need to do

To perform the upgrade, you need to:

   * Check first if there is a newer =UpgradeTwiki= script available, see TWiki:Codev.UpgradeTWiki
   * Create a new directory for your new installation: Let's call this =distro/=
   * Put the distribution zip file in =distro/=
   * Unzip it
   * Choose a directory for the new installation.  I will call this =new_twiki=.  This directory must not already exist.
   * Change directory to =distro/= and run: %BR%
     =./UpgradeTwiki &lt;full path to existing_twiki's setlib.cfg&gt; &lt;full path to new_twiki&gt;=
   * confirm your system settings by visiting [[%SCRIPTURLPATH{"configure"}%][configure]]

Assuming all goes well, =UpgradeTwiki= will give you the final instructions.

Visit TWiki:Codev.KnownIssuesOfTWiki04x00x00 and fix known issues that apply to you.

There are a few points worth noting:

   * =UpgradeTwiki= may not be able to merge all the changes you made in your existing TWiki into the new installation, but it will tell you which ones it couldn't deal with
   * =UpgradeTwiki= creates the new installation in a new directory tree. It makes a complete copy of all your existing data, so:
      * Clearly you need to point it to a location where there is enough space
      * If you have symlinks under your =data/= directory in your existing installation, these are reproduced as actual directories in the new structure.   It is up to you to pull these sub-directories out again and re-symlink as needed
   * =UpgradeTwiki= doesn't deal with custom templates or Plugins, you will have to reinstall these in the new installation.
   * If you are using the Htpasswd login manager, then note that email addresses for users have moved out of user topics and into the password database. There is a script that performs this extra upgrade step for you - see =tools/upgrade_emails.pl=.


#ManualUpgradeProcedure
---++ Manual Upgrade Procedure

The following steps are a rough guide to upgrading only. It is impossible to give detailed instructions, as what you have to do may depend on whether you can configure the webserver or not, and how much you have changed distributed files in your current TWiki release.

   1 Follow the installation instructions, and install the new release in a new directory.
   1 Copy your local webs over to the data and pub directories of the new install
      * You could also use softlinks to link the web directories in data and pub to the old installation area
   1 Unlock the rcs files in data and pub directories from the old installation using the following shell commands:
      * =find data -name '*,v' -exec rcs -u -M '{}' \;=
      * =find pub -name '*,v' -exec rcs -u -M '{}' \;=
   1 Examine your old TWiki.cfg, and for each local setting, set the corresponding value in the [[%SCRIPTURLPATH{"configure"}%][configure]] interface for the new install.
      *  If you can't use [[%SCRIPTURLPATH{"configure"}%][configure]], then copy the *new* =TWiki.cfg= to =LocalSite.cfg=, and edit =LocalSite.cfg=. Remove all the settings that you didn't change in your previous install, and change the remaining settings to the values from your *old* TWiki.cfg.
   1 Transfer any customized and local settings from [[%TWIKIWEB%.TWikiPreferences]] to the topic pointed at by {LocalSitePreferences} ([[%LOCALSITEPREFS%]]). This avoids having to write over files in the distribution.
   1 If you changed any of the topics in the original TWiki distribution, you will have to transfer your changes to the new install manually. There is no simple way to do this, though the following procedure may help:
      1 Install a copy of the original TWiki release you were using in a temporary directory
      1 Use 'diff' to find changed files, and transfer the changes into the new Dakar install.
      1 Install updated plugins into your new area.
   1 Point your webserver at the new install.
   1 Visit TWiki:Codev.KnownIssuesOfTWiki04x00x00 and fix known issues that apply to you.
   1 If you are using the Htpasswd login manager, then note that email addresses for users have moved out of user topics and into the password database. There is a script that performs this extra upgrade step for you - see =tools/upgrade_emails.pl=.

You are *highly* recommended *not* to change any distributed files if you can avoid it, to simplify future upgrades!

---++ Upgrading a Beta
*If* you followed the recommendations and avoided modifying any distributed files, then this is quite straightforward:
   1 Follow the installation instructions, and install the new release in a new directory.
   1 Copy your local webs over to the data and pub directories of the new install
      * Be careful to copy over the user topics and TWikiUsers.txt in the Main web
   1 Copy over your =bin/LocalLib.cfg= and =lib/LocalSite.cfg= files
   1 Copy over any local files you created (such as .htpasswd and .htaccess files)
   1 Point your webserver at the new install.
*If* you changed any of the distributed files, you will have to continue from Step 5 above.

---++ Upgrading from Cairo to TWiki4 (additional advice)

---+++ Favicon

TWiki4's PatternSkin introduces the use of the favicon feature which most browsers use to show a small icon in front of the URL and for bookmarks.

In TWiki4 it is assumed that each web has a favicon.ico file attached to the !WebPreferences topic. When you upgrade from Cairo to TWiki4 you do not have this file and you will get flooded with errors the error log of your web server. There are two solutions to this.

   * Attach a favicon.ico file to !WebPreferences in each web.
   * Change the setting of the location of favicon.ico in !TWikiPreferences so all webs use the favicon.ico from the TWiki web. This is the fastest and easiest solution.

To change the location of favicon.ico in !TWikiPreferences to the TWiki web add this line to Main.TWikiPreferences

<verbatim>
   * Set FAVICON = %PUBURLPATH%/%TWIKIWEB%/%WEBPREFSTOPIC%/favicon.ico
</verbatim>

---+++ !TWikiUsers topic in Main web

Your Cairo [[Main.TWikiUsers][Main.TWikiUsers]] topic will work in TWiki4 but you will need to ensure that these 4 users from the default TWiki4 version of !TWikiUsers are copied to the existing !TWikiUsers topic. !TWikiGuest is probably already there but the others are new
   * *TWikiContributor* - placeholder for a TWiki developer, and is used in TWiki documentation
   * *TWikiGuest* - guest user, used as a fallback if the user can't be identified
   * *TWikiRegistrationAgent* - special user used during the new user registration process
   * *UnknownUser* - used where the author of a previously stored piece of data can't be determined


You additionally need to ensure that !TWikiUsers has the =Set ALLOWTOPICCHANGE = !TWikiAdminGroup, !TWikiRegistrationAgent=. Otherwise people will not be able to register.

%STOPINCLUDE%

__Related Topics:__ AdminDocumentationCategory, TWiki:TWiki.UpgradingTWiki

