diff options
Diffstat (limited to 'app/model/sysconf.mod.php')
-rw-r--r-- | app/model/sysconf.mod.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/app/model/sysconf.mod.php b/app/model/sysconf.mod.php index 30ebd58..49e3b4d 100644 --- a/app/model/sysconf.mod.php +++ b/app/model/sysconf.mod.php @@ -19,6 +19,8 @@ class SysconfModel extends MasterModel */ function save($input) { + global $_SCROTT; + $form = new Form(); $form->field_text("dbAddress"); $form->field_text("dbName"); @@ -32,8 +34,25 @@ class SysconfModel extends MasterModel return; } - /* TODO -- test database connection before proceeding */ + /* test database connection (set global vars and try to get a db object) */ + $_SCROTT['conf'] = 'conf'; + $_SCROTT['dbEngine'] = 'mysql'; + $_SCROTT['dbAddress'] = $form->dbAddress; + $_SCROTT['dbName'] = $form->dbName; + $_SCROTT['dbUser'] = $form->dbUser; + $_SCROTT['dbPass'] = $form->dbPass; + + try + { + $db = $this->getDbConnection(); + } + catch (Exception $e) + { + $this->logError($e->getMessage()); + return; + } + /* write file */ $f = fopen($this->CONF_FILE, "w"); if (!$f) |