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.

Contents

Estimated Upgrade Time: 1-2 Hours.

What's New?

View the 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:

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.

Template Changes

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, operator panel) 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