diff options
author | Jeena <spam@jeenaparadies.net> | 2015-07-15 20:04:07 -0700 |
---|---|---|
committer | Jeena <spam@jeenaparadies.net> | 2015-07-24 20:52:16 +0200 |
commit | 8de9fd30276a273e715c0f3ee4cf227d2927bb36 (patch) | |
tree | 9cda9fbe2cd4ea6a80541445cec223b6e8de9bc4 /lib | |
parent | 91307d4a362a8fab0022aba19ab74bec9cb46f8f (diff) |
adds possibility to use sqlite as a db
Diffstat (limited to 'lib')
-rw-r--r-- | lib/config.template.php | 5 | ||||
-rw-r--r-- | lib/helpers.php | 10 |
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/config.template.php b/lib/config.template.php index dae8968..ee822bb 100644 --- a/lib/config.template.php +++ b/lib/config.template.php @@ -4,11 +4,16 @@ class Config { public static $base_url = 'http://quill.dev/'; public static $gaid = ''; + // MySQL (default) public static $dbHost = '127.0.0.1'; public static $dbName = 'quill'; public static $dbUsername = 'quill'; public static $dbPassword = ''; + // Sqlite + // public static $dbType = 'sqlite'; + // public static $dbFilePath = './example.db'; + public static $jwtSecret = 'xxx'; public static $fbClientID = ''; diff --git a/lib/helpers.php b/lib/helpers.php index 4f6b4c1..e7e7771 100644 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -1,8 +1,12 @@ <?php -ORM::configure('mysql:host=' . Config::$dbHost . ';dbname=' . Config::$dbName); -ORM::configure('username', Config::$dbUsername); -ORM::configure('password', Config::$dbPassword); +if(Config::$dbType == 'sqlite') { + ORM::configure('sqlite:' . Config::$dbFilePath); +} else { + ORM::configure('mysql:host=' . Config::$dbHost . ';dbname=' . Config::$dbName); + ORM::configure('username', Config::$dbUsername); + ORM::configure('password', Config::$dbPassword); +} function render($page, $data) { global $app; |