mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-27 11:22:17 -05:00
setup of storage
This commit is contained in:
parent
bc1ee8524e
commit
68857cea8c
@ -9,24 +9,25 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class Database {
|
class Database {
|
||||||
|
|
||||||
#postgresql
|
|
||||||
public static $db_path = 'pgsql:host=localhost;dbname=poche';
|
|
||||||
public static $user = 'postgres';
|
|
||||||
public static $password = 'postgres';
|
|
||||||
#sqlite
|
|
||||||
// public static $db_path = 'sqlite:./db/poche.sqlite';
|
|
||||||
// public static $user = '';
|
|
||||||
// public static $password = '';
|
|
||||||
#mysql
|
|
||||||
// public static $db_path = 'mysql:host=localhost;dbname=poche';
|
|
||||||
// public static $user = 'root';
|
|
||||||
// public static $password = 'root';
|
|
||||||
|
|
||||||
var $handle;
|
var $handle;
|
||||||
|
|
||||||
function __construct() {
|
function __construct()
|
||||||
$this->handle = new PDO(self::$db_path, self::$user, self::$password);
|
{
|
||||||
|
switch (STORAGE) {
|
||||||
|
case 'sqlite':
|
||||||
|
$db_path = 'sqlite:' . STORAGE_SQLITE;
|
||||||
|
$this->handle = new PDO($db_path);
|
||||||
|
break;
|
||||||
|
case 'mysql':
|
||||||
|
$db_path = 'mysql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB;
|
||||||
|
$this->handle = new PDO($db_path, STORAGE_USER, STORAGE_PASSWORD);
|
||||||
|
break;
|
||||||
|
case 'postgres':
|
||||||
|
$db_path = 'pgsql:host=' . STORAGE_SERVER . ';dbname=' . STORAGE_DB;
|
||||||
|
$this->handle = new PDO($db_path, STORAGE_USER, STORAGE_PASSWORD);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$this->handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$this->handle->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,14 @@
|
|||||||
* @license http://www.wtfpl.net/ see COPYING file
|
* @license http://www.wtfpl.net/ see COPYING file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
# storage
|
||||||
|
define ('STORAGE','postgres'); # postgres, mysql, sqlite
|
||||||
|
define ('STORAGE_SERVER', 'localhost'); # leave blank for sqlite
|
||||||
|
define ('STORAGE_DB', 'poche'); # only for postgres & mysql
|
||||||
|
define ('STORAGE_SQLITE', './db/poche.sqlite');
|
||||||
|
define ('STORAGE_USER', 'postgres'); # leave blank for sqlite
|
||||||
|
define ('STORAGE_PASSWORD', 'postgres'); # leave blank for sqlite
|
||||||
|
|
||||||
define ('POCHE_VERSION', '1.0-beta');
|
define ('POCHE_VERSION', '1.0-beta');
|
||||||
define ('MODE_DEMO', FALSE);
|
define ('MODE_DEMO', FALSE);
|
||||||
define ('DEBUG_POCHE', TRUE);
|
define ('DEBUG_POCHE', TRUE);
|
||||||
@ -24,7 +32,6 @@ define ('CACHE', './cache');
|
|||||||
define ('LANG', 'en_EN.UTF8');
|
define ('LANG', 'en_EN.UTF8');
|
||||||
define ('PAGINATION', '10');
|
define ('PAGINATION', '10');
|
||||||
define ('THEME', 'light');
|
define ('THEME', 'light');
|
||||||
define ('STORAGE','postgres'); # postgres, mysql, sqlite
|
|
||||||
|
|
||||||
# /!\ Be careful if you change the lines below /!\
|
# /!\ Be careful if you change the lines below /!\
|
||||||
require_once './inc/poche/User.class.php';
|
require_once './inc/poche/User.class.php';
|
||||||
|
Loading…
Reference in New Issue
Block a user