feat: eliminate htaccess.conf, move all URL routes to pp_routes (v0.329-0.330)

- Add category_id, page_id, article_id, type columns to pp_routes (migration 0.329)
- Move routing block in index.php before checkUrlParams() with Redis cache
- Routes for categories, pages, articles now stored in pp_routes instead of .htaccess
- Delete category/page/article routes on entity delete in respective repositories
- Eliminate libraries/htaccess.conf: generate .htaccess content entirely from PHP
- Move 32 static system routes (koszyk, logowanie, newsletter, AJAX modules, etc.)
  plus dynamic language/producer routes to pp_routes with type='system'
- Invalidate pp_routes Redis cache on every htacces() regeneration

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 22:06:33 +01:00
parent b8ed7a46d8
commit d83d0ecdea
13 changed files with 1139 additions and 262 deletions

View File

@@ -513,7 +513,7 @@ class ArticleRepositoryTest extends TestCase
$mockDb = $this->createMock(\medoo::class);
$deleteCalls = [];
$mockDb->expects($this->exactly(5))
$mockDb->expects($this->exactly(6))
->method('delete')
->willReturnCallback(function ($table, $where) use (&$deleteCalls) {
$deleteCalls[] = ['table' => $table, 'where' => $where];
@@ -524,12 +524,13 @@ class ArticleRepositoryTest extends TestCase
$result = $repository->deletePermanently(77);
$this->assertTrue($result);
$this->assertCount(5, $deleteCalls);
$this->assertCount(6, $deleteCalls);
$this->assertSame('pp_articles_pages', $deleteCalls[0]['table']);
$this->assertSame('pp_articles_langs', $deleteCalls[1]['table']);
$this->assertSame('pp_articles_images', $deleteCalls[2]['table']);
$this->assertSame('pp_articles_files', $deleteCalls[3]['table']);
$this->assertSame('pp_articles', $deleteCalls[4]['table']);
$this->assertSame('pp_routes', $deleteCalls[4]['table']);
$this->assertSame('pp_articles', $deleteCalls[5]['table']);
}
public function testPagesSummaryForArticlesBuildsLabels(): void

View File

@@ -175,14 +175,19 @@ class CategoryRepositoryTest extends TestCase
$mockDb = $this->createMock(\medoo::class);
$mockDb->method('count')->willReturn(0);
$mockDb->expects($this->once())
$deleteCalls = [];
$mockDb->expects($this->exactly(2))
->method('delete')
->with('pp_shop_categories', ['id' => 8])
->willReturn(true);
->willReturnCallback(function ($table, $where) use (&$deleteCalls) {
$deleteCalls[] = ['table' => $table, 'where' => $where];
return true;
});
$repository = new CategoryRepository($mockDb);
$this->assertTrue($repository->categoryDelete(8));
$this->assertSame('pp_shop_categories', $deleteCalls[0]['table']);
$this->assertSame('pp_routes', $deleteCalls[1]['table']);
}
public function testCategoryTitleReturnsEmptyWhenNotFound(): void