From 52497abc5ea59374976cbb90701f723acb603fba Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sat, 20 Feb 2016 10:05:12 +0100 Subject: [PATCH] CacheExtension: journal service SQLiteJournal is added only when extension pdo_sqlite is loaded --- src/Bridges/CacheDI/CacheExtension.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Bridges/CacheDI/CacheExtension.php b/src/Bridges/CacheDI/CacheExtension.php index 3a5c176a..bcdcbbde 100644 --- a/src/Bridges/CacheDI/CacheExtension.php +++ b/src/Bridges/CacheDI/CacheExtension.php @@ -29,16 +29,20 @@ public function loadConfiguration() { $container = $this->getContainerBuilder(); - $container->addDefinition($this->prefix('journal')) - ->setClass('Nette\Caching\Storages\IJournal') - ->setFactory('Nette\Caching\Storages\SQLiteJournal', [$this->tempDir . '/cache/journal.s3db']); + if (extension_loaded('pdo_sqlite')) { + $container->addDefinition($this->prefix('journal')) + ->setClass('Nette\Caching\Storages\IJournal') + ->setFactory('Nette\Caching\Storages\SQLiteJournal', [$this->tempDir . '/cache/journal.s3db']); + } $container->addDefinition($this->prefix('storage')) ->setClass('Nette\Caching\IStorage') ->setFactory('Nette\Caching\Storages\FileStorage', [$this->tempDir . '/cache']); if ($this->name === 'cache') { - $container->addAlias('nette.cacheJournal', $this->prefix('journal')); + if (extension_loaded('pdo_sqlite')) { + $container->addAlias('nette.cacheJournal', $this->prefix('journal')); + } $container->addAlias('cacheStorage', $this->prefix('storage')); } }