Commit 612c29cf authored by gdd's avatar gdd

Added an exception handler to config->get() which handles situations where the...

Added an exception handler to config->get() which handles situations where the db is not in place, allowing us to remove a call to db_table_exists() which should improve cached performance a bit
parent 47cdc754
......@@ -14,11 +14,13 @@ class DrupalVerifiedStorageSQL extends DrupalConfigVerifiedStorage {
*/
public function read() {
// There are situations, like in the installer, where we may attempt a
// read without actually having the database available. This is a
// workaround and there is probably a better solution to be had at
// some point.
if (!empty($GLOBALS['databases']) && db_table_exists('config')) {
return db_query('SELECT data FROM {config} WHERE name = :name', array(':name' => $this->name))->fetchField();
// read without actually having the database available. In this case,
// catch the exception and just return an empty array so the caller can
// handle it if need be.
try {
return db_query('SELECT data FROM {config} WHERE name = :name', array(':name' => $this->name), array('throw_exception' => TRUE))->fetchField();
} catch (Exception $e) {
return array();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment