/**
* Method to handle database transactions for the installer
*
* @return boolean True on success
*
* @since 3.4
* @throws \RuntimeException
*/
protected function doDatabaseTransactions()
{
$route = $this->route === 'discover_install' ? 'install' : $this->route;
// Let's run the install queries for the component
if (isset($this->getManifest()->{$route}->sql)) {
$result = $this->parent->parseSQLFiles($this->getManifest()->{$route}->sql);
if ($result === false) {
// Only rollback if installing
if ($route === 'install') {
throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_INSTALL_ABORTED'));
}
return false;
}
// If installing with success and there is an uninstall script, add an installer rollback step to rollback if needed
if ($route === 'install' && isset($this->getManifest()->uninstall->sql)) {
$this->parent->pushStep(array('type' => 'query', 'script' => $this->getManifest()->uninstall->sql));
}
}
return true;
}