  You're browsing the documentation for an old version of SupportPal. Consider upgrading to the [latest version](https://docs.supportpal.com/current/Documentation+Home). 

# Upgrading to 5.0 from 4.2

SupportPal 5.0 is a major release with some breaking changes. The focus of this release is around improving the...

  This upgrade guide is aimed at those upgrading from the last stable version (4.2.x) to 5.0.0. 

  **Backup!**  
 Before attempting an upgrade, please take a [backup](Backup+and+Restore#Backup) of both your SupportPal database and all associated SupportPal files, then verify the backup is valid (not corrupt). If you use either of our operator panel [system update](System+Update) or [app update command](App+Update+Command) options, a backup will automatically be taken before performing the update. 

## What's New?

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

---

## New System Requirements

Please ensure your server meets the server requirements before trying to upgrade.

- The new minimum PHP version is now **8.1.0**.  
     PHP 7.4 has reached [end of life](https://www.php.net/supported-versions.php) and support for it has been dropped in this release.
- The new minimum MySQL version is now **5.7** and minimum MariaDB version is now **10.2**.  
     MySQL 5.6 has reached [end of life](https://endoflife.date/mysql) and support for it has been dropped in this release. Support for MariaDB 10.0 and 10.1 has similarly been dropped.
- The new minimum version for ionCube loaders is now **12.0.5**.
- A new directory `storage/framework/locks` is included in the release and must be read/writable.

---

## Important Changes

 **SLA Plan Escalation Rules**  
 The due time for the next reply to the ticket and for its resolution are now shown separately. Escalation rules can now specifically target either the reply due time or resolve due time being breached - see [SLA Plans](SLA+Plans) for a description of the new functionality. To maintain backwards compatibility, when upgrading all existing escalation rules will be duplicated to run in both scenarios.  
   
 We strongly advise to review your SLA plan escalation rules post-upgrade.

 **Removed Commands**  
 The `app:backup`, `app:restore`, `app:update` commands must now be called from the app-manager path, as shown below. They have been deprecated since 4.2.0 and will no longer work as of this release.

```

    php app-manager/artisan app:backup
    php app-manager/artisan app:restore
    php app-manager/artisan app:update

```

 **Email Driver**  
 The `php-imap` email driver has been removed completely from this release and is no longer an optional PHP requirement of the system. Horde has been the default email driver since SupportPal 3.2.0 due to additional features such as OAuth support, no changes should be necessary.

 **Memcached Support Removed**  
 Memcached is no longer supported as a cache driver. We recommend to switch to the [Redis cache driver](Redis) instead.

 **Reports**  
 The reports covering first response time and time to resolution require some data to be generated and stored in the database in the background. This is done shortly after the upgrade has completed, so these reports may be missing data until this has finished.

 **Report endpoints removed from API**  
 The `/api/reports` and `/api/report/{category}/{name}` end points have been removed. We recommend to make use of the export functionality built-in to the report dashboards.

---

## Docker Deployment Changes

### AWS Elastic Beanstalk

 We are no longer maintaining our pre-built Elastic Beanstalk configurations from the `supportpal/helpdesk-install` repository and as such they have been removed. If you're using those configurations, you're welcome to continue but will need to maintain them yourself.

### Monolithic Deployments

  The below information is only relevant to those who have deployed SupportPal using [Docker (Monolithic)](Deploy+on+Docker). 

###### Important: HTTP/HTTPS changes

 The default value of the `HTTPS_ENABLED` environment variable has been changed to `0`. This is to prevent unnecessary requests to the certificate authorities when SSL connections are not required. If your help desk permits SSL (HTTPS) connections you **must** now enable the `HTTPS_ENABLED` environment value. Follow [configuring Free SSL](Deploy+on+Docker#free-ssl-via-letsencrypt-zerossl) for guidance, and make these files changes before [upgrading](Upgrade+Guide#UpgradeDockerMonolithic) to v5.

###### Recommended: Cron MAILTO Directive

 We recommend to add `MAILTO=your@email.address` to your `.env` file. This will now notify you via email if there are any issues processing the cron job.

### Compose Deployments

 Documentation for deployments using the [ github://supportpal/helpdesk-install/templates/docker-compose ](https://github.com/supportpal/helpdesk-install/tree/master/templates/docker-compose) repository has moved. It can now be found in the `.md` files within the aforementioned repository directory.

---

## Config File Changes

 **config/email.php**  
 The following configuration options have been removed:

- `imap_driver`
- `imap_open`

 **config/trustedproxy.php**  
 The following configuration options have been removed:

- `headers`

---

## Email Template Changes

As part of changes to the email verification system, a number of email templates have been updated. The upgrader will automatically attempt to update the email templates if they have not been modified. The full list of changes can be found below.

#### User - Account confirmation

*This email template has been renamed to "Account verification".*

 Subject: Account verification  Expand  Collapse

```
 Dear {{ user.formatted_name }},<br>
 <br>
 Thank you for registering an account at our help desk.<br>
 <br>
-To finish the activation process, please confirm your email address by clicking the link below:<br>
+To finish the activation process, please verify your email address by clicking the link below:<br>
-<a href="{{ confirmation_link }}">{{ confirmation_link }}</a><br>
+<a href="{{ verification_link }}">{{ verification_link }}</a><br>
 <br>
 The above link will be valid for the next 24 hours. If you do not activate the account in time, you may re-register at the help desk at any time.<br>
 <br>
 Kind Regards,<br>
 <strong>{{ brand.name }}</strong>
```


#### User - Added as new organisation user

*This email template has been renamed to "Organisation invitation".*

 Subject: Invited to join organisation  Expand  Collapse

```
 Dear {{ user.formatted_name }},<br>
 <br>
-An account has been created for you at our support help desk by {{ owner.formatted_name }}, you will have access to tickets that have been opened by {{ owner.formatted_name }}. To finish the activation process, please confirm your email address by clicking the link below:<br>
+You have been invited by {{ owner.formatted_name }} to join {{ organisation.name }}.<br></br>
-<a href="{{ confirmation_link }}">{{ confirmation_link }}</a><br>
+<a href="{{ invitation_link }}">Accept Invitation</a><br>
-<br>
-The above link will be valid for the next 24 hours. If you do not activate the account in time, you may re-register at the help desk.<br>
 <br>
 Kind Regards,<br>
 <strong>{{ brand.name }}</strong>
```


#### User - Confirm new email address

*This email template has been renamed to "Verify new email address".*

 Subject: Verify your new email address  Expand  Collapse

```
 Dear {{ user.formatted_name }},<br>
 <br>
-If you made this change, please confirm your new email address by clicking the link below:<br>
+If you made this change, please verify your new email address by clicking the link below:<br>
-<a href="{{ confirmation_link }}">{{ confirmation_link }}</a><br>
+<a href="{{ verification_link }}">{{ verification_link }}</a><br>
 <br>
 The above link will be valid for the next 24 hours. If you do not activate the account in time, you may re-register at the help desk.<br>
 <br>
 Kind Regards,<br>
 <strong>{{ brand.name }}</strong>
```


#### User - New account details

 Subject: A user account has been created for you  Expand  Collapse

```
 Dear {{ user.formatted_name }},<br>
 <br>
 We just set up an account for you at our help desk. All you need to do now is set a password, it only takes a few seconds.<br>
 <br>
 Click the below link to get started:<br>
-<a href="{{ confirmation_link }}">{{ confirmation_link }}</a><br>
+<a href="{{ verification_link }}">{{ verification_link }}</a><br>
 <br>
 The above link will be valid for the next 7 days. If you do not activate the account in time, you may re-register at the help desk at any time.<br>
 <br>
 Kind Regards,<br>
 <strong>{{ brand.name }}</strong>
```


#### User - Password reset

 Subject: Password reset verification  Expand  Collapse

```
 Dear {{ user.formatted_name }},<br>
 <br>
-We received a request to reset your password at our help desk, please confirm your email address by clicking the link below, after which you will be able to set a new password:<br>
+We received a request to reset your password at our help desk, please verify your email address by clicking the link below, after which you will be able to set a new password:<br>
-<a href="{{ confirmation_link }}">{{ confirmation_link }}</a><br>
+<a href="{{ verification_link }}">{{ verification_link }}</a><br>
 <br>
 The above link will be valid for the next 24 hours. If you did not make this request, please inform our support team.<br>
 <br>
 Kind Regards,<br>
 <strong>{{ brand.name }}</strong>
```


#### Operator - Password reset

 Subject: Password reset verification  Expand  Collapse

```
-A request has been made to reset the password for your help desk operator account, please confirm your email address by clicking the link below, after which you will be able to set a new password:<br>
+A request has been made to reset the password for your help desk operator account, please verify your email address by clicking the link below, after which you will be able to set a new password:<br>
-<a href="{{ confirmation_link }}">{{ confirmation_link }}</a><br>
+<a href="{{ verification_link }}">{{ verification_link }}</a><br>
 <br>
 The above link will be valid for the next 24 hours. If you did not make this request, please inform an administrator.
```


#### Operator - User export ready

 Subject: Export ready  Expand  Collapse

```
 An export you requested has been processed and is now ready for download:<br>
-<a href="{{ download_url }}">{{ filename }}</a><br>
+<a href="{{ download_url }}">{{ filename }}</a>
-<br>
-If you need to delete the export or request a new one, you can do so from the edit user page as linked below. A list of previous exports will also be available.<br>
-<a href="{{ edit_url }}">{{ edit_url }}</a>
```


There are also two new email templates:

- User - Additional email address added
- User - Verify email address

---

## Development Changes

  All custom plugins will be automatically disabled on upgrade and must be manually reactivated. Plugins we serve from our marketplace will automatically attempt to be upgraded. We would recommend to read over this section and ensure each plugin works on 5.0.0 before reactivating. 

### Framework

 We've upgraded the core framework (`laravel/framework`) from version 8 to 10. Please review the upgrade guides for breaking changes:

1. [8.x to 9.x](https://laravel.com/docs/9.x/upgrade)
2. [9.x to 10.x](https://laravel.com/docs/10.x/upgrade)

 We recommend testing any customisations on a development installation before upgrading your help desk. Please contact us for a development license key if you don't already have one.

### Database and Queries

 To support `sql_require_primary_key` in MySQL and `innodb_force_primary_key` in MariaDB, we have added an `id` column to all membership/pivot tables. This may impact your customisations such as reports or add-ons if they use join queries. For example, a join query without a table name may now throw an ambiguous column error.

```

-Upload::leftJoin('email_log_raw', 'email_log_raw.upload_id', '=', 'id');
+Upload::leftJoin('email_log_raw', 'email_log_raw.upload_id', '=', 'upload.id');

```

 Similarly, a join query that selects an `id` column without specifying the table name may now return the `id` belonging to the joined table. This case needs to be carefully reviewed as it will not throw an error.

```

-Upload::leftJoin('email_log_raw', 'email_log_raw.upload_id', '=', 'upload.id')->pluck('id');
+Upload::leftJoin('email_log_raw', 'email_log_raw.upload_id', '=', 'upload.id')->pluck('upload.id');

```

### Reports

The report framework has been replaced in this version and old reports will no longer function. Due to the differences in the frameworks, it is not possible to migrate old reports. You must develop new reports following our [Report Development](Report+Development) guide.

### Add-ons

There are some breaking changes to be aware of if you use [Form Requests](Plugin+Development+Form+Requests) or [API Controllers](Plugin+Development+Controllers#APIController)/[API Route Files](Plugin+Development+Routes#PredefinedRouteFiles) within your add-ons.

##### Web Requests

The following Request classes have been renamed:

- `App\Http\Requests\Request` is now `App\Http\Requests\FormRequest`
- `App\Http\Request` is now `App\Http\Requests\Request`

If your add-on uses [Form Requests](Plugin+Development+Form+Requests), you will need to update the class it extends:

Requests/SettingsRequest.php

```

    <?php

    namespace Addons\Plugins\HelloWorld\Requests;

    use App\Http\Requests\FormRequest;
    use Lang;

    class SettingsRequest extends FormRequest
    {
        ...

```

##### Web Controllers - Views

 The `\TemplateView::other` function has been deprecated and replaced with `\TemplateView::operator`, all instances should be updated as it will be removed in a future major release.

```

-return \TemplateView::other('Plugins#TimeTracking::settings')
+return \TemplateView::operator('Plugins#TimeTracking::settings')

```

There is a new `\TemplateView::frontend` function available for [returning frontend views](Plugin+Development+Views#FrontendViews).

##### API Requests

- `\App\Http\ApiRequest` has been replaced by `\App\Http\Requests\Request`
- `\App\Http\ApiFormRequest` has been replaced by `\App\Http\Requests\FormRequest`

##### API Controllers

 The library which we used to handle API requests has been removed in favor of core Laravel functionality. As such, the [ `Dingo\Api\Routing\Helpers`](https://github.com/dingo/api/blob/42b6afa6e20a27f938a45e676665e57d26422cea/src/Routing/Helpers.php#L16) trait no longer exists.

- `$this->response->array($array)` has been placed by `response()->json()`.
- `$this->response->error()` has been replaced by `new \Symfony\Component\HttpKernel\Exception\HttpException($code, $message);`
- `$this->response->errorNotFound()` has been replaced by `new \App\Exceptions\Api\ResourceNotFoundException($message);`

Controllers/ApiController.php

```

    <?php

    namespace Addons\Plugins\HelloWorld\Controllers;

    use App\Modules\Core\Controllers\BaseApiController;

    class ApiController extends BaseApiController
    {
        public function foo()
        {
            return response()->json([
                'status' => 'success',
                'data'   => 'foo',
            ]);
        }
    }

```

##### API Exceptions

 Exceptions in the `\Dingo\Api\Exception` namespace have been removed. The following new exceptions are available:

- `\Dingo\Api\Exception\ResourceException` replaced by `\App\Exceptions\Api\ResourceException`
- `\Dingo\Api\Exception\StoreResourceFailedException` replaced by `\App\Exceptions\Api\StoreResourceFailedException`
- `\Dingo\Api\Exception\UpdateResourceFailedException` replaced by `\App\Exceptions\Api\UpdateResourceFailedException`
- `\Dingo\Api\Exception\DeleteResourceFailedException` replaced by `\App\Exceptions\Api\DeleteResourceFailedException`

 All other exceptions should be replaced by `throw new \Symfony\Component\HttpKernel\Exception\HttpException($code, 'message');`

##### API Route Files

The `$api` variable no longer exists and `$router` should be used as found in the other route files.

```

-$api->version('v1', ['namespace' => 'Addons\Plugins\TimeTracking\Controllers\Api'], function ($api) {
+$router->group(['namespace' => 'Addons\Plugins\TimeTracking\Controllers\Api'], function ($router) {

```

All further references of `$api` should be replaced with `$router` in the file too.