Skip to content

How to upgrade to v2.x

Arjen van Bochoven edited this page Feb 21, 2018 · 1 revision

If you are upgrading Munkireport from a previous version, there are some things to keep in mind.

Back up your database

Although we try to make upgrading as smooth as possible, there may be cases where the upgrade (or the one who makes the upgrade) does bad things to your database. Use a backup strategy that fits the database backend you are using.

SQLite
The standard location of the SQLite database is in the app/db directory, if you're upgrading by downloading the new version of Munkireport and copying the files over the previous version, this database is going to be lost. To backup your SQLite database safely, navigate to the directory in which your database is located and run:

sqlite3 db.sqlite '.backup db.backup.sqlite'

Now move db.backup.sqlite out of the way for safe keeping.

MySQL
You can backup a MySQL database using different methods:

  • via the command line using mysqldump
  • with phpMyAdmin if you have that installed
  • with a fat client like Sequel Pro

If your database does get deleted, you can also just wait until your clients fill it up again

Backup your config

Make a copy of config.php and store it in a safe place.

Use GIT

The easiest and safest way to upgrade is using git. When you use git, the SQLite database does not get overwritten and your config.php file stays intact. With git it is easy to revert the update if things don't work out so well. The following assumes that you set up munkireport with git (git clone https://github.com/munkireport/munkireport-php.git)

To checkout the latest master:

git checkout master
git pull

Copy files

If you can't use git, then you can copy the new files to the proper location. If you're running Munkireport from a subdirectory called 'munkireport', you can rename that directory to 'munkireport.old'. Then you put the new version up under 'munkireport' and copy config.php and optionally db.sqlite to 'munkireport'.

Allow for migrations

If the update contains a database change, you'll need to allow munkireport to update your database to the latest version. To do this, add the following line to config.php:

$conf['allow_migrations'] = TRUE;

This will trigger a check on every database request to see if the database is up-to-date. If there are updates, you'll see a notice in the web interface about the update being successful or not. Although it is a small performance penalty to allow migrations all the time, it is advised to turn it off once all database tables are migrated. Open a client detail page, to make sure all tables are looked up. If there are no problems, change the value to:

$conf['allow_migrations'] = FALSE;

Clear your cache and HTML5 local storage

After a successful upgrade, you might find that pages don't load properly. This is common, and is usually related to your browser caching the GUI elements from the old version.

To confirm this is the case, try loading your site from another web browser. If that loads fine, clear your primary browser's cache and HTML5 local storage.

For Safari:

  1. Hold Command and Option, then press C.
  2. Enter the following code into the window that pops up: localStorage.clear()
  3. Press Enter to submit.
  4. In the Safari menu, select Clear History.
Clone this wiki locally