Skip to content

Commit

Permalink
CacheExtension: journal service SQLiteJournal is added only when exte…
Browse files Browse the repository at this point in the history
…nsion pdo_sqlite is loaded
  • Loading branch information
dg committed Feb 22, 2016
1 parent bee3e97 commit 52497ab
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Bridges/CacheDI/CacheExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
}
Expand Down

0 comments on commit 52497ab

Please sign in to comment.