# disk-usage-insights/1.5/src/Frontend/Controller/DeleteSnapshotController.php

Disk Usage Insights, version 1.5. 21 lines.

- Page: https://pluginprobe.com/plugins/disk-usage-insights/1.5/code/src/Frontend/Controller/DeleteSnapshotController.php
- Raw: https://pluginprobe.com/plugins/disk-usage-insights/1.5/raw/src/Frontend/Controller/DeleteSnapshotController.php
- Modified: 2024-12-19T11:33:52+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/disk-usage-insights/1.5/code/src/Frontend/Controller/DeleteSnapshotController.php#L10-L20`.

```php
<?php
namespace Mgleis\DiskUsageInsights\Frontend\Controller;

use Mgleis\DiskUsageInsights\Domain\DatabaseRepository;
use Mgleis\DiskUsageInsights\Plugin;

class DeleteSnapshotController {

    public function delete() {
        check_ajax_referer(Plugin::NONCE);

        // TODO validate parameter
        $snapshot = sanitize_file_name(wp_unslash($_POST['snapshot'] ?? ''));

        (new DatabaseRepository())->deleteDatabase($snapshot);

        (new ShowSnapshotsController())->execute();
        wp_die();
    }

}
```
