Upgrading to 2.5 from 2.4
SupportPal 2.5.0 is a major release adding support for PHP 7.3. The new version introduces a embeddable help widget that can be placed on your website, a ticket trash can where deleted tickets are held for 30 days, and automatically adding users to organisations based on their email address.
Estimated Upgrade Time: 1 Hour.
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.5 Release Notes for the new features and improvements in this series.
Upgrading Database
A number of new columns and indexes have been added to the database. Due to these changes, the upgrade script may be slow on large databases. We recommend to make use of the new upgrade CLI command which will run without timeouts.
Development Changes
Model events
The model events system has been updated to fix issues with events fired during database transactions. This may affect your plugin if it makes use of model events and you may need to rewrite the event handling code. We recommend to test your plugin code on 2.5.0 before upgrading, please contact us if you need a free development license.
For example, previously then Ticket::created
event ran after the whole ticket had been created and hence all ticket relations (including the ticket message) were available. The Ticket::created
event now runs as soon as the ticket is inserted into the ticket
table which means relations are no longer accessible. This can result in PHP errors being thrown if improper error checking is in place, for example the following code will now result in an error:
\App\Modules\Ticket\Models\Ticket::created(function ($ticket) {
// The lastReply property will now return NULL and this code will result in an exception:
// Trying to get property 'text' of non-object
$ticket->lastReply->text;
});
Ticket Trash
A trash can has been introduced which allows you to view and restore deleted tickets.
Any plugins, widgets or reports with SQL queries accessing the ticket
table may now return empty
results when viewing a deleted ticket. This can lead to PHP errors if there's improper error checking in place.
Please ensure your code functions correctly before upgrading. This means include/exclude trashed tickets as expected, and also works when viewing a trashed ticket in the operator panel. If you need a development license please contact us.
Eloquent Models
If using the Ticket
model to build a query like below, tickets in the trash are automatically excluded.
$tickets = \App\Modules\Ticket\Models\Ticket::where('department_id', 1)->get();
To include trashed tickets, you must specifically call the withTrashed
function in your query.
$tickets = \App\Modules\Ticket\Models\Ticket::withTrashed()->where('department_id', 1)->get();
Model Relations
If you load a ticket via another model this will exclude trashed tickets and now return NULL
.
// Example 1 - eager loading
$message = \App\Modules\Ticket\Models\Message::with('ticket')->first();
$message->ticket;
// Example 2 - lazy loading
$message = \App\Modules\Ticket\Models\Message::first();
$message->ticket;
To include trashed tickets we need to use withTrashed
:
// Example 1 - eager loading
$message = \App\Modules\Ticket\Models\Message::with([ 'ticket' => function ($query) {
$query->withTrashed();
} ])->first();
$message->ticket;
// Example 2 - lazy loading
$message = \App\Modules\Ticket\Models\Message::first();
$message->load([ 'ticket' => function ($query) {
$query->withTrashed();
} ]);
$message->ticket;
Query Builder
If you use the query builder directly (DB
facade), then this will include trashed tickets by default.
// Example 1
$tickets = \DB::table('ticket')->where('department_id', 1)->get();
// Example 2
$messages = = \DB::table('ticket_message')
->join('ticket', 'ticket.id', '=', 'ticket_message.ticket_id')
->get();
You can exclude trashed tickets by checking if the deleted_at
column is NULL
.
// Example 1
$tickets = \DB::table('ticket')->whereNull('deleted_at')->where('department_id', 1)->get();
// Example 2
$messages = = \DB::table('ticket_message')
->join('ticket', 'ticket.id', '=', 'ticket_message.ticket_id')
->whereNull('ticket.deleted_at')
->get();
Other Important Changes
-
PHP 7.3 support
PHP 7.3 is now supported, it requires ionCube Loaders v10.3 to be installed. -
Ticket trash can
Tickets can no longer be permanently deleted straight away, instead the option to 'move to trash' has been introduced and a specific trash view where all trashed tickets can be viewed. From this view, they can either be restored or permanently deleted, or the system will automatically clean it up after 30 days by default. The number of days after which the trash is cleaned automatically can be modified. -
Gravatar can now be disabled
Gravatar, which stands for globally recognised avatar, is a service where users can register their email address and an avatar. Any website which supports Gravatar will then automatically display the avatar without any effort required by the user. In order for this to work, the help desk shares an MD5 hash of the users email address with secure.gravatar.com. Some may consider this to be leaking information (links are publicly available in the HTML and a connection is also made to Gravatar). Therefore, we've added the option to disable the functionality. -
API now checks spam rules
Tickets and replies created by users (customers) via the API are now blocked if they match a spam rule. Spam rules are not checked on internal tickets and operator replies. -
User 'Account Active' / 'confirmed' field changes
Previously the 'confirmed' field on the user table would be used to both confirm the user owns their email address as well as a way of disabling their account. We've now created a new field called 'active' which allows you to disable a user's account irrespective of whether they have confirmed ownership of their email address or not. For backwards compatibility, the old 'user account active' condition (in filters, macros, and so on) has been renamed to 'user email confirmed' and there is a new 'user account active' condition that makes use of the new 'active' field.