summaryrefslogtreecommitdiff
path: root/db.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-06-28 12:32:48 +0300
committerAndrew Dolgov <[email protected]>2017-06-28 12:32:48 +0300
commit9f4927825bb5efeefdff9a2aac05c5b3200f5ef6 (patch)
treef7782cb57127c68bfd5c67fb0d90c725eb8f0e68 /db.php
parent4496d4a5e1f3ddb5fd0b3a0315f12c207e7c9041 (diff)
move to internal user management because it's impossible to implement
proper transparent offline mode with http auth (worker is incapable of authenticating properly) MIGRATION: 1. disable HTTP authentication (this is important!) 2. add two new tables to db/scratch.db (sessions & users) 3. create users via useradm.php (same names and passwords, previous data is kept)
Diffstat (limited to 'db.php')
-rw-r--r--db.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/db.php b/db.php
new file mode 100644
index 0000000..1dc8ce0
--- /dev/null
+++ b/db.php
@@ -0,0 +1,20 @@
+<?php
+class Db {
+ private static $instance;
+ private $dbh;
+
+ private function __construct() {
+ $this->dbh = new SQLite3(__DIR__ . "/" . SCRATCH_DB);
+ $this->dbh->busyTimeout(30*1000);
+ }
+
+ public static function get() {
+ if (self::$instance == null)
+ self::$instance = new self();
+
+ return self::$instance->dbh;
+ }
+
+};
+
+?>