geoproject-app/public/site/plugins/map-editor/routes/image/check-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

39 lines
1,002 B
PHP

<?php
/**
* GET check if regeneration flag exists
*/
return [
'pattern' => 'map-editor/pages/(:all)/check-regenerate-flag',
'method' => 'GET',
'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';
$needsRegeneration = file_exists($markerFile);
return [
'status' => 'success',
'data' => [
'needsRegeneration' => $needsRegeneration
]
];
} catch (Exception $e) {
return [
'status' => 'error',
'message' => $e->getMessage(),
'code' => 500
];
}
}
];