Browse Source

- Use a PHP file to store the database configuration

- Fix the database update button
pull/16/head
Jaussoin Timothée 12 years ago
parent
commit
c8163f3b09
  1. 12
      app/widgets/AdminDB/AdminDB.php
  2. 4
      bootstrap.php
  3. 17
      config/db.example.inc.php
  4. 15
      config/db.example.ini

12
app/widgets/AdminDB/AdminDB.php

@ -21,6 +21,13 @@ class AdminDB extends WidgetBase
}
public function ajaxUpdateDatabase()
{
$md = \modl\Modl::getInstance();
$md->check(true);
RPC::call('movim_reload_this');
}
function display()
{
$md = \modl\Modl::getInstance();
@ -37,14 +44,13 @@ class AdminDB extends WidgetBase
$errors = $e->getMessage();
}
if(file_exists(DOCUMENT_ROOT.'/config/db.ini')) {
$conf = parse_ini_file(DOCUMENT_ROOT.'/config/db.ini');
if(file_exists(DOCUMENT_ROOT.'/config/db.inc.php')) {
require DOCUMENT_ROOT.'/config/db.inc.php';
}
$supported = $md->getSupportedDatabases();
$this->view->assign('connected', $md->_connected);
$this->view->assign('validatebutton', $this->_validatebutton);
$this->view->assign('conf', $conf);
$this->view->assign('dbtype', $supported[$conf['type']]);
$this->view->assign('errors', $errors);

4
bootstrap.php

@ -265,8 +265,8 @@ class Bootstrap {
Modl\Utils::loadModel('Sessionx');
Modl\Utils::loadModel('Conference');
if(file_exists(DOCUMENT_ROOT.'/config/db.ini')) {
$conf = parse_ini_file(DOCUMENT_ROOT.'/config/db.ini');
if(file_exists(DOCUMENT_ROOT.'/config/db.inc.php')) {
require DOCUMENT_ROOT.'/config/db.inc.php';
} else {
throw new MovimException('Cannot find config/db.ini file');
}

17
config/db.example.inc.php

@ -0,0 +1,17 @@
<?php
# This is the database configuration of Movim
# You need to copy an rename this file to 'db.ini' and complete the values
$conf = array(
# The type can be 'pgsql' or 'mysql'
'type' => 'mysql',
# The database username
'username' => 'username',
# The password
'password' => 'password',
# Where can we find the database ?
'host' => 'localhost',
# The port number, 3306 for MySQL and 5432 for PostGreSQL
'port' => 3306,
# The database name
'database' => 'movim'
);

15
config/db.example.ini

@ -1,15 +0,0 @@
; This is the database configuration of Movim
; You need to copy an rename this file to 'db.ini' and complete the values
[db]
; The type can be 'pgsql' or 'mysql'
type = 'mysql'
; The database username
username = 'username'
; The password
password = 'password'
; Where can we find the database ?
host = 'localhost'
; The port number, 3306 for MySQL and 5432 for PostGreSQL
port = 3306
; The database name
database = 'movim'
Loading…
Cancel
Save