From ecd6270ca6ab75254c875cf9c93e0b76c69cc7ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20H=C3=BCbner?= Date: Mon, 13 Jul 2026 16:46:50 +0200 Subject: [PATCH] Remove dead code and stale configuration Dead PHP (grep-verified zero usages): - src/Air/ImportCache/{ImportCache,ImportCacheInterface}.php - src/Air/Util/ClassUtil.php and StringUtil.php - src/Twig/Extension/CronTwigExtension.php (uses Cron\CronExpression, but dragonmantank/cron-expression is not installed; the cron() Twig function is called in no template) - dropped the unused `use App\Entity\Zip;` import in RequestConverter (the Zip entity does not exist) Stale configuration: - config/services.yaml: removed the unused `locale` parameter, the consumer-less `$graphCacheDirectory` bind (+ GRAPH_CACHE_DIRECTORY in .env/.env.test), and the dead alias for the non-existent App\Air\Pollution\DataPersister namespace (the live persister lives in App\Air\DataPersister and that FQCN is referenced nowhere). - deleted config/packages/dev/easy_log_handler.yaml (registers EasyCorp\EasyLog\EasyLogHandler; package not installed, abandoned) - removed the controller-less `logout` route from config/routing/4_frontend.yaml (no security firewall, route name referenced nowhere) - removed the `/phpunit.xml` line from .gitignore (the file is tracked and consumed by CI directly) - fixed the "Kohlemnonooxid" -> "Kohlenmonoxid" keyword typo in sonata_seo.yaml Docs: - CLAUDE.md / README: corrected the search description (client-side @algolia/autocomplete-js + Nominatim, not Elasticsearch/Bloodhound); the Provider subsystem was already removed on main in #507. Co-Authored-By: Claude Opus 4.8 (1M context) --- .env | 2 - .env.test | 2 - .gitignore | 1 - CLAUDE.md | 6 +-- README.md | 2 +- config/packages/dev/easy_log_handler.yaml | 16 ------ config/packages/sonata_seo.yaml | 2 +- config/routing/4_frontend.yaml | 3 -- config/services.yaml | 5 -- .../RequestConverter/RequestConverter.php | 1 - src/Air/ImportCache/ImportCache.php | 54 ------------------- src/Air/ImportCache/ImportCacheInterface.php | 14 ----- src/Air/Util/ClassUtil.php | 26 --------- src/Air/Util/StringUtil.php | 17 ------ src/Twig/Extension/CronTwigExtension.php | 29 ---------- 15 files changed, 5 insertions(+), 175 deletions(-) delete mode 100644 config/packages/dev/easy_log_handler.yaml delete mode 100644 src/Air/ImportCache/ImportCache.php delete mode 100644 src/Air/ImportCache/ImportCacheInterface.php delete mode 100644 src/Air/Util/ClassUtil.php delete mode 100644 src/Air/Util/StringUtil.php delete mode 100644 src/Twig/Extension/CronTwigExtension.php diff --git a/.env b/.env index 0722230e..9791b612 100644 --- a/.env +++ b/.env @@ -15,8 +15,6 @@ APP_SECRET=90f2d22c92712fa1cc32be3a26f4e599 DATABASE_URL="postgresql://symfony:ChangeMe@127.0.0.1:5432/app?serverVersion=13&charset=utf8" ###< doctrine/doctrine-bundle ### -GRAPH_CACHE_DIRECTORY='/var/www/luft/public/img/graph_cache' - OPENWEATHERMAP_APPID='asdf' REDIS_HOST="localhost" diff --git a/.env.test b/.env.test index 1cd15cde..34086ac3 100644 --- a/.env.test +++ b/.env.test @@ -8,8 +8,6 @@ PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots ADMIN_PASSWORD=123 -GRAPH_CACHE_DIRECTORY='/var/www/luft/public/img/graph_cache' - OPENWEATHERMAP_APPID='asdf' REDIS_HOST="localhost" diff --git a/.gitignore b/.gitignore index c0f0af11..ec68ffc8 100644 --- a/.gitignore +++ b/.gitignore @@ -32,5 +32,4 @@ npm-debug.log ###> symfony/phpunit-bridge ### .phpunit .phpunit.result.cache -/phpunit.xml ###< symfony/phpunit-bridge ### diff --git a/CLAUDE.md b/CLAUDE.md index 255a3ca7..7a8e04cc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project Overview -Luft.jetzt is a Symfony 8.0 (PHP 8.5) web application that aggregates and displays air quality / pollution data from multiple sources (German Umweltbundesamt, Luftdaten, OpenWeatherMap). It uses PostgreSQL with PostGIS for geospatial queries, Elasticsearch for search, and Redis for caching. +Luft.jetzt is a Symfony 8.0 (PHP 8.5) web application that aggregates and displays air quality / pollution data from multiple sources (German Umweltbundesamt, Luftdaten, OpenWeatherMap). It uses PostgreSQL with PostGIS for geospatial queries and Redis for caching. Search/autocomplete is handled client-side by `@algolia/autocomplete-js` against prefetch endpoints plus Nominatim geocoding — there is no Elasticsearch integration in the application code. ## Common Commands @@ -74,12 +74,12 @@ REST API under `/api` with Swagger docs at `/api/doc` and OpenAPI JSON at `/api/ ### Frontend -Webpack Encore with two JS entry points (`app.js`, `datatables.js`) and SCSS. Uses Bootstrap 5, Leaflet for maps, Chart.js, Typeahead/Bloodhound for search, and Handlebars templates. +Webpack Encore with two JS entry points (`app.js`, `datatables.js`) and SCSS. Uses Bootstrap 5, Leaflet for maps, Chart.js, `@algolia/autocomplete-js` for search/autocomplete, and Handlebars templates. ## Infrastructure - **Database**: PostgreSQL 15 + PostGIS 3.3 (port 25432 via Docker, DB: `gis`, user: `docker`) -- **Search**: Elasticsearch 7.17.2 (port 9200) +- **Search/autocomplete**: `@algolia/autocomplete-js` (frontend) against prefetch endpoints + Nominatim geocoding; no Elasticsearch integration in the app (the `elasticsearch` service in `docker-compose.yml` is a legacy remnant) - **Cache**: Redis (port 6379) - **Locale**: German (`de`), host: `luft.jetzt` diff --git a/README.md b/README.md index c7db1a9f..0f157d4b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Dazu werden unterschiedliche Datenquellen angezapft, etwa die öffentlich zugän Luft.jetzt ist eine Symfony-4-Anwendung und benötigt den üblichen LAMP-Stack mit PHP 7.1. -Die Daten werden grundsätzlich in einer SQL-Datenbank gespeichert, werden aber zur Beschleunigung des Suchvorganges mit Elasticsearch indiziert; momentan ist mindestens Elasticsearch 6.3 notwendig. +Die Daten werden in einer PostgreSQL-Datenbank mit PostGIS-Erweiterung gespeichert; Redis dient als Cache. Die Suche/Autovervollständigung im Frontend läuft über `@algolia/autocomplete-js` gegen Prefetch-Endpunkte sowie Nominatim-Geocoding — eine Elasticsearch-Integration existiert im Anwendungscode nicht. ## Installation diff --git a/config/packages/dev/easy_log_handler.yaml b/config/packages/dev/easy_log_handler.yaml deleted file mode 100644 index 27bfc608..00000000 --- a/config/packages/dev/easy_log_handler.yaml +++ /dev/null @@ -1,16 +0,0 @@ -services: - EasyCorp\EasyLog\EasyLogHandler: - public: false - arguments: ['%kernel.logs_dir%/%kernel.environment%.log'] - -#// FIXME: How to add this configuration automatically without messing up with the monolog configuration? -#monolog: -# handlers: -# buffered: -# type: buffer -# handler: easylog -# channels: ['!event'] -# level: debug -# easylog: -# type: service -# id: EasyCorp\EasyLog\EasyLogHandler diff --git a/config/packages/sonata_seo.yaml b/config/packages/sonata_seo.yaml index 8021c3b7..c831578d 100644 --- a/config/packages/sonata_seo.yaml +++ b/config/packages/sonata_seo.yaml @@ -5,7 +5,7 @@ sonata_seo: default: sonata.seo.page.default metas: name: - keywords: Luft, Stickstoffdioxid, NO2, Schwefeldioxid, SO2, Kohlemnonooxid, CO, Ozon, O3, Feinstaub, PM10 + keywords: Luft, Stickstoffdioxid, NO2, Schwefeldioxid, SO2, Kohlenmonoxid, CO, Ozon, O3, Feinstaub, PM10 description: Aktuelle Luftmesswerte aus deiner Umgebung robots: index, follow 'twitter:site': '@calderacc' diff --git a/config/routing/4_frontend.yaml b/config/routing/4_frontend.yaml index a27d60a9..6b85bba8 100644 --- a/config/routing/4_frontend.yaml +++ b/config/routing/4_frontend.yaml @@ -29,6 +29,3 @@ display: _controller: App\Controller\DisplayController::indexAction options: expose: true - -logout: - path: /logout diff --git a/config/services.yaml b/config/services.yaml index 3fccbfa5..70b44114 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -4,7 +4,6 @@ # Put parameters here that don't need to change on each machine where the app is deployed # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration parameters: - locale: 'de' router.request_context.host: 'luft.jetzt' router.request_context.scheme: 'https' @@ -14,7 +13,6 @@ services: autowire: true autoconfigure: true bind: - $graphCacheDirectory: '%env(GRAPH_CACHE_DIRECTORY)%' $redisHost: 'redis://%env(REDIS_HOST)%' # makes classes in src/ available to be used as services @@ -39,9 +37,6 @@ services: arguments: $sonataSeoPage: '@sonata.seo.page.default' - App\Air\Pollution\DataPersister\PersisterInterface: - alias: App\Air\Pollution\DataPersister\PostgisPersister - App\Air\Geocoding\Guesser\CityGuesser: $provider: '@bazinga_geocoder.provider.nominatim' diff --git a/src/Air/Geocoding/RequestConverter/RequestConverter.php b/src/Air/Geocoding/RequestConverter/RequestConverter.php index 24b11878..8683e784 100644 --- a/src/Air/Geocoding/RequestConverter/RequestConverter.php +++ b/src/Air/Geocoding/RequestConverter/RequestConverter.php @@ -3,7 +3,6 @@ namespace App\Air\Geocoding\RequestConverter; use App\Air\Geocoding\Geocoder\GeocoderInterface; -use App\Entity\Zip; use App\Geo\Coordinate\Coordinate; use App\Geo\Coordinate\CoordinateInterface; use Doctrine\Persistence\ManagerRegistry; diff --git a/src/Air/ImportCache/ImportCache.php b/src/Air/ImportCache/ImportCache.php deleted file mode 100644 index 08441e73..00000000 --- a/src/Air/ImportCache/ImportCache.php +++ /dev/null @@ -1,54 +0,0 @@ -cacheAdapter = new RedisAdapter( - RedisAdapter::createConnection($redisHost), - self::CACHE_NAMESPACE, - self::TTL - ); - } - - #[\Override] - public function get(string $key): ?int - { - $cacheItem = $this->cacheAdapter->getItem($key); - - if (!$cacheItem->isHit()) { - return null; - } - - return (int) $cacheItem->get(); - } - - #[\Override] - public function has(string $key): bool - { - return $this->cacheAdapter->hasItem($key); - } - - #[\Override] - public function set(string $key, int $timestamp): void - { - $cacheItem = $this->cacheAdapter->getItem($key); - - $cacheItem->set($timestamp); - - $this->cacheAdapter->save($cacheItem); - } - - #[\Override] - public function clear(): void - { - $this->cacheAdapter->clear(); - } -} diff --git a/src/Air/ImportCache/ImportCacheInterface.php b/src/Air/ImportCache/ImportCacheInterface.php deleted file mode 100644 index 890283f1..00000000 --- a/src/Air/ImportCache/ImportCacheInterface.php +++ /dev/null @@ -1,14 +0,0 @@ -getShortName(); - } - - public static function getLowercaseShortname($object): string - { - return strtolower(self::getShortname($object)); - } - - public static function getUnderscoreShortname($object): string - { - return strtolower(self::getShortname($object)); - } -} diff --git a/src/Air/Util/StringUtil.php b/src/Air/Util/StringUtil.php deleted file mode 100644 index 836c1f23..00000000 --- a/src/Air/Util/StringUtil.php +++ /dev/null @@ -1,17 +0,0 @@ -cron(...), ['is_safe' => ['raw']]), - ]; - } - - public function cron(string $cronString, string $dateFormat): string - { - $cron = CronExpression::factory($cronString); - - return $cron->getPreviousRunDate()->format($dateFormat); - } -}