refactor: one PHP file per route with subdirectories
All checks were successful
Deploy / Build and Deploy to Production (push) Successful in 19s
All checks were successful
Deploy / Build and Deploy to Production (push) Successful in 19s
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>
This commit is contained in:
parent
590c842072
commit
208d46ff28
11 changed files with 552 additions and 536 deletions
39
public/site/plugins/map-editor/routes/image/check-flag.php
Normal file
39
public/site/plugins/map-editor/routes/image/check-flag.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?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
|
||||
];
|
||||
}
|
||||
}
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue