Rev 68 | Rev 74 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 68 | Rev 69 | ||
|---|---|---|---|
| Line 156... | Line 156... | ||
| 156 | * The configuration array if the configuration
|
156 | * The configuration array if the configuration
|
| 157 | * file could be read, <code>false</code> otherwise.
|
157 | * file could be read, <code>false</code> otherwise.
|
| 158 | */
|
158 | */
|
| 159 | public function readConfig () |
159 | public function readConfig () |
| 160 | {
|
160 | {
|
| - | 161 | /* FIXME: Configuration file path should not be hardcoded */
|
|
| 161 | $config = parse_ini_file('application/.config', true); |
162 | $config = parse_ini_file('application/.config', true); |
| 162 | if ($config !== false) |
163 | if ($config !== false) |
| 163 | {
|
164 | {
|
| 164 | $section = 'database:' . $this->_dbname; |
165 | $section = 'database:' . $this->_dbname; |
| 165 | if (isset($config[$section])) |
166 | if (isset($config[$section])) |
| Line 171... | Line 172... | ||
| 171 | 172 | ||
| 172 | foreach ($options as $key) |
173 | foreach ($options as $key) |
| 173 | {
|
174 | {
|
| 174 | $property = "_$key"; |
175 | $property = "_$key"; |
| 175 | if (isset($dbconfig[$key]) |
176 | if (isset($dbconfig[$key]) |
| 176 | && $key == 'dbname' |
177 | && ($key == 'dbname' |
| 177 | || (property_exists($this, $property) |
178 | || (property_exists($this, $property) |
| 178 | && $this->$property === null)) |
179 | && $this->$property === null))) |
| 179 | {
|
180 | {
|
| 180 | $this->$property = $dbconfig[$key]; |
181 | $this->$property = $dbconfig[$key]; |
| 181 | }
|
182 | }
|
| 182 | }
|
183 | }
|
| 183 | 184 | ||