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()
37
37
38
38
$ builder = $ this ->getContainerBuilder ();
39
39
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
+ }
43
45
44
46
$ builder ->addDefinition ($ this ->prefix ('storage ' ))
45
47
->setClass (Nette \Caching \IStorage::class)
46
48
->setFactory (Nette \Caching \Storages \FileStorage::class, [$ this ->tempDir . '/cache ' ]);
47
49
48
50
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
+ }
50
54
$ builder ->addAlias ('cacheStorage ' , $ this ->prefix ('storage ' ));
51
55
}
52
56
}
Original file line number Diff line number Diff line change @@ -29,16 +29,15 @@ class SQLiteJournal implements IJournal
29
29
30
30
public function __construct (string $ path )
31
31
{
32
+ if (!extension_loaded ('pdo_sqlite ' )) {
33
+ throw new Nette \NotSupportedException ('SQLiteJournal requires PHP extension pdo_sqlite which is not loaded. ' );
34
+ }
32
35
$ this ->path = $ path ;
33
36
}
34
37
35
38
36
39
private function open (): void
37
40
{
38
- if (!extension_loaded ('pdo_sqlite ' )) {
39
- throw new Nette \NotSupportedException ('SQLiteJournal requires PHP extension pdo_sqlite which is not loaded. ' );
40
- }
41
-
42
41
if ($ this ->path !== ':memory: ' && !is_file ($ this ->path )) {
43
42
touch ($ this ->path ); // ensures ordinary file permissions
44
43
}
You can’t perform that action at this time.
0 commit comments