| 1 |
<?php |
| 2 |
namespace Mgleis\DiskUsageInsights\Frontend\Controller; |
| 3 |
|
| 4 |
use Mgleis\DiskUsageInsights\Domain\DatabaseRepository; |
| 5 |
use Mgleis\DiskUsageInsights\Plugin; |
| 6 |
|
| 7 |
class DeleteSnapshotController { |
| 8 |
|
| 9 |
public function delete() { |
| 10 |
check_ajax_referer(Plugin::NONCE); |
| 11 |
|
| 12 |
// TODO validate parameter |
| 13 |
$snapshot = sanitize_file_name(wp_unslash($_POST['snapshot'] ?? '')); |
| 14 |
|
| 15 |
(new DatabaseRepository())->deleteDatabase($snapshot); |
| 16 |
|
| 17 |
(new ShowSnapshotsController())->execute(); |
| 18 |
wp_die(); |
| 19 |
} |
| 20 |
|
| 21 |
} |