diff options
author | Silvio <silvio@devlet.com.br> | 2010-04-06 14:05:07 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-04-06 14:05:07 -0300 |
commit | f6f1d270419bbd9696974719b15b8c01b19b032b (patch) | |
tree | b27a0cd0cc3e79a9d7d1b8fa75e183411db79569 /classes/CinIsis.php | |
parent | f3fea8713e9c82b3afe2c54a8fa997396f8bb87b (diff) | |
download | cinisis-f6f1d270419bbd9696974719b15b8c01b19b032b.tar.gz cinisis-f6f1d270419bbd9696974719b15b8c01b19b032b.tar.bz2 |
Config parse and check
Diffstat (limited to 'classes/CinIsis.php')
-rw-r--r-- | classes/CinIsis.php | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/classes/CinIsis.php b/classes/CinIsis.php deleted file mode 100644 index ff1de68..0000000 --- a/classes/CinIsis.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -/** - * CinIsis main class. - */ -class CinIsis { - /** - * @var $db - * Database resource. - */ - var $db; - - /** - * @var $implementation - * Database implementation. - */ - var $implementation; - - /** - * Constructor. - * - * @param $file - * Optional parameter to set alternative config file. - * - * @todo - * Config check. - */ - function __construct($file = 'config/config.yaml') { - try { - // Load main configuration. - $config = $this->config($file); - - // Load database schema. - $schema = $this->config('schemas/'. $config['database'] .'.yaml'); - } catch (Exception $e) { - echo '[cinisis] caught exception: ', $e->getMessage(), "\n"; - return FALSE; - } - - // Setup database connection. - $this->implementation = $config['implementation'] .'Db'; - $this->db = new $this->implementation($schema); - } - - /** - * Config file load. - * - * @param $file - * Config file. - * - * @return - * Array with configuration. - */ - function config($file) { - if (!file_exists($file)) { - throw new Exception('Config '. $file .' not found.'); - } - - // Load configuration. - return Spyc::YAMLLoad($file); - } -} |