Back to InstallerAdapter class

Method parseQueries

protected void
parseQueries
()
Method to parse the queries specified in the `<sql>` tags
Returns
  • void
Since
  • 3.4
-
  • \RuntimeException

Method parseQueries - Source code

/**
 * Method to parse the queries specified in the `<sql>` tags
 *
 * @return  void
 *
 * @since   3.4
 * @throws  \RuntimeException
 */
protected function parseQueries()
{
    // Let's run the queries for the extension
    if (\in_array($this->route, array('install', 'discover_install', 'uninstall'))) {
        // This method may throw an exception, but it is caught by the parent caller
        if (!$this->doDatabaseTransactions()) {
            throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_INSTALL_ABORTED'));
        }
        // Set the schema version to be the latest update version
        if ($this->getManifest()->update) {
            $this->parent->setSchemaVersion($this->getManifest()->update->schemas, $this->extension->extension_id);
        }
    } elseif ($this->route === 'update') {
        if ($this->getManifest()->update) {
            $result = $this->parent->parseSchemaUpdates($this->getManifest()->update->schemas, $this->extension->extension_id);
            if ($result === false) {
                // Install failed, rollback changes
                throw new \RuntimeException(Text::_('JLIB_INSTALLER_ABORT_INSTALL_ABORTED'));
            }
        }
    }
}