public function setFile($file)
{
if (!is_readable($file)) {
throw new InvalidArgumentException(sprintf('"app/etc/local.xml"-file %s is not readable', var_export($file, true)));
}
$saved = libxml_use_internal_errors(true);
$config = simplexml_load_file($file);
libxml_use_internal_errors($saved);
if (false === $config) {
throw new InvalidArgumentException(sprintf('Unable to open "app/etc/local.xml"-file %s and parse it as XML', var_export($file, true)));
}
$resources = $config->global->resources;
if (!$resources) {
throw new InvalidArgumentException('DB global resources was not found in "app/etc/local.xml"-file');
}
if (!$resources->default_setup->connection) {
throw new InvalidArgumentException('DB settings (default_setup) was not found in "app/etc/local.xml"-file');
}
$this->parseResources($resources);
}