diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2014-07-11 16:03:59 +0200 |
---|---|---|
committer | Nicolas Lœuillet <nicolas@loeuillet.org> | 2014-07-11 16:03:59 +0200 |
commit | 3602405ec0dbc576fce09ff9e865ba2404622080 (patch) | |
tree | 45f9de611f4936091b0ed29a6a21fa4fef9b330b /inc/poche/Database.class.php | |
parent | 6400371ff93782d25cdbd50aa224c70145b3890a (diff) | |
download | wallabag-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-x | inc/poche/Database.class.php | 19 |
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 | ||
11 | class Database { | 11 | class 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 = ' |