From b8b7f82d393b3ba943473e83cde71d3a043e6064 Mon Sep 17 00:00:00 2001 From: Abraham Date: Fri, 10 Apr 2026 16:43:51 +0200 Subject: [PATCH] Replace scrapbook with symfony cache --- app/config/config.yml | 25 ++++-------------------- composer.json | 4 ++-- src/Common/Tests/ModulesSettingsTest.php | 11 +++++------ 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/app/config/config.yml b/app/config/config.yml index a5634699c2..e5e937a373 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -26,6 +26,9 @@ framework: adapter: cache.app public: true default_lifetime: 3600 + cache.pool: + adapter: cache.app + public: true mailer: dsn: '%mailer.dsn%' messenger: @@ -158,27 +161,7 @@ services: - [ execute, [ 'SET sql_mode = REPLACE(@@SESSION.sql_mode, "ONLY_FULL_GROUP_BY", "")'] ] - [ setDebug, [ "%kernel.debug%" ]] SpoonDatabase: '@database' - cache.filesystem.adapter: - class: League\Flysystem\Adapter\Local - arguments: - - "%kernel.cache_dir%" - cache.filesystem.filesystem: - class: League\Flysystem\Filesystem - arguments: - - "@cache.filesystem.adapter" - cache.adapter: - class: MatthiasMullie\Scrapbook\Adapters\Flysystem - arguments: - - "@cache.filesystem.filesystem" - cache.buffer: - class: MatthiasMullie\Scrapbook\Buffered\BufferedStore - arguments: - - "@cache.adapter" - cache.pool: - class: MatthiasMullie\Scrapbook\Psr6\Pool - public: true - arguments: - - "@cache.buffer" + cache.backend_navigation: class: Backend\Core\Engine\NavigationCache public: true diff --git a/composer.json b/composer.json index 3276bca156..3efcb14254 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,6 @@ "mailmotor/campaignmonitor-bundle": "^3.0", "mailmotor/mailchimp-bundle": "^4.0", "mailmotor/mailmotor-bundle": "^4.0", - "matthiasmullie/scrapbook": "^1.3", "pimple/pimple": "^3.2", "spoon/library": "^4.0", "symfony/monolog-bundle": "^3.1", @@ -57,7 +56,8 @@ "twig/cssinliner-extra": "^3.23", "twig/string-extra": "^3.23", "twig/inky-extra": "^3.23", - "symfony/uid": "^5.4" + "symfony/uid": "^5.4", + "symfony/cache": "^5.4" }, "require-dev": { "jdorn/sql-formatter": "1.2.17", diff --git a/src/Common/Tests/ModulesSettingsTest.php b/src/Common/Tests/ModulesSettingsTest.php index 0f9fbf1add..58e5bf7823 100644 --- a/src/Common/Tests/ModulesSettingsTest.php +++ b/src/Common/Tests/ModulesSettingsTest.php @@ -3,10 +3,9 @@ namespace Common\Tests; use Common\ModulesSettings; -use MatthiasMullie\Scrapbook\Adapters\MemoryStore; -use MatthiasMullie\Scrapbook\Psr6\Pool; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; +use Symfony\Component\Cache\Adapter\ArrayAdapter; /** * Tests for our module settings @@ -17,7 +16,7 @@ public function testFetchingSettingsCallsTheDatabaseOnce(): void { $modulesSettings = new ModulesSettings( $this->getDatabaseMock(), - new Pool(new MemoryStore()) + new ArrayAdapter() ); $modulesSettings->get('Core', 'theme', 'Fork'); @@ -28,7 +27,7 @@ public function testFetchingSettingWorks(): void { $modulesSettings = new ModulesSettings( $this->getDatabaseMock(), - new Pool(new MemoryStore()) + new ArrayAdapter() ); self::assertEquals( @@ -45,7 +44,7 @@ public function testDefaultValueWillBeReturned(): void { $modulesSettings = new ModulesSettings( $this->getDatabaseMock(), - new Pool(new MemoryStore()) + new ArrayAdapter() ); self::assertEquals( @@ -58,7 +57,7 @@ public function testFetchingSettingsForAModule(): void { $modulesSettings = new ModulesSettings( $this->getDatabaseMock(), - new Pool(new MemoryStore()) + new ArrayAdapter() ); self::assertEquals(