geoproject-app/public/site/plugins/map-editor/routes/image/clear-flag.php
isUnknown 208d46ff28
All checks were successful
Deploy / Build and Deploy to Production (push) Successful in 19s
refactor: one PHP file per route with subdirectories
Properly organize routes following design-to-pack pattern:
- routes/markers/get.php
- routes/markers/create.php
- routes/markers/update.php
- routes/markers/delete.php
- routes/position/update.php
- routes/image/capture.php
- routes/image/check-flag.php
- routes/image/clear-flag.php

Each route in its own file for better maintainability.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-06 11:58:54 +01:00

41 lines
1,020 B
PHP

<?php
/**
* DELETE clear regeneration flag
*/
return [
'pattern' => 'map-editor/pages/(:all)/clear-regenerate-flag',
'method' => 'DELETE',
'auth' => false,
'action' => function (string $pageId) {
try {
$page = kirby()->page($pageId);
if (!$page) {
return [
'status' => 'error',
'message' => 'Page not found',
'code' => 404
];
}
$markerFile = $page->root() . '/.regenerate-map-image';
if (file_exists($markerFile)) {
unlink($markerFile);
}
return [
'status' => 'success',
'data' => [
'message' => 'Flag cleared'
]
];
} catch (Exception $e) {
return [
'status' => 'error',
'message' => $e->getMessage(),
'code' => 500
];
}
}
];