# Upgrading to 2.4 from 2.3

SupportPal 2.4.0 is a major release with new minimum requirements for PHP, MySQL and IonCube Loaders. The new version contains several macro improvements, including new hook points and a webhook action allowing you to send data to an external service.

  This upgrade guide is aimed at those upgrading from the last stable version (2.3.1) to 2.4.0. Upgrading from an earlier version is possible, but there may then be more important and breaking changes than listed below. 

**Estimated Upgrade Time: 1-2 Hours.**

  **Backup!**  
 Before attempting an upgrade, please take a backup of both your SupportPal database and all associated SupportPal files, then verify the backup is valid (not corrupt). 

## What's New?

View the [2.4 Release Notes](2.4+Release+Notes) for the new features and improvements in this series.

## New Minimum Requirements

The system minimum requirements have been updated to the following:

- **PHP** - 7.0.8 - 7.2.x
- **MySQL** - 5.6.0 - 5.7.x, 8.0.x (or MariaDB 10.0 - 10.3)
- **IonCube Loaders** - 10.2 or greater

The **BCMath** PHP extension is also now required.

We strongly recommend to check your server to ensure that these requirements are fulfilled before upgrading, this should include both the web server and CLI (for the cron).

MySQL 8 and MariaDB 10.3 are now supported as of this release.

  If upgrading from MySQL 5.5 to 5.6+, the search functionality throughout the help desk now performs differently as it makes use of fulltext search. If you use the 'ticket message content' condition in macros, filters or SLA plans, please ensure the results are as you expect after completing the upgrade. 

## Template Changes

  This section is only relevant if you're using a custom frontend or operator panel template. 

This release has a large number of breaking template changes to both the frontend and operator panel templates. We always recommend to apply all the template changes ([frontend](https://github.com/supportpal/supportpal-resources/commit/7b38779f137288983074cfff8e5ec40a739f0615), [operator panel](https://github.com/supportpal/supportpal-resources/commit/b8d294d0356596428a34658f1480ec680a2a25af)) to your custom templates to ensure that they continue to function properly, however below is a list of breaking changes (linked to our resources repository with the diff) where updating the template is essential.

All usage of avatars have been updated to use URLs instead of embedded data URIs, this change is not necessary to implement as it is backwards compatible but we recommend it as it can reduce the page load time where avatars exist.

The error views have moved location to be within the frontend and operator templates. You will need to add these views if you have a custom frontend and/or operator template.

### Frontend

The frontend new ticket form step 1 and step 2 templates (ticket/forms/newticket\_step1.twig and ticket/forms/newticket\_step2.twig) have been switched around and updated. Your template must also include this change to continue working.

## Email Template Changes

As part of a series of performance related improvements, we have switched to using URLs instead of embedded data URIs for avatars in the email template. The upgrader will automatically attempt to change all cases of this to the new format.

Another change is to use purified text directly, removing the need to run this at runtime. The most common use case that you may have used is using the `text` attribute on a message model, below as an example.

```

    {{ message.text }}

```

Such instances need to be converted to use the `purified_text` attribute instead as well as with the `raw` filter so it displays properly, as below. The upgrader will attempt to update cases, but it is recommend to check over your custom templates by using the preview feature to ensure it has been correctly updated.

```

    {{ message.purified_text|raw }}

```

## Development Changes

The backing framework of SupportPal has been updated to Laravel 5.5, which has brought about some necessary changes for users who develop their own plugins or template changes.

### Collections

On the `first`, `last` and `contains` collection methods, the parameters have been switch around so `$value` is first followed by `$key`:

```

    $collection->first(function ($value, $key) {
        return ! is_null($value);
    });

```

The `whereLoose` and `whereInLoose` methods have been removed and `where` and `whereIn` now perform "loose" comparisons by default, `whereStrict` and `whereInStrict` have been added if you need to perform strict comparisons.

### Database

Using the fluent query builder (`DB::table('table')`) now returns collections instead of arrays when fetching results. This affects the `get` and `pluck` methods, you can add `->all()` to keep it returning an array.

```

    $users = DB::table('users')->get()->all();
    $usersIds = DB::table('users')->pluck('id')->all();

```

### Requests/Input

The `only` method now only returns fields that are present in the request data. It should instead be replaced with `all` to maintain the old functionality of including all fields even if they're null.

```

    Input::all([ 'field_1', 'field_2' ])

```

The `has` method now returns `true` even if the input value is an empty string or `null`. It should instead be replaced with `filled` to maintain the old functionality of checking if it has a non-empty value.

```

    Input::filled('field')

```

### Sessions

All calls to the `set` method should be changed to `put`, or the global helper can be used as below.

```

    Session::put('key', 'value');
    session([ 'key' => 'value' ]);

```

### Validation

When validating arrays, booleans, integers, numerics, and strings, `null` is no longer be considered a valid value by default. Optional fields which should allow `null` should now include the new `nullable` rule.

```

    'required_field' => 'required|max:5',
    'optional_field' => 'nullable|max:5',

```

## Other Important Changes

- **Operator session prior to upgrade** - You will be forced to log in again before starting the upgrader due to changes to the session code in our underlying framework. If you have any trouble with this (such as a login loop), please clear your cookies.
- **Filters with 'ticket message content' condition** - In an effort to consolidate our code base, we've combined the functionality of the 'ticket message content' condition for macros and filters, using a BOOLEAN mode fulltext search. In most cases this will have no effect, but please verify the filter results are as expected or you may need to adjust the condition value.
- **Existing automatic macros** - All existing automatic macros have been copied to manual macros for backwards compatibility with the previous version, you may wish to delete any macros you never use manually. Existing automatic macros have also been set to run at most one time on a single ticket, you can change this if you wish to allow it to run more times.
- **Database session driver** - If you make use of the database driver for sessions, this has been removed in this release and you should switch to [another driver](/4.2/Changing+File+Storage+Path#FrameworkStorageDirectories) before upgrading. This only applies if you have manually changed it as the default is the file driver.