Example #1
0
 /**
  * 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(JText::sprintf('JLIB_INSTALLER_ABORT_SQL_ERROR', JText::_('JLIB_INSTALLER_' . strtoupper($this->route)), $this->db->stderr(true)));
         }
         // 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(JText::sprintf('JLIB_INSTALLER_ABORT_SQL_ERROR', JText::_('JLIB_INSTALLER_' . strtoupper($this->route)), $this->db->stderr(true)));
             }
         }
     }
 }