# Upgrading

Habari's upgrade process is designed to be transparent, with the only indication that an upgrade is happening being a slightly longer page load time the first time the site is visited after the software is updated.

## Before You Upgrade

Before making any major change in your Habari installation, it would be prudent to create a backup of your database and your installation, in particular all the files in your Habari /user directory. The /user directory should contain all files which you have customized - plugins you have installed, themes you have installed, class files you may have modified, or locale files you have installed.

## The Upgrade Process

1. Download the new version of Habari that you will be installing. Unzip it into the location of your choice.
2. Deactivate your active plugins. Some of the system plugins may have been changed. Some of the plugins you got in other places may not be compatible with the new version of Habari.
3. Delete the following directories
   1. /3rdparty
   2. /scripts
   3. /doc
   4. /system
4. Delete the index.php, LICENSE, and NOTICE files from the root of your installation. Do not delete your config.php file if it is in the root of your Habari installation, or the .htaccess file.
5. Copy the new version of Habari to the same location as the old version.
6. Using your web browser, navigate to your site. If there are any database changes that need to be made, they will be made automatically at this time.
7. Log into your Habari administrative area. Navigate to the plugins page and reactivate the plugins one by one.
8. Celebrate and enjoy the new features of your latest version of Habari!

## Upgrading from Version 0.7.x to Version 0.8

There are several changes that you should take into account when upgrading.

All users will be affected by the change in theme functions and many will want to remove a potential path disclosure issue. Now that it has been removed from the Habari installation, users of the k2 theme will need to manually include it.

#### Theme Functions

Theme functions no longer print content by default but now return a value. This means that you need to tell your theme to `echo` the returned value. For example, all themes should call the `header()` function, which should be changed from this:

`<?php $theme->header(); ?>`

to this:

`<?php echo $theme->header(); ?>`

You should check your calls to at least `header()`, `footer()`, `prev_page_link()`, `next_page_link()`, `page_selector()`, and `feed_alternate()` in your theme.

#### k2 Theme Removal

If you are using the k2 theme that was previously included in Habari, you should download k2 and included it in your themes directory, `user/themes`. k2 can now be found in habari-extras.

#### Prevent Installation Path Disclosure

A path disclosure is an error that can show the directory where your software is installed, which can be seen as a security issue. To protect existing Habari installations from a potential path disclosure issue, you can modify your `config.php` file and include the following line at the start of the file. New installations will be protected by default.

``