File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -37,16 +37,20 @@ public function loadConfiguration()
3737
3838 $ builder = $ this ->getContainerBuilder ();
3939
40- $ builder ->addDefinition ($ this ->prefix ('journal ' ))
41- ->setClass (Nette \Caching \Storages \IJournal::class)
42- ->setFactory (Nette \Caching \Storages \SQLiteJournal::class, [$ this ->tempDir . '/cache/journal.s3db ' ]);
40+ if (extension_loaded ('pdo_sqlite ' )) {
41+ $ builder ->addDefinition ($ this ->prefix ('journal ' ))
42+ ->setClass (Nette \Caching \Storages \IJournal::class)
43+ ->setFactory (Nette \Caching \Storages \SQLiteJournal::class, [$ this ->tempDir . '/cache/journal.s3db ' ]);
44+ }
4345
4446 $ builder ->addDefinition ($ this ->prefix ('storage ' ))
4547 ->setClass (Nette \Caching \IStorage::class)
4648 ->setFactory (Nette \Caching \Storages \FileStorage::class, [$ this ->tempDir . '/cache ' ]);
4749
4850 if ($ this ->name === 'cache ' ) {
49- $ builder ->addAlias ('nette.cacheJournal ' , $ this ->prefix ('journal ' ));
51+ if (extension_loaded ('pdo_sqlite ' )) {
52+ $ builder ->addAlias ('nette.cacheJournal ' , $ this ->prefix ('journal ' ));
53+ }
5054 $ builder ->addAlias ('cacheStorage ' , $ this ->prefix ('storage ' ));
5155 }
5256 }
Original file line number Diff line number Diff line change @@ -29,16 +29,15 @@ class SQLiteJournal implements IJournal
2929
3030 public function __construct (string $ path )
3131 {
32+ if (!extension_loaded ('pdo_sqlite ' )) {
33+ throw new Nette \NotSupportedException ('SQLiteJournal requires PHP extension pdo_sqlite which is not loaded. ' );
34+ }
3235 $ this ->path = $ path ;
3336 }
3437
3538
3639 private function open (): void
3740 {
38- if (!extension_loaded ('pdo_sqlite ' )) {
39- throw new Nette \NotSupportedException ('SQLiteJournal requires PHP extension pdo_sqlite which is not loaded. ' );
40- }
41-
4241 if ($ this ->path !== ':memory: ' && !is_file ($ this ->path )) {
4342 touch ($ this ->path ); // ensures ordinary file permissions
4443 }
You can’t perform that action at this time.
0 commit comments