mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
Extract SearchController from public/search.php
Move all data-fetching and request logic out of the 285-line search page into src/SearchController.php: - SearchController::create() — static factory; builds RateLimit + Database dependencies, sends HTTP 429 (and exits) if rate limit is exceeded, runs probabilistic cleanup, returns ready instance - SearchController::handle() — sanitises GET params (query/year/orientation/ ap_program/keyword), runs all DB queries (searchTheses, countSearchResults, getAvailableYears, getAllOrientations, getAllAPPrograms, getUsedTags, getPublishedAuthors), builds alphabetical author→id map, assembles OG/meta tags, returns a flat array of view variables - Rate-limit 429 HTML response moved into private sendRateLimitResponse() public/search.php is now a 6-line dispatcher: require SearchController; extract(SearchController::create()->handle()); followed by the unchanged view template (162 lines total, was 285). The view template is byte-for-byte equivalent: same HTML, same variable names, same pagination partial include.
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
## Controller Extraction (In Progress)
|
||||
|
||||
- [ ] Extract `SearchController` — most complex public page
|
||||
- [x] Extract `SearchController` — `src/SearchController.php`; rate-limiting, param sanitisation, DB queries, OG meta, and author-map construction moved out of `public/search.php`; entry point is now a 6-line dispatcher (`create()` + `handle()` + `extract()`); view template unchanged
|
||||
- [ ] Extract `SystemController` — biggest single-file win, 500→8 lines
|
||||
- [ ] Extract `ThesisEditController` — merges `edit.php` + `actions/edit.php`, deduplicates jury fieldset
|
||||
- [ ] Extract remaining controllers one by one
|
||||
|
||||
Reference in New Issue
Block a user