From 823d71ced9b4947b1a5a5ade7245d521ed490061 Mon Sep 17 00:00:00 2001 From: emkael Date: Tue, 7 Jun 2016 15:17:49 +0200 Subject: * renaming php directory --- app/frontend/db/DBModule.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 app/frontend/db/DBModule.php (limited to 'app/frontend/db/DBModule.php') diff --git a/app/frontend/db/DBModule.php b/app/frontend/db/DBModule.php new file mode 100644 index 0000000..462b6f6 --- /dev/null +++ b/app/frontend/db/DBModule.php @@ -0,0 +1,40 @@ +getAttributes() as $attr => $val) { + $newXML->setAttribute($attr, $val); + } + $dbXML = new TXmlElement('database'); + $config = json_decode(file_get_contents( + Prado::getPathOfNamespace($this->_config, '.json') + )); + if (isset($config->cset)) { + $dbXML->setAttribute('Charset', $config->cset); + } + $dbXML->setAttribute('Username', $config->user); + $dbXML->setAttribute('Password', $config->pass); + $dbXML->setAttribute( + 'ConnectionString', + sprintf( + '%s:host=%s;dbname=%s', + $config->type, $config->host, $config->name + ) + ); + $newXML->Elements[] = $dbXML; + parent::init($newXML); + } + + public function setConfig($config) { + $this->_config = TPropertyValue::ensureString($config); + } + +} + +?> -- cgit v1.2.3