aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Database.class.php
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas@loeuillet.org>2014-07-11 16:03:59 +0200
committerNicolas Lœuillet <nicolas@loeuillet.org>2014-07-11 16:03:59 +0200
commit3602405ec0dbc576fce09ff9e865ba2404622080 (patch)
tree45f9de611f4936091b0ed29a6a21fa4fef9b330b /inc/poche/Database.class.php
parent6400371ff93782d25cdbd50aa224c70145b3890a (diff)
downloadwallabag-3602405ec0dbc576fce09ff9e865ba2404622080.tar.gz
wallabag-3602405ec0dbc576fce09ff9e865ba2404622080.tar.zst
wallabag-3602405ec0dbc576fce09ff9e865ba2404622080.zip
WHAT. A. BIG. REFACTOR. + new license (we moved to MIT one)
Diffstat (limited to 'inc/poche/Database.class.php')
-rwxr-xr-xinc/poche/Database.class.php19
1 files changed, 3 insertions, 16 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 11cccb72..9c1c0286 100755
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -5,7 +5,7 @@
5 * @category wallabag 5 * @category wallabag
6 * @author Nicolas Lœuillet <nicolas@loeuillet.org> 6 * @author Nicolas Lœuillet <nicolas@loeuillet.org>
7 * @copyright 2013 7 * @copyright 2013
8 * @license http://www.wtfpl.net/ see COPYING file 8 * @license http://opensource.org/licenses/MIT see COPYING file
9 */ 9 */
10 10
11class Database { 11class Database {
@@ -38,6 +38,7 @@ class Database {
38 } 38 }
39 39
40 $this->handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 40 $this->handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
41 $this->_checkTags();
41 Tools::logm('storage type ' . STORAGE); 42 Tools::logm('storage type ' . STORAGE);
42 } 43 }
43 44
@@ -45,21 +46,7 @@ class Database {
45 return $this->handle; 46 return $this->handle;
46 } 47 }
47 48
48 public function isInstalled() { 49 private function _checkTags() {
49 $sql = "SELECT username FROM users";
50 $query = $this->executeQuery($sql, array());
51 if ($query == false) {
52 die(STORAGE . ' database looks empty. You have to create it (you can find database structure in install folder).');
53 }
54 $hasAdmin = count($query->fetchAll());
55
56 if ($hasAdmin == 0)
57 return false;
58
59 return true;
60 }
61
62 public function checkTags() {
63 50
64 if (STORAGE == 'sqlite') { 51 if (STORAGE == 'sqlite') {
65 $sql = ' 52 $sql = '