Backups
Implement
Add the ServerHostingBackupTrait to your Page and Action class:
Page handler
The following function in the page handler should return the parsed data of your backups. The function returns a ServerHostingBackupResponse(), which has...
Array of backupItems
(optional) Boolean if the user can create backups, and the backup limit.
(optional) Boolean if the integration supports custom names for backups
(optional) Integer of max allowed backups. (-1 if unlimited)
(optional) If the restore percentage is not specificly given for a single backup (explained below), but rather for the entire product, pass it here.
The backupItems are an array of ServerHostingBackupItem() which has...
ID of the backup (this will be used to restore & delete backups)
Carbon() date of creation
(optional) Display name
(optional) Boolean if the backup is available for restore
(optional) The size of the backup. You can return an integer in bytes or a string, which will be just printed out.
(optional) If the backup is currently in creation, the percentage of the creation as integer from 1 to 100
hostware will use this data to display the backup table. Depending on what data you have given, it will create table columns for date, name and size. If none of that are given, the ID will be displayed as last consequence.
Action handler
Integrate the following functions which create and restore the backup. They can either return a boolean if successfull (then a hostware-default backup message will be printed), an Exception for a custom error message or a ServerHostingProductActionResponse() if needed.
To minimize code lines and maximize the standardization of hostware, booleans should be used most of the time unless custom messages should be returned. Technical error messages should never be returned to the user, but rather logged using the LogService.