File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 2323 "nette/di" : " ~2.3" ,
2424 "latte/latte" : " ~2.3.0"
2525 },
26+ "suggest" : {
27+ "ext-pdo_sqlite" : " to use SQLiteStorage or SQLiteJournal"
28+ },
2629 "conflict" : {
2730 "nette/nette" : " <2.2"
2831 },
Original file line number Diff line number Diff line change @@ -29,20 +29,16 @@ public function loadConfiguration()
2929 {
3030 $ builder = $ this ->getContainerBuilder ();
3131
32- if (extension_loaded ('pdo_sqlite ' )) {
33- $ builder ->addDefinition ($ this ->prefix ('journal ' ))
34- ->setClass ('Nette\Caching\Storages\IJournal ' )
35- ->setFactory ('Nette\Caching\Storages\SQLiteJournal ' , [$ this ->tempDir . '/cache/journal.s3db ' ]);
36- }
32+ $ builder ->addDefinition ($ this ->prefix ('journal ' ))
33+ ->setClass ('Nette\Caching\Storages\IJournal ' )
34+ ->setFactory ('Nette\Caching\Storages\SQLiteJournal ' , [$ this ->tempDir . '/cache/journal.s3db ' ]);
3735
3836 $ builder ->addDefinition ($ this ->prefix ('storage ' ))
3937 ->setClass ('Nette\Caching\IStorage ' )
4038 ->setFactory ('Nette\Caching\Storages\FileStorage ' , [$ this ->tempDir . '/cache ' ]);
4139
4240 if ($ this ->name === 'cache ' ) {
43- if (extension_loaded ('pdo_sqlite ' )) {
44- $ builder ->addAlias ('nette.cacheJournal ' , $ this ->prefix ('journal ' ));
45- }
41+ $ builder ->addAlias ('nette.cacheJournal ' , $ this ->prefix ('journal ' ));
4642 $ builder ->addAlias ('cacheStorage ' , $ this ->prefix ('storage ' ));
4743 }
4844 }
Original file line number Diff line number Diff line change @@ -28,15 +28,16 @@ class SQLiteJournal extends Nette\Object implements IJournal
2828 */
2929 public function __construct ($ path = ':memory: ' )
3030 {
31- if (!extension_loaded ('pdo_sqlite ' )) {
32- throw new Nette \NotSupportedException ('SQLiteJournal requires PHP extension pdo_sqlite which is not loaded. ' );
33- }
3431 $ this ->path = $ path ;
3532 }
3633
3734
3835 private function open ()
3936 {
37+ if (!extension_loaded ('pdo_sqlite ' )) {
38+ throw new Nette \NotSupportedException ('SQLiteJournal requires PHP extension pdo_sqlite which is not loaded. ' );
39+ }
40+
4041 $ this ->pdo = new \PDO ('sqlite: ' . $ this ->path );
4142 $ this ->pdo ->setAttribute (\PDO ::ATTR_ERRMODE , \PDO ::ERRMODE_EXCEPTION );
4243 $ this ->pdo ->exec ('
You can’t perform that action at this time.
0 commit comments