ver. 0.293: Code review fixes — 6 repositories, 16 fixes

- ArticleRepository: SQL injection fix (addslashes→parameterized), DRY refactor topArticles/newsListArticles
- AttributeRepository: dead class_exists('\S') blocking cache/temp clear
- CategoryRepository: dead class_exists('\S') blocking SEO link generation (critical)
- BannerRepository: parameterize $today in SQL + null guard on query()
- BasketCalculator: null guard checkProductQuantityInStock + optional DI params
- PromotionRepository: null guard on $basket (production fatal)
- OrderRepository/ShopBasketController/ajax.php: explicit DI in BasketCalculator callers

614 tests, 1821 assertions (+4 new)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 01:07:39 +01:00
parent 29821bccf2
commit 054b1b4a34
19 changed files with 297 additions and 218 deletions

View File

@@ -4,7 +4,34 @@ Logi zmian z migracji na Domain-Driven Architecture. Najnowsze na gorze.
---
## ver. 0.294 (2026-02-18) - Usuniecie autoload/shop/ — 12 legacy klas
## ver. 0.293 (2026-02-19) - Code review: fixes ArticleRepository, AttributeRepository, BannerRepository, BasketCalculator, CategoryRepository, PromotionRepository
- **ArticleRepository** (7 fixes):
- FIX: `articlesByDateAdd()` — SQL injection (addslashes→parameterized queries), dodano parametr `$langId`
- FIX: `articleDetailsFrontend()` — uproszczono select()+foreach→get()
- FIX: `articlesIds()`, `pageArticlesCount()` — parametryzacja `$langId`
- FIX: `topArticles()`, `newsListArticles()` — DRY refactor via `fetchArticlesByPage()`, parametryzacja
- **AttributeRepository** (1 fix):
- FIX: `clearTempAndCache()` — martwy `class_exists('\S')` blokował czyszczenie cache/temp
- **CategoryRepository** (2 fixes):
- FIX: `refreshCategoryArtifacts()` — martwy `class_exists('\S')` blokował czyszczenie htaccess/temp
- FIX: `normalizeSeoLink()`**krytyczny bug** — linki SEO kategorii nigdy nie były generowane od usunięcia `\S`
- **BannerRepository** (2 fixes):
- FIX: `banners()`, `mainBanner()` — parametryzacja `$today` w SQL + null guard na `query()`
- **BasketCalculator** (3 fixes):
- FIX: `checkProductQuantityInStock()` — dodano `is_array()` guard (foreach na null→fatal)
- FIX: `summaryPrice()` — dodano opcjonalne DI params `$langId`, `$productRepo` z fallbackiem do globals
- FIX: `calculateBasketProductPrice()` — dodano opcjonalny `$productRepo` z fallbackiem do globals
- **PromotionRepository** (1 fix):
- FIX: `findPromotion()` — null guard na `$basket` (produkcyjny fatal error)
- **OrderRepository** — zaktualizowano callery BasketCalculator (jawne DI zamiast globals), usunięto redundantne tworzenie ProductRepository w pętli
- **ShopBasketController**, **ajax.php** — zaktualizowano callery summaryPrice (jawne `$lang_id`)
- **CLASS_CATALOG.md** — zaktualizowano katalog dla 5 klas (rzeczywiste metody + znaczniki przeglądu)
- Testy: 614 OK, 1821 asercji (+4 nowe testy BasketCalculator)
---
## ver. 0.292 (2026-02-18) - Usuniecie autoload/shop/ — 12 legacy klas
- **Faza 5.1: class.Order.php (~562 linii) USUNIETA**
- Logika Apilo sync przeniesiona do `OrderAdminService::processApiloSyncQueue()`