KMP PHP API Reference

BackupsController extends AppController
in package

Manages database backups: list, create, restore, download, delete, settings.

Table of Contents

Constants

VIEW_DATA_EVENT  = 'KMP.plugins.callForViewData'
VIEW_PLUGIN_EVENT  = 'KMP.plugins.callForViewCells'

Properties

$isCsvRequest  : bool
$pluginViewCells  : array<string|int, mixed>

Methods

beforeFilter()  : Response|null|void
Pre-action filter for application-wide processing.
create()  : Response|null
Create a new backup.
delete()  : Response|null
Delete a backup record and its file.
download()  : Response
Download a backup file.
index()  : void
List all backups and show settings panel.
initialize()  : void
Set up this component.
isCsvRequest()  : bool
Check if current request is for CSV export.
restore()  : Response|null
Restore from an existing backup.
settings()  : Response|null
Save backup settings (encryption key, schedule, retention).
status()  : Response
Return current restore lock/progress status for polling clients.
switchView()  : Response
Switch between mobile and desktop view modes.
authorizeCurrentUrl()  : void
Authorize the current URL/action via Authorization component.
organizeViewCells()  : array<string|int, mixed>
Organize view cells by type and display order.
jsonResponse()  : Response
Build a JSON response payload for AJAX restore flows.
markStaleRunningBackups()  : void
Mark old "running" backup rows as failed so the UI reflects actionable state.

Constants

VIEW_DATA_EVENT

public string VIEW_DATA_EVENT = 'KMP.plugins.callForViewData'

Event for plugin view data enhancement

VIEW_PLUGIN_EVENT

public string VIEW_PLUGIN_EVENT = 'KMP.plugins.callForViewCells'

Event for plugin view cell registration

Properties

$isCsvRequest

protected bool $isCsvRequest = false

Whether current request is for CSV export (.csv extension)

$pluginViewCells

protected array<string|int, mixed> $pluginViewCells = []

View cells from plugins for current request

Methods

beforeFilter()

Pre-action filter for application-wide processing.

public beforeFilter(EventInterface $event) : Response|null|void

Handles: CSV detection, plugin validation, navigation history, view cell loading, and Turbo Frame detection.

Parameters
$event : EventInterface

The beforeFilter event

Return values
Response|null|void

create()

Create a new backup.

public create() : Response|null
Return values
Response|null

delete()

Delete a backup record and its file.

public delete(int $id) : Response|null
Parameters
$id : int
Return values
Response|null

download()

Download a backup file.

public download(int $id) : Response
Parameters
$id : int
Return values
Response

isCsvRequest()

Check if current request is for CSV export.

public isCsvRequest() : bool
Return values
bool

restore()

Restore from an existing backup.

public restore([int|null $id = null ]) : Response|null
Parameters
$id : int|null = null
Return values
Response|null

settings()

Save backup settings (encryption key, schedule, retention).

public settings() : Response|null
Return values
Response|null

status()

Return current restore lock/progress status for polling clients.

public status() : Response
Return values
Response

switchView()

Switch between mobile and desktop view modes.

public switchView() : Response

Stores preference in session and redirects to appropriate interface. Mobile redirects to viewMobileCard, desktop to profile.

Return values
Response

Redirect response

authorizeCurrentUrl()

Authorize the current URL/action via Authorization component.

protected authorizeCurrentUrl() : void
Tags
throws
ForbiddenException

When authorization fails

organizeViewCells()

Organize view cells by type and display order.

protected organizeViewCells(array<string|int, mixed> $viewCells) : array<string|int, mixed>

Unused - view cells organized in ViewCellRegistry

Parameters
$viewCells : array<string|int, mixed>

Flat array of view cell configurations

Return values
array<string|int, mixed>

Organized array grouped by type and sorted by order

jsonResponse()

Build a JSON response payload for AJAX restore flows.

private jsonResponse(array<string, mixed> $payload[, int $status = 200 ]) : Response
Parameters
$payload : array<string, mixed>
$status : int = 200
Return values
Response

markStaleRunningBackups()

Mark old "running" backup rows as failed so the UI reflects actionable state.

private markStaleRunningBackups() : void

        
On this page

Search results